Open jacobycwang opened 3 months ago
In my case, I would also like to disable the spans for connect, as our pg-pool.connect spans are filling up the collector, and right now that information isn't useful to us. It would be great if we could handle this at the instrumentation level rather than filtering it out from the collector.
I've tried using requireParentSpan: true, but it doesn't solve my problem, although it might solve yours, @jacobycwang.
@vibaiher that doesn't solve my problem either.
I actually create a patched version, and that works well in our production env
class MyPgInstrumentation extends PgInstrumentation {
_getClientConnectPatch() {
return (original) => {
/** @this {import("pg").Client} */
return function connect() {
return original.apply(this, arguments);
};
};
}
_getPoolConnectPatch() {
return (original) => {
/** @this {import("pg-pool")<import("pg").Client>} */
return function connect() {
return original.apply(this, arguments);
};
};
}
}
While using instrumentation-pg, it will always create span for pool.connect, is there any way we can exclude or bypass that? https://github.com/open-telemetry/opentelemetry-js-contrib/blob/358345f1384635ae2cb072082b25907dcbcaebcb/plugins/node/opentelemetry-instrumentation-pg/src/instrumentation.ts#L361-L404
I've tried using Sampler to not sample that, however, the span of following query will have not-found parents in portal like GCP.