Skip to content

Commit aac07be

Browse files
Oleg Demeshevclaude
authored andcommitted
feat: Pass OTEL_* environment variables through to PHP 8.4/8.5 containers
Opt-in producer-side configuration for OpenTelemetry: empty defaults keep telemetry inert until a developer sets the OTEL_* values in their .env file (see .env.dist), pointing at the otel-lgtm collector. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent aa07e74 commit aac07be

2 files changed

Lines changed: 37 additions & 0 deletions

File tree

.env.dist

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,12 @@ REMOTE_SRC=/var/www/totara/src
6363
REMOTE_DATA=/var/www/totara/data
6464
MYSQL_ROOT_PW=root
6565
MSSQL_SA_PW=Totara.Mssql1
66+
67+
# OpenTelemetry export from the PHP 8.4/8.5 containers (opt-in).
68+
# Start the backend with 'tup otel-lgtm' (Grafana UI: http://localhost:3000), then uncomment:
69+
#OTEL_PHP_AUTOLOAD_ENABLED=true
70+
#OTEL_SERVICE_NAME=totara
71+
#OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-lgtm:4318
72+
#OTEL_TRACES_EXPORTER=otlp
73+
#OTEL_LOGS_EXPORTER=otlp
74+
#OTEL_METRICS_EXPORTER=otlp

compose/php.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,13 @@ services:
330330
DISABLE_AUTO_UPDATE: "true" # disables oh-my-zsh update message
331331
USE_ZSH_NERDFONT: ${USE_ZSH_NERDFONT:-0}
332332
XDEBUG_MODE: off
333+
# OpenTelemetry export (opt-in): set the OTEL_* values in your .env file, see .env.dist.
334+
OTEL_PHP_AUTOLOAD_ENABLED: ${OTEL_PHP_AUTOLOAD_ENABLED:-}
335+
OTEL_SERVICE_NAME: ${OTEL_SERVICE_NAME:-}
336+
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-}
337+
OTEL_TRACES_EXPORTER: ${OTEL_TRACES_EXPORTER:-}
338+
OTEL_LOGS_EXPORTER: ${OTEL_LOGS_EXPORTER:-}
339+
OTEL_METRICS_EXPORTER: ${OTEL_METRICS_EXPORTER:-}
333340
volumes:
334341
- ${LOCAL_SRC}:${REMOTE_SRC}
335342
- totara-data:${REMOTE_DATA}
@@ -359,6 +366,13 @@ services:
359366
HIST_FILE: /root/.bash_history
360367
DISABLE_AUTO_UPDATE: "true" # disables oh-my-zsh update message
361368
USE_ZSH_NERDFONT: ${USE_ZSH_NERDFONT:-0}
369+
# OpenTelemetry export (opt-in): set the OTEL_* values in your .env file, see .env.dist.
370+
OTEL_PHP_AUTOLOAD_ENABLED: ${OTEL_PHP_AUTOLOAD_ENABLED:-}
371+
OTEL_SERVICE_NAME: ${OTEL_SERVICE_NAME:-}
372+
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-}
373+
OTEL_TRACES_EXPORTER: ${OTEL_TRACES_EXPORTER:-}
374+
OTEL_LOGS_EXPORTER: ${OTEL_LOGS_EXPORTER:-}
375+
OTEL_METRICS_EXPORTER: ${OTEL_METRICS_EXPORTER:-}
362376
volumes:
363377
- ${LOCAL_SRC}:${REMOTE_SRC}
364378
- totara-data:${REMOTE_DATA}
@@ -382,6 +396,13 @@ services:
382396
DISABLE_AUTO_UPDATE: "true" # disables oh-my-zsh update message
383397
USE_ZSH_NERDFONT: ${USE_ZSH_NERDFONT:-0}
384398
XDEBUG_MODE: off
399+
# OpenTelemetry export (opt-in): set the OTEL_* values in your .env file, see .env.dist.
400+
OTEL_PHP_AUTOLOAD_ENABLED: ${OTEL_PHP_AUTOLOAD_ENABLED:-}
401+
OTEL_SERVICE_NAME: ${OTEL_SERVICE_NAME:-}
402+
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-}
403+
OTEL_TRACES_EXPORTER: ${OTEL_TRACES_EXPORTER:-}
404+
OTEL_LOGS_EXPORTER: ${OTEL_LOGS_EXPORTER:-}
405+
OTEL_METRICS_EXPORTER: ${OTEL_METRICS_EXPORTER:-}
385406
volumes:
386407
- ${LOCAL_SRC}:${REMOTE_SRC}
387408
- totara-data:${REMOTE_DATA}
@@ -411,6 +432,13 @@ services:
411432
HIST_FILE: /root/.bash_history
412433
DISABLE_AUTO_UPDATE: "true" # disables oh-my-zsh update message
413434
USE_ZSH_NERDFONT: ${USE_ZSH_NERDFONT:-0}
435+
# OpenTelemetry export (opt-in): set the OTEL_* values in your .env file, see .env.dist.
436+
OTEL_PHP_AUTOLOAD_ENABLED: ${OTEL_PHP_AUTOLOAD_ENABLED:-}
437+
OTEL_SERVICE_NAME: ${OTEL_SERVICE_NAME:-}
438+
OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:-}
439+
OTEL_TRACES_EXPORTER: ${OTEL_TRACES_EXPORTER:-}
440+
OTEL_LOGS_EXPORTER: ${OTEL_LOGS_EXPORTER:-}
441+
OTEL_METRICS_EXPORTER: ${OTEL_METRICS_EXPORTER:-}
414442
volumes:
415443
- ${LOCAL_SRC}:${REMOTE_SRC}
416444
- totara-data:${REMOTE_DATA}

0 commit comments

Comments
 (0)