Replies: 1 comment 1 reply
-
AFAIK, there is no expectation that span attributes will automatically be stuck into structured logs. The only things that I know of would be the trace id and span id, and not attributes unless specifically configured (or explicitly) to be included. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Sorry if these questions are already answered in the specification, but I've not been able to find definitive answers.
As part of the planning for a Flogger specific backend for OTel, I've been reading through the specification to try and determine the exact semantics. However, I'm still not entirely clear on the expectations a user should have when logging is integrated with OTel.
I see the example code in:
https://github.com/open-telemetry/opentelemetry-demo/blob/42d2ed94217707200037a60acdb9466c73392a2b/src/adservice/src/main/java/oteldemo/AdService.java
but it's not obvious how calls to the
Span
class are intended to interact with the log statements.In this code various attributes are set on the span during its lifetime (implying spans are mutable).
And various log statements are made at different points, before and after attributes are set.
My main question is:
Should a user expect each log statement made in this context to have all current attributes attached to the current span at the time the log statement is made emitted with it? Or, are attributes for logging only those which are somehow attached to a logging specific context (e.g. Log4J's MDC)?
As someone potentially writing a bridging API, I'd like to think that the OTel Logger handles any automatically emitted attributes from the current context, but it's not really clear from that example (perhaps there's a better bit of example Java code I missed however).
The example of the adding of an error event to the span just prior to logging (at the bottom of the code example) is interesting to me. Should the log statement somehow pick up the "Error" event and treat it as if the log statement had an exception passed to it? Or is this a replacement for passing the exception to the log statement?
I'm assuming that not all "general logging metadata" should be emitted to OTel though (Flogger has metadata for things like the degree of rate limiting on a log statement, which would likely not be known to an OTel schema).
It feels like logging of OTel attributes needs to be essentially "opt in".
Beta Was this translation helpful? Give feedback.
All reactions