File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ function plugin_prompt_and_run() {
2020 local exit_code
2121
2222 plugin_prompt " $@ "
23+
2324 " $@ "
2425 exit_code=$?
2526
@@ -41,11 +42,6 @@ function plugin_read_config() {
4142 echo " ${! var:- $default } "
4243}
4344
44- # Disable OTEL tracing for host-side commands
45- if [[ " $( plugin_read_config DISABLE_HOST_OTEL_TRACING " false" ) " == " true" ]] ; then
46- export OTEL_SDK_DISABLED=true
47- fi
48-
4945# Reads either a value or a list from plugin config
5046function plugin_read_list() {
5147 prefix_read_list " BUILDKITE_PLUGIN_DOCKER_COMPOSE_$1 "
@@ -296,7 +292,25 @@ function run_docker_compose() {
296292
297293 command+=(-p " $( docker_compose_project_name) " )
298294
299- plugin_prompt_and_run " ${command[@]} " " $@ "
295+ local disable_otel_config
296+ disable_otel_config=" $( plugin_read_config DISABLE_HOST_OTEL_TRACING " false" ) "
297+
298+ if [[ " $disable_otel_config " == " true" ]]; then
299+ # Disable docker-compose OTEL tracing by clearing environment variables
300+ # builkite-agent spans will still be created, but this will elminate docker-compose cli/run etc spans
301+ (
302+ unset TRACEPARENT
303+ unset TRACESTATE
304+ unset OTEL_EXPORTER_OTLP_ENDPOINT
305+ unset OTEL_EXPORTER_OTLP_HEADERS
306+ unset OTEL_EXPORTER_OTLP_PROTOCOL
307+ unset OTEL_SERVICE_NAME
308+
309+ plugin_prompt_and_run " ${command[@]} " " $@ "
310+ )
311+ else
312+ plugin_prompt_and_run " ${command[@]} " " $@ "
313+ fi
300314}
301315
302316function in_array() {
You can’t perform that action at this time.
0 commit comments