This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-06-27
Channels
- # babashka (39)
- # beginners (256)
- # calva (33)
- # cider (4)
- # clj-otel (8)
- # clojure (48)
- # clojure-denmark (3)
- # clojure-europe (21)
- # clojure-nl (1)
- # clojure-norway (45)
- # clojure-poland (1)
- # clojure-sweden (2)
- # clojure-uk (5)
- # clojuredesign-podcast (5)
- # clr (13)
- # core-async (9)
- # cursive (12)
- # data-science (2)
- # datahike (80)
- # datomic (5)
- # hyperfiddle (14)
- # introduce-yourself (4)
- # jobs (4)
- # lsp (7)
- # missionary (6)
- # polylith (25)
- # proletarian (5)
- # releases (1)
- # shadow-cljs (12)
- # squint (7)
- # xtdb (2)
Hi all. We are trying to understand the use case between using a bound context and a regular context. From what we are seeing:
• with-span!
and async-span!
both set the current span of the underlying OTEL library.
• with-bound-span!
and async-bound-span!
both set the dynamic variable.
I'm seeing lots of references to async with the bound context as reasons to use it. What are some use cases for using the bound context over the regular context? Why would we use one over the other?
As mentioned in https://cljdoc.org/d/com.github.steffan-westcott/clj-otel-api/0.2.6/doc/concepts#_instrumenting_asynchronous_clojure_code, you may choose to work with either bound or explicit context values when writing async Clojure code. Bound context is more convenient, as it is the default for many clj-otel
functions. Explicit context is more cumbersome, as it requires passing in as a parameter to those same functions.
Earlier releases of clj-otel
did not have the concept of bound context. Several users suggested they would prefer explicit context to be managed as a dynamic var instead. Prompted by this feedback, the bound context concept was added to clj-otel
as an opt-in feature.
If you are writing purely synchronous Clojure code, you should use only https://cljdoc.org/d/com.github.steffan-westcott/clj-otel-api/0.2.6/doc/concepts#_current_context.
Thank you. That helps. For the with-bound-span!
macro, the body is meant to provide a synchronous result. For that case, is it for cases where the body returns synchronously, but has async behavior in the call? The async-bound-span!
makes a lot of sense with those references. I apologize if these are getting more into the nature of async behavior in Clojure, which I'm not as familiar with.