@fastify/otel: Ignoring or disabling a path does not affect sub-spans
- Dominant language
- No language data
- Stars
- 68
- Forks
- 8
- Avg merge
- 11h 2m
- Merged PRs (30d)
- 2
Description
## 💬 Question here
Hi,
I have a health endpoint that is often called and I want to disable all tracing for the endpoint and any sub-spans that may occor. I've tried using the `ignorePaths` and route config (`config { otel: false }`), and they do disable the endpoint in question, but any sub-spans are still registered, e.g. `@opentelemetry/instrumentation-http` and DB calls are still traced and are reported as root-spans. This creates more spam than just enabling the endpoint. I can't imagine this is the inteded way it should work, what am I doing wrong?
I tried using a parent based sampler but that has no affect.
```typescript
export const fastifyOtelInstrumentation = new FastifyOtelInstrumentation({
registerOnInitialization: true,
ignorePaths: (opts) => {
return opts.url.startsWith('/healthz');
},
});
sdk = new NodeSDK({
sampler: new ParentBasedSampler({
root: new AlwaysOnSampler(),
}),
instrumentations: [
getNodeAutoInstrumentations({
'@opentelemetry/instrumentation-fastify': {
enabled: false,
},
}),
],
})
sdk.start()
```
## Your Environment
- *node version*: 22.16
- *fastify version*: 5.3.3
- *fastify/otel version*: 0.9.1
- *os*: Linux
Contributor guide
Assessment
This issue has not been assessed yet.