@@ -294,17 +294,9 @@ function run_docker_compose() {
294294
295295 local disable_otel_config=" $( plugin_read_config DISABLE_HOST_OTEL_TRACING " false" ) "
296296
297- # If we have BUILDKITE_TRACING_TRACEPARENT but not TRACEPARENT, set it
298- # This allows containers to link their spans to the Buildkite trace
299- if [[ -n " ${BUILDKITE_TRACING_TRACEPARENT:- } " ]] && [[ -z " ${TRACEPARENT:- } " ]]; then
300- export TRACEPARENT=" $BUILDKITE_TRACING_TRACEPARENT "
301- fi
302-
303297 if [[ " $disable_otel_config " == " true" ]]; then
304- echo " ~~~ :no_entry_sign: Disabling docker-compose OTEL traces"
305-
306- # Disable OTEL for docker-compose process by unsetting all OTEL variables
307- # Run in subshell so original environment is preserved for containers
298+ # Disable docker-compose OTEL tracing by clearing environment variables
299+ # Note: Containers will still receive OTEL vars via the 'environment' plugin config
308300 (
309301 unset TRACEPARENT
310302 unset TRACESTATE
@@ -316,20 +308,14 @@ function run_docker_compose() {
316308 plugin_prompt_and_run " ${command[@]} " " $@ "
317309 )
318310 else
319- # Docker Compose auto-detects OTEL from environment variables
320- # The key requirement: OTEL_EXPORTER_OTLP_ENDPOINT must be set
321- echo " ~~~ :chart_with_upwards_trend: Docker Compose OTEL tracing enabled"
311+ # Enable docker-compose OTEL tracing
312+ # Docker Compose will create spans under service name "compose" (separate from agent traces)
322313
323- # Verify OTEL variables are present (required for Docker Compose to create spans)
324- if [[ -z " ${OTEL_EXPORTER_OTLP_ENDPOINT:- } " ]]; then
325- echo " ⚠️ WARNING: OTEL_EXPORTER_OTLP_ENDPOINT not set - Docker Compose won't create spans"
326- echo " ⚠️ This requires Buildkite agent v3.107.2+ with propagate-agent-config-vars experiment"
314+ # Set TRACEPARENT from Buildkite if available (for container span linking)
315+ if [[ -n " ${BUILDKITE_TRACING_TRACEPARENT:- } " ]] && [[ -z " ${TRACEPARENT:- } " ]]; then
316+ export TRACEPARENT=" $BUILDKITE_TRACING_TRACEPARENT "
327317 fi
328318
329- echo " TRACEPARENT: ${TRACEPARENT:- NOT SET} "
330- echo " OTEL_EXPORTER_OTLP_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT:- NOT SET} "
331- echo " OTEL_SERVICE_NAME: ${OTEL_SERVICE_NAME:- NOT SET} "
332-
333319 plugin_prompt_and_run " ${command[@]} " " $@ "
334320 fi
335321}
0 commit comments