opentelemetry-js
opentelemetry-js copied to clipboard
recordException should support chained exceptions
This might be a feature request for the spec. After all error-chaining is common for many languages. I also registered https://github.com/open-telemetry/opentelemetry-specification/issues/3743 for the spec.
Is your feature request related to a problem? Please describe.
The Error.cause, when present, is just as important (and often more important) then the wrapping exception. Currently recordException() loses this information completely.
Describe the solution you'd like
Two possible solutions:
- Introduce
exception.causeattribute. - Use existing attributes, but combine their values. E.g.
message = error.message + '; cause:' + error.chain.message, and the same for stack.
(1) is more preferred, however, it'd be hard to make the exception.cause recursive, since the Attributes type doesn't allow sub-objects.
Describe alternatives you've considered
Do the (2) above manually in call sites.
This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 14 days.
This issue was closed because it has been stale for 14 days with no activity.