Skip to content

Commit

Permalink
debugging traceparent
Browse files Browse the repository at this point in the history
  • Loading branch information
msarahan committed Oct 4, 2024
1 parent 16d6729 commit ae304e3
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tools/rapids-otel-wrap
Original file line number Diff line number Diff line change
Expand Up @@ -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})" \
Expand All @@ -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}"

0 comments on commit ae304e3

Please sign in to comment.