Skip to content

--tp-ignore-env sends zeros rather than removing the parent_id #23

Closed

Description

@mterhar

When I tried to use this argument with a traceparent set, overwrite the parent span ID with zeros but it sent them as a string somehow.

Image

Script in question:

    END_TIME=$(date +%s.%N)
 
    otel-cli span \
        --name "cron-deploy" \
        --start "$START_TIME" \
        --end "$END_TIME" \
        --force-trace-id "$OTEL_CLI_FORCE_TRACE_ID" \
        --force-span-id "$ROOT_SPAN_ID" \
        --tp-ignore-env \
        --attrs "script=run-update.sh,status=$FINAL_STATUS,script_used=$SCRIPT_USED"

I fixed it by just removing the traceparent header all the way.

    END_TIME=$(date +%s.%N)
    unset TRACEPARENT
    otel-cli span \
        --name "cron-deploy" \
        --start "$START_TIME" \
        --end "$END_TIME" \
        --force-trace-id "$OTEL_CLI_FORCE_TRACE_ID" \
        --force-span-id "$ROOT_SPAN_ID" \
        --attrs "script=run-update.sh,status=$FINAL_STATUS,script_used=$SCRIPT_USED"

Activity

  1. tobert commented on Feb 9, 2026

    @tobert
    Owner

    Fix is up in PR #25. The root cause: LoadTraceparent() with --tp-ignore-env returns a traceparent with Initialized=true but zeroed SpanId. The code unconditionally set ParentSpanId = tp.SpanId, producing a span with an all-zeros parent. Now guarded with bytes.Equal(tp.SpanId, GetEmptySpanId()). -Claude and @tobert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions