-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document generic approach for span status (code + description) and exception event when instrumented code throws #1536
Comments
Another aspect of this to consider is whether information should be captured from the outermost exception or innermost in the case of nested exceptions. In capturing On the other hand, when a user opts in to recording exception events, my intuition is that the outermost exception may be the most useful because the stack trace captured usually contains information from all nested exceptions. Interestingly, the DB semantic conventions seems to suggest capturing details from the innermost exception:
The HTTP semantic conventions seem less opinionated and does not have a similar statement. |
a slight variation on this is to replace SERVER/CONSUMER span above with "local root" span |
since it appears that github discussions don't get backreferenced, linking here: open-telemetry/opentelemetry-java-instrumentation#12125 |
Tacking on a related question: in the issue description it seems setting span status to error and setting span |
hi @cheempz, check out this part of https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-spans.md:
|
Thanks @trask! If I'm reading correctly it means span status of error should also set
|
👍 (I hope this is answered here: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#set-status) |
Related: #1560 (comment) Quoting @trask here for the context Feedback from the spec SIG was that this sounds like a good default behavior, but we should make it configurable. Some options for making it configurable: (A) handle this all in the SDK:
but I don't think we can change the default behavior of the SDK. (B) Another option could be to introduce "trace advice" (similar to metric advice) that would allow a given instrumentation the ability to opt-in to this new behavior. (C) Another option could be:
(D) Another option could be:
(E) Or even:
|
Ultimately I don't think that we should record exceptions on spans - we should use log-based events for it since If we think about logs there are at least two options that make sense:
There are options in between (do both, or log every time exception is created or suppressed by another one). So I think we need some sort of an exception logging strategy enum and it should be on the |
One more thing to consider: almost every library is instrumented natively with logs and records exceptions already. If we have OTel integration for the underlying logger, there is no benefit in re-recording lib exceptions in OTel instrumentations. We should still provide guidance for green-field native instrumentations on when to log exceptions. |
The common approach seems to be:
error.type
attribute on spans/metrics based on the exception type or more specific low-cardinality error codeWe should document it and link from DB/messaging/gen-ai and other conventions.
The text was updated successfully, but these errors were encountered: