Skip to content

Commit 4d45d6e

Browse files
committed
Clean up
1 parent 5201dce commit 4d45d6e

3 files changed

Lines changed: 7 additions & 31 deletions

File tree

hooks/command

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
#!/bin/bash
22
set -ueo pipefail
33

4-
echo "DEBUG [command]: TRACEPARENT at hook start: ${TRACEPARENT:-NOT SET}"
5-
echo "DEBUG [command]: BUILDKITE_TRACING_BACKEND: ${BUILDKITE_TRACING_BACKEND:-NOT SET}"
6-
echo "DEBUG [command]: BUILDKITE_TRACE_CONTEXT: ${BUILDKITE_TRACE_CONTEXT:-NOT SET}"
7-
echo "DEBUG [command]: All OTEL/TRACE/BUILDKITE_TRACING vars:"
8-
env | grep -E "(OTEL|TRACE|BUILDKITE_TRACING)" || echo " (none)"
9-
104
DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
115

126
# shellcheck source=lib/shared.bash

hooks/pre-command

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#!/bin/bash
22
set -ueo pipefail
33

4-
echo "DEBUG [pre-command]: TRACEPARENT at hook start: ${TRACEPARENT:-NOT SET}"
5-
echo "DEBUG [pre-command]: OTEL vars at hook start:"
6-
env | grep -E "(OTEL|TRACE)" || echo " (none)"
7-
84
DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
95

106
# shellcheck source=lib/shared.bash

lib/shared.bash

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)