This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-05
Channels
- # adventofcode (89)
- # announcements (9)
- # babashka (11)
- # beginners (8)
- # biff (5)
- # calva (4)
- # cherry (121)
- # clara (15)
- # clerk (16)
- # clj-kondo (20)
- # clj-otel (2)
- # cljdoc (20)
- # clojure (84)
- # clojure-austin (1)
- # clojure-bay-area (3)
- # clojure-berlin (1)
- # clojure-czech (2)
- # clojure-europe (59)
- # clojure-nl (1)
- # clojure-norway (12)
- # clojure-poland (1)
- # clojure-uk (15)
- # cursive (16)
- # datomic (46)
- # events (3)
- # fulcro (85)
- # graalvm (20)
- # hyperfiddle (11)
- # improve-getting-started (1)
- # lsp (7)
- # off-topic (48)
- # overtone (8)
- # podcasts-discuss (4)
- # re-frame (31)
- # releases (1)
- # ring (12)
- # sci (13)
- # shadow-cljs (8)
- # specter (3)
- # squint (26)
- # xtdb (5)
- # yamlscript (6)
@steffan I am trying to set up a valid trace context (in a unit test for a custom trace propagation via our task queue). I started with (span/with-span! {:name ,,,} ,,,)
, but that was not enough. The W3CTraceContextPropagator
would not propagate the span, presumably because (= false (.isValid (span/get-span-context)))
. I had to add a hand-crafted span context until "span is valid" showed "true" and the W3CTraceContextPropagator
would do anything:
(context/with-value! (Span/wrap (SpanContext/create "1234567890abcdef1234567890abcdef"
"1234567890abcdef"
(TraceFlags/getDefault)
(TraceState/getDefault)))
(span/with-span! {:name "TEST"}
(println "SPAN IS VALID" (.isValid (span/get-span-context)))
,,,))
Is this expected? I assume I am somehow outside of clj-otel's "safe zone"? Is there a better / correct way to do this with clj-otel built-in functions?with-span!
and similar create a new context containing the span. Running the following with the OpenTelemetry agent with default propagators (which include the W3C Trace Context propagator) shows the headers to include when propagating the context:
(span/with-span! {:name "Testing"}
(println (context/->headers)))
Gives output like:
{traceparent 00-8ab99ecb31257e6bf05fe2f820c3d228-b403f6b75fabbd5f-01}
Remember that clj-otel-api
will default to a no-op implementation if your test is run without an implementation of the OpenTelemetry API.