Skip to content

Commit 2d4272f

Browse files
committed
Merge branch '4.1.x' into merge-4.1.x-into-5.0.x
# Conflicts: # gradle.properties
2 parents bf90bb9 + 667a075 commit 2d4272f

File tree

3 files changed

+20
-8
lines changed

3 files changed

+20
-8
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,18 @@ By default, no test recording will be performed. Various system properties exis
9494
* possible values are `FLV` or `MP4`
9595
* defaults to `MP4`
9696

97+
#### Observability and Tracing
98+
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).
99+
100+
This plugin, however, **disables tracing by default** since most setups lack an OpenTelemetry collector to process the traces.
101+
102+
To enable tracing, set the following system property:
103+
* `grails.geb.tracing.enabled`
104+
* possible values are `true` or `false`
105+
* defaults to `false`
106+
107+
This allows you to opt in to tracing when an OpenTelemetry collector is available.
108+
97109
### GebSpec
98110

99111
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: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,13 @@ class WebDriverContainerHolder {
9898
}
9999

100100
currentConfiguration = specConfiguration
101-
currentContainer = new BrowserWebDriverContainer()
102-
if (grailsGebSettings.recordingEnabled) {
103-
currentContainer = currentContainer.withRecordingMode(
104-
grailsGebSettings.recordingMode,
105-
grailsGebSettings.recordingDirectory,
106-
grailsGebSettings.recordingFormat
107-
)
108-
}
101+
currentContainer = new BrowserWebDriverContainer().withRecordingMode(
102+
grailsGebSettings.recordingMode,
103+
grailsGebSettings.recordingDirectory,
104+
grailsGebSettings.recordingFormat
105+
)
109106
currentContainer.tap {
107+
withEnv('SE_ENABLE_TRACING', grailsGebSettings.tracingEnabled)
110108
withAccessToHost(true)
111109
start()
112110
}

0 commit comments

Comments
 (0)