By default, OpenTelemetry automatically instruments all incoming and outgoing HTTP requests. However, endpoints like health checks (/health), readiness probes, or metrics (/metrics) can generate a lot of noise in your traces.
This guide shows you how to filter out these requests by configuring the HttpInstrumentation hook so they don't produce spans.
Prerequisites
- Node.js version 18.0 or higher (see official list of supported versions)
- Instrumented Node.js app with OpenTelemetry SDK installed and configured
Configure HttpInstrumentation
The HttpInstrumentation class allows you to define an ignoreIncomingRequestHook. This hook is a function that receives the request object (req). If it returns true, the request is ignored and no span is created.
In case you're using zero-code instrumentation, HTTP endpoints cannot be configured through environment variables. You'll need to switch to programmatic instrumentation by creating an instrumentation.js file as shown below and loading it with node -r ./instrumentation.js app.js. See Node.js OpenTelemetry Instrumentation for the complete setup guide.
If you are using getNodeAutoInstrumentations, pass the configuration to the @opentelemetry/instrumentation-http key. The getNodeAutoInstrumentations helper allows you to configure specific instrumentations by name.
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
const { NodeSDK } = require('@opentelemetry/sdk-node');
// ... other imports
const sdk = new NodeSDK({
// ... other config
instrumentations: [
getNodeAutoInstrumentations({
'@opentelemetry/instrumentation-http': {
ignoreIncomingRequestHook(req) {
// Exclude common health check paths
const excludedPaths = [
/^\/health/,
/^\/ready/,
/^\/metrics/
];
return excludedPaths.some(pattern => pattern.test(req.url));
},
},
}),
],
});
sdk.start();
If you are manually adding instrumentations, instantiate and configure the HttpInstrumentation class directly:
const { HttpInstrumentation } = require('@opentelemetry/instrumentation-http');
const { NodeSDK } = require('@opentelemetry/sdk-node');
const httpInstrumentation = new HttpInstrumentation({
ignoreIncomingRequestHook(req) {
return req.url.startsWith('/health') || req.url.startsWith('/api/static');
},
});
const sdk = new NodeSDK({
instrumentations: [
httpInstrumentation,
// ... any other instrumentations
],
});
sdk.start();
Validate
- Run your application with the new configuration:
node -r ./instrumentation.js app.js - Generate traffic to the excluded endpoints (e.g.,
curl http://localhost:3000/health). - Generate traffic to included endpoints (e.g.,
curl http://localhost:3000/api/users). - Go to the Traces tab in SigNoz.
- Verify that you only see traces for the included endpoints.

Troubleshooting
Still seeing traces for excluded endpoints?
- Check Regex/Conditions:
req.urlincludes the path and query string (e.g.,/health?id=1). Avoid using strict equality (===) for partial matches; use.startsWith()or regex instead. Logreq.urlto debug. - Instrumentation Order: If using manual instrumentation, ensure
HttpInstrumentationis initialized and passed to the SDK. - Multiple Instrumentations: If you use both auto-instrumentations and manual instances, they might conflict. Prefer one method.
Enable debug logging
Set OTEL_LOG_LEVEL=debug to see if the instrumentation is initialized and if spans are being created/dropped.
Next Steps
Get Help
If you need help with the steps in this topic, please reach out to us on SigNoz Community Slack.
If you are a SigNoz Cloud user, please use in product chat support located at the bottom right corner of your SigNoz instance or contact us at cloud-support@signoz.io.