diff --git a/README.md b/README.md index 5c3a0e6..e347860 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,18 @@ By default, no test recording will be performed. Here are the system properties * possible values are `FLV` or `MP4` * defaults to `MP4` +#### Observability and Tracing +Selenium integrates with [OpenTelemetry](https://opentelemetry.io) to support observability and tracing out of the box. By default, Selenium [enables tracing](https://www.selenium.dev/blog/2021/selenium-4-observability). + +This plugin, however, **disables tracing by default** since most setups lack an OpenTelemetry collector to process the traces. + +To enable tracing, set the following system property: +* `grails.geb.tracing.enabled` + * possible values are `true` or `false` + * defaults to `false` + +This allows you to opt in to tracing when an OpenTelemetry collector is available. + ### GebSpec If you choose to extend `GebSpec`, you will need to have a [Selenium WebDriver](https://www.selenium.dev/documentation/webdriver/browsers/) installed that matches a browser you have installed on your system. diff --git a/src/testFixtures/groovy/grails/plugin/geb/GrailsGebSettings.groovy b/src/testFixtures/groovy/grails/plugin/geb/GrailsGebSettings.groovy index 264126d..606ba1c 100644 --- a/src/testFixtures/groovy/grails/plugin/geb/GrailsGebSettings.groovy +++ b/src/testFixtures/groovy/grails/plugin/geb/GrailsGebSettings.groovy @@ -38,6 +38,7 @@ class GrailsGebSettings { private static VncRecordingMode DEFAULT_RECORDING_MODE = VncRecordingMode.SKIP private static VncRecordingFormat DEFAULT_RECORDING_FORMAT = VncRecordingFormat.MP4 + String tracingEnabled String recordingDirectoryName String reportingDirectoryName VncRecordingMode recordingMode @@ -45,6 +46,7 @@ class GrailsGebSettings { LocalDateTime startTime GrailsGebSettings(LocalDateTime startTime) { + tracingEnabled = System.getProperty('grails.geb.tracing.enabled', 'false') recordingDirectoryName = System.getProperty('grails.geb.recording.directory', 'build/gebContainer/recordings') reportingDirectoryName = System.getProperty('grails.geb.reporting.directory', 'build/gebContainer/reports') recordingMode = VncRecordingMode.valueOf( diff --git a/src/testFixtures/groovy/grails/plugin/geb/WebDriverContainerHolder.groovy b/src/testFixtures/groovy/grails/plugin/geb/WebDriverContainerHolder.groovy index de3d367..a287f1b 100644 --- a/src/testFixtures/groovy/grails/plugin/geb/WebDriverContainerHolder.groovy +++ b/src/testFixtures/groovy/grails/plugin/geb/WebDriverContainerHolder.groovy @@ -104,6 +104,7 @@ class WebDriverContainerHolder { grailsGebSettings.recordingFormat ) currentContainer.tap { + withEnv('SE_ENABLE_TRACING', grailsGebSettings.tracingEnabled) withAccessToHost(true) start() }