Fork me on GitHub
#clj-otel
<
2022-06-01
>
Daniel Jomphe18:06:27

Some seem to put baggage forward as very useful, and some seem to shy away from it. Honeycomb seems to put it forward, but warn about some limits. Here's https://www.honeycomb.io/blog/ask-miss-o11y-opentelemetry-baggage/. Have any of you found good advice about the tradeoffs?

steffan20:06:25

I haven't used baggage myself, but my impression is that care is needed to avoid trouble. One thing that comes to mind if adding baggage attributes to spans is unintended collisions of baggage and span attributes. This is an example where namespacing attributes can help.

steffan20:06:37

As an aside, it was a deliberate design decision NOT to re-implement features specific to Honeycomb's SDK in clj-otel. These features are being put forward for inclusion in the OpenTelemetry SDK, or are dropped entirely from Honeycomb's SDK. One notable example is Honeycomb's DeterministicTraceSampler, which initially had a different hash calculation, but now has adopted the same (and much simpler) implementation found in the OpenTelemetry SDK.

Daniel Jomphe21:06:30

Yes, it's great that you do so. If they are worthy, I suppose OTel will end up adopting them, and then we'll know it's time to wrap them. As for baggage: • I don't yet need cross-service trace propagation. • I was interested in it for thru-span-hierarchy propagation (which is not the main intended case for baggage but can be implemented with an optional propagator like honeycomb did), but I'll wait till I see a clear need for it before trying it.

Daniel Jomphe21:06:06

I'm playing with ways to generate common attributes. I should add some optional kwargs to opts-for-code to accept e.g. more attributes.

steffan21:06:18

You may be interested in using (meta &form) in a macro

steffan21:06:12

I'm sure I looked at this some time ago, perhaps I need to revisit this

Daniel Jomphe15:06:32

For now I put this in place. Didn't yet add extra args to augment attributes from call site.

(defn -opts-for-code [var-meta]
  {:name (str (:name var-meta))
   :attributes {(str SemanticAttributes/CODE_FUNCTION)  (str (:name var-meta))
                (str SemanticAttributes/CODE_NAMESPACE) (str (:ns   var-meta))
                (str SemanticAttributes/CODE_FILEPATH)  (:file      var-meta)
                (str SemanticAttributes/CODE_LINENO)    (:line      var-meta)}})
(defmacro opts-for-code  [f-as-var]
  `(-opts-for-code (meta ~f-as-var)))
Couldn't find a way to make &form work for me in this context.