Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable tracing observability in docker-compose and helm chart #2137

Merged
merged 1 commit into from
Feb 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ ENV SE_BIND_HOST false
# Boolean value, maps "--reject-unsupported-caps"
ENV SE_REJECT_UNSUPPORTED_CAPS false

ENV SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED true
ENV SE_OTEL_TRACES_EXPORTER "otlp"

# A too high maximum number of file descriptors (with the default value
# inherited from the docker host) can cause issues with some of our tools:
# - sanitizers hanging: https://github.com/google/sanitizers/issues/1662
Expand Down
2 changes: 2 additions & 0 deletions Distributor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ COPY selenium-grid-distributor.conf /etc/supervisor/conf.d/
ENV SE_SESSION_REQUEST_TIMEOUT 300
# In seconds, maps to "--session-retry-interval"
ENV SE_SESSION_RETRY_INTERVAL 15

ENV SE_OTEL_SERVICE_NAME "selenium-distributor"
18 changes: 17 additions & 1 deletion Distributor/start-selenium-grid-distributor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,28 @@ fi

EXTRA_LIBS=""

if [ ! -z "$SE_ENABLE_TRACING" ]; then
if [ "$SE_ENABLE_TRACING" = "true" ]; then
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
echo "Tracing is enabled"
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
fi
if [ -n "$SE_OTEL_TRACES_EXPORTER" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.traces.exporter=${SE_OTEL_TRACES_EXPORTER}"
fi
if [ -n "$SE_OTEL_EXPORTER_ENDPOINT" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.exporter.${SE_OTEL_TRACES_EXPORTER,,}.endpoint=${SE_OTEL_EXPORTER_ENDPOINT}"
fi
if [ -n "$SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.java.global-autoconfigure.enabled=${SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED}"
fi
if [ -n "$SE_OTEL_JVM_ARGS" ]; then
echo "List arguments for OpenTelemetry: ${SE_OTEL_JVM_ARGS}"
SE_JAVA_OPTS="$SE_JAVA_OPTS ${SE_OTEL_JVM_ARGS}"
fi
else
echo "Tracing is disabled"
fi
Expand Down
2 changes: 2 additions & 0 deletions EventBus/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ COPY --chown="${SEL_UID}:${SEL_GID}" start-selenium-grid-eventbus.sh \
/opt/bin/

COPY selenium-grid-eventbus.conf /etc/supervisor/conf.d/

ENV SE_OTEL_SERVICE_NAME "selenium-event-bus"
18 changes: 17 additions & 1 deletion EventBus/start-selenium-grid-eventbus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,28 @@ fi

EXTRA_LIBS=""

if [ ! -z "$SE_ENABLE_TRACING" ]; then
if [ "$SE_ENABLE_TRACING" = "true" ]; then
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
echo "Tracing is enabled"
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
fi
if [ -n "$SE_OTEL_TRACES_EXPORTER" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.traces.exporter=${SE_OTEL_TRACES_EXPORTER}"
fi
if [ -n "$SE_OTEL_EXPORTER_ENDPOINT" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.exporter.${SE_OTEL_TRACES_EXPORTER,,}.endpoint=${SE_OTEL_EXPORTER_ENDPOINT}"
fi
if [ -n "$SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.java.global-autoconfigure.enabled=${SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED}"
fi
if [ -n "$SE_OTEL_JVM_ARGS" ]; then
echo "List arguments for OpenTelemetry: ${SE_OTEL_JVM_ARGS}"
SE_JAVA_OPTS="$SE_JAVA_OPTS ${SE_OTEL_JVM_ARGS}"
fi
else
echo "Tracing is disabled"
fi
Expand Down
2 changes: 2 additions & 0 deletions Hub/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ COPY --chown="${SEL_UID}:${SEL_GID}" start-selenium-grid-hub.sh \
/opt/bin/

COPY selenium-grid-hub.conf /etc/supervisor/conf.d/

ENV SE_OTEL_SERVICE_NAME "selenium-hub"
18 changes: 17 additions & 1 deletion Hub/start-selenium-grid-hub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,28 @@ fi

EXTRA_LIBS=""

if [ ! -z "$SE_ENABLE_TRACING" ]; then
if [ "$SE_ENABLE_TRACING" = "true" ]; then
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
echo "Tracing is enabled"
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
fi
if [ -n "$SE_OTEL_TRACES_EXPORTER" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.traces.exporter=${SE_OTEL_TRACES_EXPORTER}"
fi
if [ -n "$SE_OTEL_EXPORTER_ENDPOINT" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.exporter.${SE_OTEL_TRACES_EXPORTER,,}.endpoint=${SE_OTEL_EXPORTER_ENDPOINT}"
fi
if [ -n "$SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.java.global-autoconfigure.enabled=${SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED}"
fi
if [ -n "$SE_OTEL_JVM_ARGS" ]; then
echo "List arguments for OpenTelemetry: ${SE_OTEL_JVM_ARGS}"
SE_JAVA_OPTS="$SE_JAVA_OPTS ${SE_OTEL_JVM_ARGS}"
fi
else
echo "Tracing is disabled"
fi
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -450,11 +450,11 @@ chart_test_autoscaling_deployment_https:
SELENIUM_GRID_TEST_HEADLESS=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_PORT=443 make chart_test_autoscaling_deployment

chart_test_autoscaling_deployment:
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) NAMESPACE=$(NAMESPACE) \
SE_ENABLE_TRACING=true VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) NAMESPACE=$(NAMESPACE) \
./tests/charts/make/chart_test.sh DeploymentAutoscaling

chart_test_autoscaling_job_https:
SELENIUM_GRID_TEST_HEADLESS=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_PORT=443 make chart_test_autoscaling_job
SE_ENABLE_TRACING=true SELENIUM_GRID_TEST_HEADLESS=true SELENIUM_GRID_PROTOCOL=https SELENIUM_GRID_PORT=443 make chart_test_autoscaling_job

chart_test_autoscaling_job:
VERSION=$(TAG_VERSION) VIDEO_TAG=$(FFMPEG_TAG_VERSION)-$(BUILD_DATE) NAMESPACE=$(NAMESPACE) \
Expand Down
1 change: 1 addition & 0 deletions NodeBase/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ ENV SE_NODE_OVERRIDE_MAX_SESSIONS false

# Following line fixes https://github.com/SeleniumHQ/docker-selenium/issues/87
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
ENV SE_OTEL_SERVICE_NAME "selenium-node"

# Copying configuration script generator
COPY --chown="${SEL_UID}:${SEL_GID}" generate_config /opt/bin/generate_config
Expand Down
18 changes: 17 additions & 1 deletion NodeBase/start-selenium-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,28 @@ fi

EXTRA_LIBS=""

if [ ! -z "$SE_ENABLE_TRACING" ]; then
if [ "$SE_ENABLE_TRACING" = "true" ]; then
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
echo "Tracing is enabled"
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
fi
if [ -n "$SE_OTEL_TRACES_EXPORTER" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.traces.exporter=${SE_OTEL_TRACES_EXPORTER}"
fi
if [ -n "$SE_OTEL_EXPORTER_ENDPOINT" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.exporter.${SE_OTEL_TRACES_EXPORTER,,}.endpoint=${SE_OTEL_EXPORTER_ENDPOINT}"
fi
if [ -n "$SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.java.global-autoconfigure.enabled=${SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED}"
fi
if [ -n "$SE_OTEL_JVM_ARGS" ]; then
echo "List arguments for OpenTelemetry: ${SE_OTEL_JVM_ARGS}"
SE_JAVA_OPTS="$SE_JAVA_OPTS ${SE_OTEL_JVM_ARGS}"
fi
else
echo "Tracing is disabled"
fi
Expand Down
2 changes: 2 additions & 0 deletions NodeChrome/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,5 @@ USER ${SEL_UID}
RUN echo "chrome" > /opt/selenium/browser_name
RUN google-chrome --version | awk '{print $3}' > /opt/selenium/browser_version
RUN echo "\"goog:chromeOptions\": {\"binary\": \"/usr/bin/google-chrome\"}" > /opt/selenium/browser_binary_location

ENV SE_OTEL_SERVICE_NAME "selenium-node-chrome"
1 change: 1 addition & 0 deletions NodeDocker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ COPY --chown="${SEL_UID}:${SEL_GID}" start-selenium-grid-docker.sh \

COPY selenium-grid-docker.conf /etc/supervisor/conf.d/

ENV SE_OTEL_SERVICE_NAME "selenium-node-docker"
18 changes: 17 additions & 1 deletion NodeDocker/start-selenium-grid-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,28 @@ fi

EXTRA_LIBS=""

if [ ! -z "$SE_ENABLE_TRACING" ]; then
if [ "$SE_ENABLE_TRACING" = "true" ]; then
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
echo "Tracing is enabled"
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
fi
if [ -n "$SE_OTEL_TRACES_EXPORTER" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.traces.exporter=${SE_OTEL_TRACES_EXPORTER}"
fi
if [ -n "$SE_OTEL_EXPORTER_ENDPOINT" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.exporter.${SE_OTEL_TRACES_EXPORTER,,}.endpoint=${SE_OTEL_EXPORTER_ENDPOINT}"
fi
if [ -n "$SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.java.global-autoconfigure.enabled=${SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED}"
fi
if [ -n "$SE_OTEL_JVM_ARGS" ]; then
echo "List arguments for OpenTelemetry: ${SE_OTEL_JVM_ARGS}"
SE_JAVA_OPTS="$SE_JAVA_OPTS ${SE_OTEL_JVM_ARGS}"
fi
else
echo "Tracing is disabled"
fi
Expand Down
2 changes: 2 additions & 0 deletions NodeEdge/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,5 @@ USER ${SEL_UID}
RUN echo "MicrosoftEdge" > /opt/selenium/browser_name
RUN microsoft-edge --version | awk '{print $3}' > /opt/selenium/browser_version
RUN echo "\"ms:edgeOptions\": {\"binary\": \"/usr/bin/microsoft-edge\"}" > /opt/selenium/browser_binary_location

ENV SE_OTEL_SERVICE_NAME "selenium-node-edge"
2 changes: 2 additions & 0 deletions NodeFirefox/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ USER ${SEL_UID}
RUN echo "firefox" > /opt/selenium/browser_name
RUN firefox --version | awk '{print $3}' > /opt/selenium/browser_version
RUN echo "\"moz:firefoxOptions\": {\"binary\": \"/usr/bin/firefox\"}" > /opt/selenium/browser_binary_location

ENV SE_OTEL_SERVICE_NAME "selenium-node-firefox"
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1267,26 +1267,29 @@ In order to enable tracing in the Selenium Grid container, the following command

```bash
docker network create grid
docker run -d -p 16686:16686 -p 14250:14250 --net grid --name jaeger jaegertracing/all-in-one:1.17
docker run -d -p 16686:16686 -p 14250:14250 -p 4317:4317 --net grid --name jaeger jaegertracing/all-in-one:1.54
docker run -d -p 4442-4444:4442-4444 --net grid --name selenium-hub selenium/hub:4.17.0-20240123
docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \
--shm-size="2g" \
-e SE_ENABLE_TRACING=true \
-e JAVA_OPTS="-Dotel.traces.exporter=jaeger -Dotel.exporter.jaeger.endpoint=http://jaegar:14250 -Dotel.resource.attributes=service.name=selenium-node-chrome" \
-e SE_OTEL_TRACES_EXPORTER=otlp \
-e SE_OTEL_EXPORTER_ENDPOINT=http://jaeger:4317 \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
selenium/node-chrome:4.17.0-20240123
docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \
--shm-size="2g" \
-e SE_ENABLE_TRACING=true \
-e JAVA_OPTS="-Dotel.traces.exporter=jaeger -Dotel.exporter.jaeger.endpoint=http://jaegar:14250 -Dotel.resource.attributes=service.name=selenium-node-edge" \
-e SE_OTEL_TRACES_EXPORTER=otlp \
-e SE_OTEL_EXPORTER_ENDPOINT=http://jaeger:4317 \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
selenium/node-edge:4.17.0-20240123
docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \
--shm-size="2g" \
-e SE_ENABLE_TRACING=true \
-e JAVA_OPTS="-Dotel.traces.exporter=jaeger -Dotel.exporter.jaeger.endpoint=http://jaegar:14250 -Dotel.resource.attributes=service.name=selenium-node-firefox" \
-e SE_OTEL_TRACES_EXPORTER=otlp \
-e SE_OTEL_EXPORTER_ENDPOINT=http://jaeger:4317 \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 \
-e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
selenium/node-firefox:4.17.0-20240123
Expand All @@ -1298,7 +1301,7 @@ You can also refer to the below docker-compose yaml files to be able to start a
* Simple Grid [v2 yaml file](docker-compose-v2-tracing.yml)
* Dynamic Grid [v3 yaml file](docker-compose-v3-full-grid-tracing.yml)

You can view the [Jaegar UI](http://localhost:16686/) and trace your request.
You can view the [Jaeger UI](http://localhost:16686/) and trace your request.
___

## Troubleshooting
Expand Down
2 changes: 2 additions & 0 deletions Router/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ COPY --chown="${SEL_UID}:${SEL_GID}" start-selenium-grid-router.sh \
/opt/bin/

COPY selenium-grid-router.conf /etc/supervisor/conf.d/

ENV SE_OTEL_SERVICE_NAME "selenium-router"
18 changes: 17 additions & 1 deletion Router/start-selenium-grid-router.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,28 @@ fi

EXTRA_LIBS=""

if [ ! -z "$SE_ENABLE_TRACING" ]; then
if [ "$SE_ENABLE_TRACING" = "true" ]; then
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
echo "Tracing is enabled"
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
fi
if [ -n "$SE_OTEL_TRACES_EXPORTER" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.traces.exporter=${SE_OTEL_TRACES_EXPORTER}"
fi
if [ -n "$SE_OTEL_EXPORTER_ENDPOINT" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.exporter.${SE_OTEL_TRACES_EXPORTER,,}.endpoint=${SE_OTEL_EXPORTER_ENDPOINT}"
fi
if [ -n "$SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.java.global-autoconfigure.enabled=${SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED}"
fi
if [ -n "$SE_OTEL_JVM_ARGS" ]; then
echo "List arguments for OpenTelemetry: ${SE_OTEL_JVM_ARGS}"
SE_JAVA_OPTS="$SE_JAVA_OPTS ${SE_OTEL_JVM_ARGS}"
fi
else
echo "Tracing is disabled"
fi
Expand Down
2 changes: 2 additions & 0 deletions SessionQueue/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ COPY --chown="${SEL_UID}:${SEL_GID}" start-selenium-grid-session-queue.sh \
/opt/bin/

COPY selenium-grid-session-queue.conf /etc/supervisor/conf.d/

ENV SE_OTEL_SERVICE_NAME "selenium-session-queue"
18 changes: 17 additions & 1 deletion SessionQueue/start-selenium-grid-session-queue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,28 @@ fi

EXTRA_LIBS=""

if [ ! -z "$SE_ENABLE_TRACING" ]; then
if [ "$SE_ENABLE_TRACING" = "true" ]; then
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
echo "Tracing is enabled"
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
fi
if [ -n "$SE_OTEL_TRACES_EXPORTER" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.traces.exporter=${SE_OTEL_TRACES_EXPORTER}"
fi
if [ -n "$SE_OTEL_EXPORTER_ENDPOINT" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.exporter.${SE_OTEL_TRACES_EXPORTER,,}.endpoint=${SE_OTEL_EXPORTER_ENDPOINT}"
fi
if [ -n "$SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.java.global-autoconfigure.enabled=${SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED}"
fi
if [ -n "$SE_OTEL_JVM_ARGS" ]; then
echo "List arguments for OpenTelemetry: ${SE_OTEL_JVM_ARGS}"
SE_JAVA_OPTS="$SE_JAVA_OPTS ${SE_OTEL_JVM_ARGS}"
fi
else
echo "Tracing is disabled"
fi
Expand Down
2 changes: 2 additions & 0 deletions Sessions/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ COPY --chown="${SEL_UID}:${SEL_GID}" start-selenium-grid-sessions.sh \
/opt/bin/

COPY selenium-grid-sessions.conf /etc/supervisor/conf.d/

ENV SE_OTEL_SERVICE_NAME "selenium-session-map"
18 changes: 17 additions & 1 deletion Sessions/start-selenium-grid-sessions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,28 @@ fi

EXTRA_LIBS=""

if [ ! -z "$SE_ENABLE_TRACING" ]; then
if [ "$SE_ENABLE_TRACING" = "true" ]; then
EXTERNAL_JARS=$(</external_jars/.classpath.txt)
[ -n "$EXTRA_LIBS" ] && [ -n "${EXTERNAL_JARS}" ] && EXTRA_LIBS=${EXTRA_LIBS}:
EXTRA_LIBS="--ext "${EXTRA_LIBS}${EXTERNAL_JARS}
echo "Tracing is enabled"
echo "Classpath will be enriched with these external jars : " ${EXTRA_LIBS}
if [ -n "$SE_OTEL_SERVICE_NAME" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.resource.attributes=service.name=${SE_OTEL_SERVICE_NAME}"
fi
if [ -n "$SE_OTEL_TRACES_EXPORTER" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.traces.exporter=${SE_OTEL_TRACES_EXPORTER}"
fi
if [ -n "$SE_OTEL_EXPORTER_ENDPOINT" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.exporter.${SE_OTEL_TRACES_EXPORTER,,}.endpoint=${SE_OTEL_EXPORTER_ENDPOINT}"
fi
if [ -n "$SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED" ]; then
SE_OTEL_JVM_ARGS="$SE_OTEL_JVM_ARGS -Dotel.java.global-autoconfigure.enabled=${SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED}"
fi
if [ -n "$SE_OTEL_JVM_ARGS" ]; then
echo "List arguments for OpenTelemetry: ${SE_OTEL_JVM_ARGS}"
SE_JAVA_OPTS="$SE_JAVA_OPTS ${SE_OTEL_JVM_ARGS}"
fi
else
echo "Tracing is disabled"
fi
Expand Down
2 changes: 1 addition & 1 deletion Standalone/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ ENV SE_RELAX_CHECKS true

EXPOSE 4444


ENV SE_OTEL_SERVICE_NAME "selenium-standalone"
Loading
Loading