opentelemetry-js icon indicating copy to clipboard operation
opentelemetry-js copied to clipboard

recordException should support chained exceptions

Open dvoytenko opened this issue 2 years ago • 1 comments
trafficstars

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:

  1. Introduce exception.cause attribute.
  2. 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.

dvoytenko avatar Oct 26 '23 17:10 dvoytenko

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.

github-actions[bot] avatar Jan 29 '24 06:01 github-actions[bot]

This issue was closed because it has been stale for 14 days with no activity.

github-actions[bot] avatar Mar 11 '24 06:03 github-actions[bot]