Skip to content

Commit 667a075

Browse files
authored
Add Setting to Disable Tracing (#120)
* fix: add setting to disable tracing Close gh-119 * docs: document `grails.geb.tracing.enabled` setting
1 parent fa6201f commit 667a075

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,18 @@ By default, no test recording will be performed. Here are the system properties
7676
* possible values are `FLV` or `MP4`
7777
* defaults to `MP4`
7878

79+
#### Observability and Tracing
80+
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).
81+
82+
This plugin, however, **disables tracing by default** since most setups lack an OpenTelemetry collector to process the traces.
83+
84+
To enable tracing, set the following system property:
85+
* `grails.geb.tracing.enabled`
86+
* possible values are `true` or `false`
87+
* defaults to `false`
88+
89+
This allows you to opt in to tracing when an OpenTelemetry collector is available.
90+
7991
### GebSpec
8092

8193
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.

src/testFixtures/groovy/grails/plugin/geb/GrailsGebSettings.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ class GrailsGebSettings {
3838
private static VncRecordingMode DEFAULT_RECORDING_MODE = VncRecordingMode.SKIP
3939
private static VncRecordingFormat DEFAULT_RECORDING_FORMAT = VncRecordingFormat.MP4
4040

41+
String tracingEnabled
4142
String recordingDirectoryName
4243
String reportingDirectoryName
4344
VncRecordingMode recordingMode
4445
VncRecordingFormat recordingFormat
4546
LocalDateTime startTime
4647

4748
GrailsGebSettings(LocalDateTime startTime) {
49+
tracingEnabled = System.getProperty('grails.geb.tracing.enabled', 'false')
4850
recordingDirectoryName = System.getProperty('grails.geb.recording.directory', 'build/gebContainer/recordings')
4951
reportingDirectoryName = System.getProperty('grails.geb.reporting.directory', 'build/gebContainer/reports')
5052
recordingMode = VncRecordingMode.valueOf(

src/testFixtures/groovy/grails/plugin/geb/WebDriverContainerHolder.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ class WebDriverContainerHolder {
104104
grailsGebSettings.recordingFormat
105105
)
106106
currentContainer.tap {
107+
withEnv('SE_ENABLE_TRACING', grailsGebSettings.tracingEnabled)
107108
withAccessToHost(true)
108109
start()
109110
}

0 commit comments

Comments
 (0)