Option to ignore specific Postgres (`pg`) spans
Problem Statement
Extracted from https://github.com/getsentry/sentry-javascript/issues/16505#issuecomment-2954260527, 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).
This was already requested in https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2017 and we might be able to use the workaround: https://github.com/open-telemetry/opentelemetry-js-contrib/issues/2017#issuecomment-2167817925
@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:
Is the reason they're still showing up related to the fact that these are auto-instrumented by the OTel pg instrumentation?
(SDK version: sentry.javascript.node 9.13.0)
ignoreSpans was introduced in 10.2.0. I recommend upgrading and trying again. I opened https://github.com/getsentry/sentry-docs/pull/14971 to clarify the required version in docs.