From ae304e33eb2057e1ffd87cd0d950e889d029caad Mon Sep 17 00:00:00 2001 From: Michael Sarahan Date: Fri, 4 Oct 2024 17:09:04 -0500 Subject: [PATCH] debugging traceparent --- tools/rapids-otel-wrap | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tools/rapids-otel-wrap b/tools/rapids-otel-wrap index b28edb0..565adb4 100755 --- a/tools/rapids-otel-wrap +++ b/tools/rapids-otel-wrap @@ -68,18 +68,16 @@ while IFS= read -r line; do done < "$tmpdir/pipe" RETURN_STATUS=$(<"$tmpdir/status_pipe") -# Trim leading commas from RAPIDS_OTEL_ATTRS from clumsy concatentation -RAPIDS_OTEL_ATTRS="${RAPIDS_OTEL_ATTRS/^,//}" - type otel-cli >/dev/null 2>&1 && { - if [ -n "${RAPIDS_OTEL_ATTRS}" ]; then \ - attrs="--attrs ${RAPIDS_OTEL_ATTRS}"; \ + if [ "${RAPIDS_OTEL_ATTRS}" != "" ]; then \ + attrs="--attrs $(sed "s/,//" <<< ${RAPIDS_OTEL_ATTRS})"; \ fi - if [ -n "OTEL_EXPORTER_OTLP_HEADERS" ]; then \ + if [ "${OTEL_EXPORTER_OTLP_HEADERS}" != "" ]; then \ headers="--otlp-headers ${OTEL_EXPORTER_OTLP_HEADERS}"; \ fi # TRACEPARENT gets picked up as an env var automatically # https://github.com/equinix-labs/otel-cli?tab=readme-ov-file#examples + set -x otel-cli span -n "$1" -s "${RAPIDS_SERVICE_NAME}" \ --endpoint "${OTEL_EXPORTER_OTLP_TRACES_ENDPOINT}" \ --start "$start" --end "$(date ${TIME_FORMAT})" \ @@ -90,6 +88,7 @@ type otel-cli >/dev/null 2>&1 && { --tls-client-key ${OTEL_EXPORTER_OTLP_CLIENT_KEY} \ --tp-print \ ${attrs} ${headers} + set +x } cleanup "$@" exit "${RETURN_STATUS}"