Skip to content

opentelemetry-instrumentation-asyncpg: allow opting out of instrumentation for async cursors #3109

@krishnan-chandra

Description

@krishnan-chandra

What problem do you want to solve?

Currently, the AsyncPGInstrumentor instruments these async methods, including CursorIterator.__anext__.

In conjunction with this, it means that a span is fired for every single row that is iterated over from an async cursor. This causes certain traces to become unsustainably large and contain a massive number of spans like the one below:

Screenshot 2024-12-13 at 2 24 58 PM

Describe the solution you'd like

Allow opting out of instrumentation for CursorIterator.__anext__, or implement instrumentation at the network request level so that every fetch to the database triggers a span rather than every single row that is iterated over.

Describe alternatives you've considered

No response

Additional Context

No response

Would you like to implement a fix?

None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions