Propagating Exceptions in Span Events #955
Labels
area:error-reporting
Related to error reporting
spec:trace
Related to the specification/trace directory
triage:deciding:community-feedback
Open to community discussion. If the community can provide sufficient reasoning, it may be accepted
I'm working with the Java implementation of the reference OpenTelemetry Tracer and using a span exporter that renders spans to logs via log4j2. Currently the Span interface exposes a helper method
recordException
which can record the details of an exception as an event with attributes to the span. However, as the specification supports a small subset of possible data types for attributes those details and added as String attributes with a raw stack trace and the original exception instance is lost. This prevents me from being able to use the log4j2 configuration to specify how I want the exception and stack trace to be rendered into the log. What I am interested in is some way to propagate an exception into an event on the span so that a span exporter can obtain that original exception instance to interpret/render.I don't wish a prescribe a solution but I do believe that exceptions are a fairly common concern across most programming languages so it makes sense having a standard way to describe them in the specification.
Here are some possible solutions if this is considered:
Event
is an interface and I can provide my own implementation however the reference SDK Tracer implementation wraps myEvent
and prevents access to any custom members I expostThis conversation might fall into the larger conversation as to what constitutes a successful Span, although being able to track exceptions as discrete events within the lifetime of a span doesn't impact how those exceptions might be interpreted into a single status/success.
The text was updated successfully, but these errors were encountered: