Skip to content

Record Postgres instrumentation errorsΒ #3172

@Blacksmoke16

Description

@Blacksmoke16

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:

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions