From b49b13b4a6563b9ada7af51d2553b44867872bc4 Mon Sep 17 00:00:00 2001 From: Viet Nguyen Duc Date: Sat, 10 Aug 2024 21:55:59 +0700 Subject: [PATCH] update: Tracing is enabled by default (#2347) Signed-off-by: Viet Nguyen Duc --- Base/Dockerfile | 4 +++ .../start-selenium-grid-distributor.sh | 7 +++++ EventBus/start-selenium-grid-eventbus.sh | 7 +++++ Hub/start-selenium-grid-hub.sh | 7 +++++ NodeBase/start-selenium-node.sh | 7 +++++ NodeDocker/start-selenium-grid-docker.sh | 7 +++++ Router/start-selenium-grid-router.sh | 7 +++++ .../start-selenium-grid-session-queue.sh | 7 +++++ Sessions/start-selenium-grid-sessions.sh | 7 +++++ Standalone/start-selenium-standalone.sh | 7 +++++ .../start-selenium-grid-docker.sh | 7 +++++ charts/selenium-grid/README.md | 31 ++++++++++--------- .../templates/logging-configmap.yaml | 5 +-- charts/selenium-grid/values.yaml | 2 ++ tests/charts/make/chart_test.sh | 1 + 15 files changed, 97 insertions(+), 16 deletions(-) diff --git a/Base/Dockerfile b/Base/Dockerfile index da0d44789..b2c018ca7 100644 --- a/Base/Dockerfile +++ b/Base/Dockerfile @@ -159,6 +159,10 @@ ENV SE_BIND_HOST=false \ SE_OTEL_JAVA_GLOBAL_AUTOCONFIGURE_ENABLED=true \ SE_OTEL_TRACES_EXPORTER="otlp" \ SE_SUPERVISORD_LOG_LEVEL="info" \ + SE_LOG_LEVEL="INFO" \ + SE_HTTP_LOGS=false \ + SE_STRUCTURED_LOGS=false \ + SE_ENABLE_TRACING=true \ SE_ENABLE_TLS=false \ SE_JAVA_SSL_TRUST_STORE="/opt/selenium/secrets/server.jks" \ SE_JAVA_SSL_TRUST_STORE_PASSWORD="/opt/selenium/secrets/server.pass" \ diff --git a/Distributor/start-selenium-grid-distributor.sh b/Distributor/start-selenium-grid-distributor.sh index 68217e6af..83cdf5406 100755 --- a/Distributor/start-selenium-grid-distributor.sh +++ b/Distributor/start-selenium-grid-distributor.sh @@ -59,6 +59,11 @@ if [ ! -z "$SE_LOG_LEVEL" ]; then SE_OPTS="$SE_OPTS --log-level ${SE_LOG_LEVEL}" fi +if [ ! -z "$SE_HTTP_LOGS" ]; then + echo "Appending Selenium options: --http-logs ${SE_HTTP_LOGS}" + SE_OPTS="$SE_OPTS --http-logs ${SE_HTTP_LOGS}" +fi + if [ ! -z "$SE_STRUCTURED_LOGS" ]; then echo "Appending Selenium options: --structured-logs ${SE_STRUCTURED_LOGS}" SE_OPTS="$SE_OPTS --structured-logs ${SE_STRUCTURED_LOGS}" @@ -136,6 +141,8 @@ if [ "$SE_ENABLE_TRACING" = "true" ]; then SE_JAVA_OPTS="$SE_JAVA_OPTS ${SE_OTEL_JVM_ARGS}" fi else + SE_OPTS="$SE_OPTS --tracing false" + SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.remote.enableTracing=false" echo "Tracing is disabled" fi diff --git a/EventBus/start-selenium-grid-eventbus.sh b/EventBus/start-selenium-grid-eventbus.sh index 9388df534..5742c8ce3 100755 --- a/EventBus/start-selenium-grid-eventbus.sh +++ b/EventBus/start-selenium-grid-eventbus.sh @@ -24,6 +24,11 @@ if [ ! -z "$SE_LOG_LEVEL" ]; then SE_OPTS="$SE_OPTS --log-level ${SE_LOG_LEVEL}" fi +if [ ! -z "$SE_HTTP_LOGS" ]; then + echo "Appending Selenium options: --http-logs ${SE_HTTP_LOGS}" + SE_OPTS="$SE_OPTS --http-logs ${SE_HTTP_LOGS}" +fi + if [ ! -z "$SE_STRUCTURED_LOGS" ]; then echo "Appending Selenium options: --structured-logs ${SE_STRUCTURED_LOGS}" SE_OPTS="$SE_OPTS --structured-logs ${SE_STRUCTURED_LOGS}" @@ -86,6 +91,8 @@ if [ "$SE_ENABLE_TRACING" = "true" ]; then SE_JAVA_OPTS="$SE_JAVA_OPTS ${SE_OTEL_JVM_ARGS}" fi else + SE_OPTS="$SE_OPTS --tracing false" + SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.remote.enableTracing=false" echo "Tracing is disabled" fi diff --git a/Hub/start-selenium-grid-hub.sh b/Hub/start-selenium-grid-hub.sh index cbfeaa093..60cb5086e 100755 --- a/Hub/start-selenium-grid-hub.sh +++ b/Hub/start-selenium-grid-hub.sh @@ -27,6 +27,11 @@ if [ ! -z "$SE_LOG_LEVEL" ]; then SE_OPTS="$SE_OPTS --log-level ${SE_LOG_LEVEL}" fi +if [ ! -z "$SE_HTTP_LOGS" ]; then + echo "Appending Selenium options: --http-logs ${SE_HTTP_LOGS}" + SE_OPTS="$SE_OPTS --http-logs ${SE_HTTP_LOGS}" +fi + if [ ! -z "$SE_STRUCTURED_LOGS" ]; then echo "Appending Selenium options: --structured-logs ${SE_STRUCTURED_LOGS}" SE_OPTS="$SE_OPTS --structured-logs ${SE_STRUCTURED_LOGS}" @@ -119,6 +124,8 @@ if [ "$SE_ENABLE_TRACING" = "true" ]; then SE_JAVA_OPTS="$SE_JAVA_OPTS ${SE_OTEL_JVM_ARGS}" fi else + SE_OPTS="$SE_OPTS --tracing false" + SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.remote.enableTracing=false" echo "Tracing is disabled" fi diff --git a/NodeBase/start-selenium-node.sh b/NodeBase/start-selenium-node.sh index 0dc48cf5e..f9d6f6a68 100755 --- a/NodeBase/start-selenium-node.sh +++ b/NodeBase/start-selenium-node.sh @@ -66,6 +66,11 @@ if [ ! -z "$SE_LOG_LEVEL" ]; then SE_OPTS="$SE_OPTS --log-level ${SE_LOG_LEVEL}" fi +if [ ! -z "$SE_HTTP_LOGS" ]; then + echo "Appending Selenium options: --http-logs ${SE_HTTP_LOGS}" + SE_OPTS="$SE_OPTS --http-logs ${SE_HTTP_LOGS}" +fi + if [ ! -z "$SE_STRUCTURED_LOGS" ]; then echo "Appending Selenium options: --structured-logs ${SE_STRUCTURED_LOGS}" SE_OPTS="$SE_OPTS --structured-logs ${SE_STRUCTURED_LOGS}" @@ -139,6 +144,8 @@ if [ "$SE_ENABLE_TRACING" = "true" ]; then SE_JAVA_OPTS="$SE_JAVA_OPTS ${SE_OTEL_JVM_ARGS}" fi else + SE_OPTS="$SE_OPTS --tracing false" + SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.remote.enableTracing=false" echo "Tracing is disabled" fi diff --git a/NodeDocker/start-selenium-grid-docker.sh b/NodeDocker/start-selenium-grid-docker.sh index ac03474a0..4b39ecd32 100755 --- a/NodeDocker/start-selenium-grid-docker.sh +++ b/NodeDocker/start-selenium-grid-docker.sh @@ -34,6 +34,11 @@ if [ ! -z "$SE_LOG_LEVEL" ]; then SE_OPTS="$SE_OPTS --log-level ${SE_LOG_LEVEL}" fi +if [ ! -z "$SE_HTTP_LOGS" ]; then + echo "Appending Selenium options: --http-logs ${SE_HTTP_LOGS}" + SE_OPTS="$SE_OPTS --http-logs ${SE_HTTP_LOGS}" +fi + if [ ! -z "$SE_STRUCTURED_LOGS" ]; then echo "Appending Selenium options: --structured-logs ${SE_STRUCTURED_LOGS}" SE_OPTS="$SE_OPTS --structured-logs ${SE_STRUCTURED_LOGS}" @@ -96,6 +101,8 @@ if [ "$SE_ENABLE_TRACING" = "true" ]; then SE_JAVA_OPTS="$SE_JAVA_OPTS ${SE_OTEL_JVM_ARGS}" fi else + SE_OPTS="$SE_OPTS --tracing false" + SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.remote.enableTracing=false" echo "Tracing is disabled" fi diff --git a/Router/start-selenium-grid-router.sh b/Router/start-selenium-grid-router.sh index d598f33c2..c7e5e5ca2 100755 --- a/Router/start-selenium-grid-router.sh +++ b/Router/start-selenium-grid-router.sh @@ -59,6 +59,11 @@ if [ ! -z "$SE_LOG_LEVEL" ]; then SE_OPTS="$SE_OPTS --log-level ${SE_LOG_LEVEL}" fi +if [ ! -z "$SE_HTTP_LOGS" ]; then + echo "Appending Selenium options: --http-logs ${SE_HTTP_LOGS}" + SE_OPTS="$SE_OPTS --http-logs ${SE_HTTP_LOGS}" +fi + if [ ! -z "$SE_STRUCTURED_LOGS" ]; then echo "Appending Selenium options: --structured-logs ${SE_STRUCTURED_LOGS}" SE_OPTS="$SE_OPTS --structured-logs ${SE_STRUCTURED_LOGS}" @@ -141,6 +146,8 @@ if [ "$SE_ENABLE_TRACING" = "true" ]; then SE_JAVA_OPTS="$SE_JAVA_OPTS ${SE_OTEL_JVM_ARGS}" fi else + SE_OPTS="$SE_OPTS --tracing false" + SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.remote.enableTracing=false" echo "Tracing is disabled" fi diff --git a/SessionQueue/start-selenium-grid-session-queue.sh b/SessionQueue/start-selenium-grid-session-queue.sh index 605c93276..e96d75ca3 100755 --- a/SessionQueue/start-selenium-grid-session-queue.sh +++ b/SessionQueue/start-selenium-grid-session-queue.sh @@ -24,6 +24,11 @@ if [ ! -z "$SE_LOG_LEVEL" ]; then SE_OPTS="$SE_OPTS --log-level ${SE_LOG_LEVEL}" fi +if [ ! -z "$SE_HTTP_LOGS" ]; then + echo "Appending Selenium options: --http-logs ${SE_HTTP_LOGS}" + SE_OPTS="$SE_OPTS --http-logs ${SE_HTTP_LOGS}" +fi + if [ ! -z "$SE_STRUCTURED_LOGS" ]; then echo "Appending Selenium options: --structured-logs ${SE_STRUCTURED_LOGS}" SE_OPTS="$SE_OPTS --structured-logs ${SE_STRUCTURED_LOGS}" @@ -91,6 +96,8 @@ if [ "$SE_ENABLE_TRACING" = "true" ]; then SE_JAVA_OPTS="$SE_JAVA_OPTS ${SE_OTEL_JVM_ARGS}" fi else + SE_OPTS="$SE_OPTS --tracing false" + SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.remote.enableTracing=false" echo "Tracing is disabled" fi diff --git a/Sessions/start-selenium-grid-sessions.sh b/Sessions/start-selenium-grid-sessions.sh index 80f02d682..142168cc4 100755 --- a/Sessions/start-selenium-grid-sessions.sh +++ b/Sessions/start-selenium-grid-sessions.sh @@ -39,6 +39,11 @@ if [ ! -z "$SE_LOG_LEVEL" ]; then SE_OPTS="$SE_OPTS --log-level ${SE_LOG_LEVEL}" fi +if [ ! -z "$SE_HTTP_LOGS" ]; then + echo "Appending Selenium options: --http-logs ${SE_HTTP_LOGS}" + SE_OPTS="$SE_OPTS --http-logs ${SE_HTTP_LOGS}" +fi + if [ ! -z "$SE_STRUCTURED_LOGS" ]; then echo "Appending Selenium options: --structured-logs ${SE_STRUCTURED_LOGS}" SE_OPTS="$SE_OPTS --structured-logs ${SE_STRUCTURED_LOGS}" @@ -106,6 +111,8 @@ if [ "$SE_ENABLE_TRACING" = "true" ]; then SE_JAVA_OPTS="$SE_JAVA_OPTS ${SE_OTEL_JVM_ARGS}" fi else + SE_OPTS="$SE_OPTS --tracing false" + SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.remote.enableTracing=false" echo "Tracing is disabled" fi diff --git a/Standalone/start-selenium-standalone.sh b/Standalone/start-selenium-standalone.sh index b28b488ed..8514453cf 100755 --- a/Standalone/start-selenium-standalone.sh +++ b/Standalone/start-selenium-standalone.sh @@ -66,6 +66,11 @@ if [ ! -z "$SE_LOG_LEVEL" ]; then SE_OPTS="$SE_OPTS --log-level ${SE_LOG_LEVEL}" fi +if [ ! -z "$SE_HTTP_LOGS" ]; then + echo "Appending Selenium options: --http-logs ${SE_HTTP_LOGS}" + SE_OPTS="$SE_OPTS --http-logs ${SE_HTTP_LOGS}" +fi + if [ ! -z "$SE_STRUCTURED_LOGS" ]; then echo "Appending Selenium options: --structured-logs ${SE_STRUCTURED_LOGS}" SE_OPTS="$SE_OPTS --structured-logs ${SE_STRUCTURED_LOGS}" @@ -145,6 +150,8 @@ if [ "$SE_ENABLE_TRACING" = "true" ]; then SE_JAVA_OPTS="$SE_JAVA_OPTS ${SE_OTEL_JVM_ARGS}" fi else + SE_OPTS="$SE_OPTS --tracing false" + SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.remote.enableTracing=false" echo "Tracing is disabled" fi diff --git a/StandaloneDocker/start-selenium-grid-docker.sh b/StandaloneDocker/start-selenium-grid-docker.sh index 1dcd47055..573afb664 100755 --- a/StandaloneDocker/start-selenium-grid-docker.sh +++ b/StandaloneDocker/start-selenium-grid-docker.sh @@ -44,6 +44,11 @@ if [ ! -z "$SE_LOG_LEVEL" ]; then SE_OPTS="$SE_OPTS --log-level ${SE_LOG_LEVEL}" fi +if [ ! -z "$SE_HTTP_LOGS" ]; then + echo "Appending Selenium options: --http-logs ${SE_HTTP_LOGS}" + SE_OPTS="$SE_OPTS --http-logs ${SE_HTTP_LOGS}" +fi + if [ ! -z "$SE_STRUCTURED_LOGS" ]; then echo "Appending Selenium options: --structured-logs ${SE_STRUCTURED_LOGS}" SE_OPTS="$SE_OPTS --structured-logs ${SE_STRUCTURED_LOGS}" @@ -106,6 +111,8 @@ if [ "$SE_ENABLE_TRACING" = "true" ]; then SE_JAVA_OPTS="$SE_JAVA_OPTS ${SE_OTEL_JVM_ARGS}" fi else + SE_OPTS="$SE_OPTS --tracing false" + SE_JAVA_OPTS="$SE_JAVA_OPTS -Dwebdriver.remote.enableTracing=false" echo "Tracing is disabled" fi diff --git a/charts/selenium-grid/README.md b/charts/selenium-grid/README.md index 728de6972..cbdf3dfc1 100644 --- a/charts/selenium-grid/README.md +++ b/charts/selenium-grid/README.md @@ -313,20 +313,23 @@ Refer to below section [Configuration of Secure Communication] for more details ### Configuration global For now, global configuration supported is: -| Parameter | Default | Description | -|-----------------------------------------------------|-------------------------|---------------------------------------------| -| `global.K8S_PUBLIC_IP` | `""` | Public IP of the host running K8s | -| `global.seleniumGrid.imageRegistry` | `selenium` | Distribution registry to pull images | -| `global.seleniumGrid.imageTag` | `4.23.0-20240727` | Image tag for all selenium components | -| `global.seleniumGrid.nodesImageTag` | `4.23.0-20240727` | Image tag for browser's nodes | -| `global.seleniumGrid.videoImageTag` | `ffmpeg-7.0.1-20240727` | Image tag for browser's video recorder | -| `global.seleniumGrid.imagePullSecret` | `""` | Pull secret to be used for all images | -| `global.seleniumGrid.affinity` | `{}` | Affinity assigned globally | -| `global.seleniumGrid.logLevel` | `INFO` | Set log level for all components | -| `global.seleniumGrid.defaultNodeStartupProbe` | `exec` | Default startup probe method in Nodes | -| `global.seleniumGrid.defaultNodeLivenessProbe` | `exec` | Default liveness probe method in Nodes | -| `global.seleniumGrid.defaultComponentLivenessProbe` | `exec` | Default liveness probe method in Components | -| `global.seleniumGrid.stdoutProbeLog` | `true` | Enable probe logs output in kubectl logs | +| Parameter | Default | Description | +|-----------------------------------------------------|-------------------------|---------------------------------------------------------------------| +| `global.K8S_PUBLIC_IP` | `""` | Public IP of the host running K8s | +| `global.seleniumGrid.imageRegistry` | `selenium` | Distribution registry to pull images | +| `global.seleniumGrid.imageTag` | `4.23.0-20240727` | Image tag for all selenium components | +| `global.seleniumGrid.nodesImageTag` | `4.23.0-20240727` | Image tag for browser's nodes | +| `global.seleniumGrid.videoImageTag` | `ffmpeg-7.0.1-20240727` | Image tag for browser's video recorder | +| `global.seleniumGrid.imagePullSecret` | `""` | Pull secret to be used for all images | +| `global.seleniumGrid.affinity` | `{}` | Affinity assigned globally | +| `global.seleniumGrid.logLevel` | `INFO` | Set log level for all components | +| `global.seleniumGrid.structuredLogs` | `false` | Use structured logs | +| `global.seleniumGrid.httpLogs` | `false` | Enable http logging. Tracing should be enabled together | +| `global.seleniumGrid.defaultNodeStartupProbe` | `exec` | Default startup probe method in Nodes | +| `global.seleniumGrid.defaultNodeLivenessProbe` | `exec` | Default liveness probe method in Nodes | +| `global.seleniumGrid.defaultComponentLivenessProbe` | `exec` | Default liveness probe method in Components | +| `global.seleniumGrid.stdoutProbeLog` | `true` | Enable probe logs output in kubectl logs | +| `global.seleniumGrid.revisionHistoryLimit` | `10` | Specify how many old ReplicaSets for this Deployment to be retained | #### Configuration `global.K8S_PUBLIC_IP` diff --git a/charts/selenium-grid/templates/logging-configmap.yaml b/charts/selenium-grid/templates/logging-configmap.yaml index 47dc54c7f..72afb6e8c 100644 --- a/charts/selenium-grid/templates/logging-configmap.yaml +++ b/charts/selenium-grid/templates/logging-configmap.yaml @@ -12,8 +12,9 @@ metadata: {{- toYaml . | nindent 4 }} {{- end }} data: - SE_LOG_LEVEL: "{{ default "INFO" .Values.global.seleniumGrid.logLevel }}" - SE_STRUCTURED_LOGS: "{{ default false .Values.global.seleniumGrid.structuredLogs }}" + SE_LOG_LEVEL: {{ default "INFO" .Values.global.seleniumGrid.logLevel | quote }} + SE_STRUCTURED_LOGS: {{ default false .Values.global.seleniumGrid.structuredLogs | quote }} + SE_HTTP_LOGS: {{ default false .Values.global.seleniumGrid.httpLogs | quote }} {{- if (eq (include "seleniumGrid.enableTracing" .) "true") }} SE_ENABLE_TRACING: "true" SE_OTEL_TRACES_EXPORTER: {{ .Values.tracing.exporter | quote }} diff --git a/charts/selenium-grid/values.yaml b/charts/selenium-grid/values.yaml index fe6ad6cdc..02f57beca 100644 --- a/charts/selenium-grid/values.yaml +++ b/charts/selenium-grid/values.yaml @@ -31,6 +31,8 @@ global: revisionHistoryLimit: 10 # Whether to enable structured logging structuredLogs: false + # Enable http logging. Tracing should be enabled to log http logs. + httpLogs: false tls: # Name of external secret containing the TLS certificate and key diff --git a/tests/charts/make/chart_test.sh b/tests/charts/make/chart_test.sh index 93128e7c4..fdaa54a4b 100755 --- a/tests/charts/make/chart_test.sh +++ b/tests/charts/make/chart_test.sh @@ -111,6 +111,7 @@ HELM_COMMAND_SET_IMAGES=" \ --set global.seleniumGrid.videoImageTag=${VIDEO_TAG} \ --set autoscaling.scaledOptions.pollingInterval=${AUTOSCALING_POLL_INTERVAL} \ --set tracing.enabled=${CHART_ENABLE_TRACING} \ +--set global.seleniumGrid.httpLogs=${CHART_ENABLE_TRACING} \ --set isolateComponents=${CHART_FULL_DISTRIBUTED_MODE} \ --set global.seleniumGrid.logLevel=${LOG_LEVEL} \ "