sentry-javascript
sentry-javascript copied to clipboard
Update express integration to be able to ignore layers like `router` or `middleware` spans
Description
https://github.com/getsentry/sentry-javascript/blob/develop/packages/node/src/integrations/tracing/express.ts
Similar to the work we did in https://github.com/getsentry/sentry-javascript/pull/16553 for Koa, we should expose ignoreLayers and ignoreLayersType from the underlying OTEL instrumentation.
https://www.npmjs.com/package/@opentelemetry/instrumentation-express
Exposed options:
| Options | Type | Example | Description |
|---|---|---|---|
| ignoreLayers | IgnoreMatcher[] | [/^/_internal//] | Ignore layers that by match. |
| ignoreLayersType | ExpressLayerType[] | ['request_handler'] | Ignore layers of specified type. |
ignoreLayers accepts an array of elements of types:
-
stringfor full match of the path -
RegExpfor partial match of the path -
functionin the form of (path) => boolean for custom logic
ignoreLayersType accepts an array of following strings:
-
routeris the name of express.Router(), -
middleware -
request_handleris the name for anything that's not a router or a middleware
Relevant discord thread: https://discord.com/channels/621778831602221064/1382410123372269741/1382410123372269741