Fork me on GitHub

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 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 and* 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 to get the current context.


I see, that helps. Thank you!