Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which package are you using?
@sentry/node
SDK Version
7.6.0
Framework Version
7.6.0
Link to Sentry event
No response
Steps to Reproduce
I followed the Express integration and i have this code:
/* eslint-disable @rushstack/typedef-var */import*asSentryfrom'@sentry/node';import*asTracingfrom'@sentry/tracing';importexpress,{Request,Response}from'express';// "express": "4.18.1",import{typeExpress}from'express';import{port}from'./config';/** * Express app * @internal */exportconstapp: Express=express();constrouter=express.Router({caseSensitive: true});/// init the SentrySentry.init({dsn: 'obv-dsn',enabled: true,environment: 'envvvvv',integrations: [newSentry.Integrations.Http({tracing: true}),// enable Express.js middleware tracingnewTracing.Integrations.Express({ app,methods: ['get'], router })],tracesSampleRate: 1.0});app.use(Sentry.Handlers.requestHandler());app.use(Sentry.Handlers.tracingHandler());router.get('/my-router-route/*',async(req: Request,res: Response)=>{res.send('ok');});app.use(router);/** * Home route */app.get('/',(req: Request,res: Response)=>{res.send('home');});/** * Health-check route */app.get('/healthcheck',(req: Request,res: Response)=>{res.send('OK');});app.post('/po',(req: Request,res: Response)=>{res.send('OK');});// eslint-disable-next-line @typescript-eslint/naming-conventionapp.get('*',function(req: Request,res: Response){res.status(404).end();});// The error handler must be before any other error middleware and after all controllersapp.use(Sentry.Handlers.errorHandler());app.listen(port);Expected Result
only router is instrumented, and get requests in the router only. Not the whole app
Actual Result
You can see here that all routes are instrumented. I have tried to set the
router.use(Sentry.Handlers.requestHandler());
router.use(Sentry.Handlers.tracingHandler());
from the app but it doesn't work.

Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which package are you using?
@sentry/node
SDK Version
7.6.0
Framework Version
7.6.0
Link to Sentry event
No response
Steps to Reproduce
I followed the Express integration and i have this code:
Expected Result
only
routeris instrumented, andgetrequests in the router only. Not the whole appActual Result
You can see here that all routes are instrumented. I have tried to set the
from the
appbut it doesn't work.