clj-otel

ghaskins 2025-01-17T13:32:18.546659Z

Hi, is there a normalized way to get the traceid from the current context? I know I can get the headers, but they vary with the propagator.

ghaskins 2025-01-17T13:54:08.404479Z

Nm, I think I figured it out. It looks like this will work

(require '[steffan-westcott.clj-otel.api.trace.span :as span])
=> nil
(span/get-span-context)
=>
#object[io.opentelemetry.api.internal.AutoValue_ImmutableSpanContext
        0x5f7d51ea
        "ImmutableSpanContext{traceId=00000000000000000000000000000000, spanId=0000000000000000, traceFlags=00, traceState=ArrayBasedTraceState{entries=[]}, remote=false, valid=false}"]
(.getTraceId (span/get-span-context))
=> "00000000000000000000000000000000"

👍🏼 1