This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-25
Channels
- # announcements (9)
- # asami (69)
- # babashka (151)
- # babashka-sci-dev (34)
- # beginners (90)
- # cider (21)
- # clj-on-windows (17)
- # clj-otel (4)
- # cljsrn (5)
- # clojure (27)
- # clojure-austin (3)
- # clojure-europe (87)
- # clojure-gamedev (1)
- # clojure-nl (3)
- # clojure-norway (8)
- # clojure-poland (2)
- # clojure-uk (3)
- # clojured (10)
- # clojurescript (50)
- # core-async (73)
- # cursive (28)
- # data-science (2)
- # datomic (17)
- # etaoin (1)
- # honeysql (6)
- # introduce-yourself (3)
- # jobs (1)
- # joyride (12)
- # malli (5)
- # nbb (14)
- # off-topic (18)
- # pathom (4)
- # podcasts-discuss (2)
- # polylith (30)
- # project-updates (3)
- # re-frame (33)
- # reitit (1)
- # remote-jobs (13)
- # shadow-cljs (59)
- # sql (12)
- # tools-build (7)
- # xtdb (36)
Does anyone have any tricks for propagating the otel contexts in ways similar to clojure dynamic bindings? (e.g. through futures
and things)
For example, if a span is initialized in a future
, I'd like it to inherit the trace ID from the current context where the future
was initialized.
When designing clj-otel
, I considered using dynamic bindings. However, I followed the https://stuartsierra.com/2013/03/29/perils-of-dynamic-scope and decided instead to make context
explicit throughout. I strongly advise against it, but if you really feel you need dynamic bindings, then take a look at https://clojuredocs.org/clojure.core/bound-fn and https://clojuredocs.org/clojure.core/bound-fn* in the standard Clojure library.
In fact, by explicitly passing in context
as a parameter to your future
function, there is no need for bound-fn
nor bound-fn*
. Use https://cljdoc.org/d/com.github.steffan-westcott/clj-otel-api/CURRENT/api/steffan-westcott.clj-otel.context#current to get the current context.