Skip to content

Option to ignore specific Postgres (pg) spans #16536

Description

@Lms24

Problem Statement

Extracted from #16505 (comment), we should find a way to ignore certain spans emitted from the OTel pg instrumentation. For example, the pg-pool.connect spans.

Solution Brainstorm

Right now, I don't think there is a way to achieve this, given that the pg instrumentation from OTel used in our postgresIntegration doesn't expose an option for (not) starting connect spans. Which means we'll likely need to contribute this upstream or vendor-in the pg instrumentation (with pg already being Otel v2 compatible, we'd likely need to vendor-in anyway).

Activity

  1. Lms24 commented on Jun 10, 2025

    @Lms24
    MemberAuthor

    This was already requested in open-telemetry/opentelemetry-js-contrib#2017 and we might be able to use the workaround: open-telemetry/opentelemetry-js-contrib#2017 (comment)

  2. cstavitsky commented on Sep 17, 2025

    @cstavitsky

    @Lms24 I have a clarification question on this. A customer raised the problem that they're attempting to use ignoreSpans in their express app on pg-pool.connect spans, using this syntax:

    ignoreSpans: [
          /pg-pool\.connect/,
    ]
    

    (SDK version: sentry.javascript.node 9.13.0)

    I'd expect these spans to be ignored, but the customer is seeing them still:

    Image

    Is the reason they're still showing up related to the fact that these are auto-instrumented by the OTel pg instrumentation?

  3. moved this to Waiting for: Product Owner in GitHub Issues with 👀 3on Sep 17, 2025
  4. Lms24 commented on Sep 18, 2025

    @Lms24
    MemberAuthor

    (SDK version: sentry.javascript.node 9.13.0)

    ignoreSpans was introduced in 10.2.0. I recommend upgrading and trying again. I opened getsentry/sentry-docs#14971 to clarify the required version in docs.

  5. moved this from Waiting for: Product Owner to No status in GitHub Issues with 👀 3on Sep 18, 2025
  6. self-assigned this
    on Feb 11, 2026
  7. Lms24 commented on Feb 11, 2026

    @Lms24
    MemberAuthor

    OTel added an option to ignore connect spans in the instrumentation. I opened #19291 to expose this option in our integration. So now users can either use ignoreSpans as previously, or configure span ignoring on integration level.

  8. github-actions commented on Feb 24, 2026

    @github-actions
    Contributor

    A PR closing this issue has just been released 🚀

    This issue was referenced by PR #19291, which was included in the 10.40.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions