Skip to content

Support filtering AsyncPG spans #3643

@GonRappaport

Description

@GonRappaport

What problem do you want to solve?

When using the AsyncPG instrumentation, spans are created with no attributes and the attributes are added immediately after by using span.set_attribute. This means samplers can't rely on request attributes which are known during span creation, and in practice have no way to sample any span.

Describe the solution you'd like

The attribute hydration function doesn't incur a meaningful performance penalty and can be used during span creation instead of within the span itself. This is also more correct for timing the actual request time.

Describe alternatives you've considered

There is no way to filter spans on specific tables or actions without relying on other logic such as some contextvar and code changes.

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