-
Notifications
You must be signed in to change notification settings - Fork 614
Description
Is your feature request related to a problem? Please describe
The Postgres instrumentation package, in various places, handles errors by marking the span as ERROR
and setting the error message:
opentelemetry-js-contrib/packages/instrumentation-pg/src/utils.ts
Lines 430 to 435 in d519d4b
if (err) { | |
span.setStatus({ | |
code: SpanStatusCode.ERROR, | |
message: err.message, | |
}); | |
} |
However is it not clear when the exception actually occurred. This makes it more challenging to debug issues since there is no clear timeline of events.
Describe the solution you'd like to see
The OTEL Spec says:
An exception SHOULD be recorded as an Event on the span during which it occurred if and only if it remains unhandled when the span ends and causes the span status to be set to ERROR.
So I propose that in the places where the spans are being set to ERROR
and the error re-raised, we also record the exception via span.recordException(err)
Describe alternatives you've considered
N/A