Title: Add `ignoreSpans` option · Issue #16820 · getsentry/sentry-javascript · GitHub
Open Graph Title: Add `ignoreSpans` option · Issue #16820 · getsentry/sentry-javascript
X Title: Add `ignoreSpans` option · Issue #16820 · getsentry/sentry-javascript
Description: Description We have the recurring request to be able to ignore certain spans. We removed the option to use beforeSendSpan to allow dropping spans, because it can break metric extrapolation when using non-deterministic code to drop spans....
Open Graph Description: Description We have the recurring request to be able to ignore certain spans. We removed the option to use beforeSendSpan to allow dropping spans, because it can break metric extrapolation when usi...
X Description: Description We have the recurring request to be able to ignore certain spans. We removed the option to use beforeSendSpan to allow dropping spans, because it can break metric extrapolation when usi...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/16820
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add `ignoreSpans` option","articleBody":"### Description\n\nWe have the recurring request to be able to ignore certain spans. We removed the option to use `beforeSendSpan` to allow dropping spans, because it can break metric extrapolation when using non-deterministic code to drop spans.\n\nThe replacement for this has been to configure specific integrations to drop spans. While this works, it has a few problems:\n\n1. It can be hard to know where/how to configure integrations. Option names can differ, and you may have to configure a whole bunch of integrations to make this work as you want.\n2. Some integrations do not have options to drop stuff. While we can add things in general, esp. with OpenTelemetry it can be hard because we require upstream changes.\n\nIn order to help alleviate this, we should add a `ignoreSpans` option that can be used to filter spans at creation time:\n\n```ts\ntype IgnoreSpansFilter = \n{\n name: string | RegExp,\n op: string | RegExp,\n} | \n{\n name: string | RegExp\n} | \n{\n op: string | RegExp\n}\n\ninterface Options {\n // ...\n ignoreSpans: (string | RegExp | IgnoreSpansFilter)[]\n}\n```\n\nThis will match against the span name **at creation time**, and make the span non-recording if it matches.\n\nImportant notes:\n* On browser, this should work reasonably well, as we emit all the spans and they _usually_ have the correct span name at span creation time. Important exception: pageload spans often get updated, they may not have the correct span name at creation time.\n* On node, we need to infer the name at creation time, which is a bit more expensive, resource wise. This is an opt-in option though, we just need to make it clear there may be a performance overhead with this. Also, in node span names can often be updated later, this also needs to be documented well.\n* We need to document well that ignoring a span like this will also drop child spans of this span. So this should ideally mostly be used for leaf nodes.\n\nThis function will be run in the place where we also run `beforeSendSpan`, so after processing. If possible, we will re-stitch parent-child relationships of spans that are dropped there.","author":{"url":"https://github.com/mydea","@type":"Person","name":"mydea"},"datePublished":"2025-07-07T08:15:07Z","url":"https://github.com/getsentry/sentry-javascript/issues/16820"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:4df80d7a-7197-686b-6145-b569bf87a963 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DF8C:3F5AC:2AF878:3AB314:6B05D725 |
| html-safe-nonce | 7a2b8eae4e20bb45c324d9458918f5592eae4522efc3131da143f0b600e56805 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjhDOjNGNUFDOjJBRjg3ODozQUIzMTQ6NkIwNUQ3MjUiLCJ2aXNpdG9yX2lkIjoiODAwNTMzNjkwNTY5MDc2NTA5MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6d6430fe4caa40b0c21bde69a5d9ceb0db1f78a8c91fa9000db26a8077ca19d2 |
| hovercard-subject-tag | issue:3207999902 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/16820/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bf273ff65d7fdb131bd0acd5007e7c1934057bae4ef1cddede084f358ed5e56d/getsentry/sentry-javascript/issues/16820 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bf273ff65d7fdb131bd0acd5007e7c1934057bae4ef1cddede084f358ed5e56d/getsentry/sentry-javascript/issues/16820 |
| og:image:alt | Description We have the recurring request to be able to ignore certain spans. We removed the option to use beforeSendSpan to allow dropping spans, because it can break metric extrapolation when usi... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mydea |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7cc8361bc0396e5c33704280422dd7a38c5b91f6190589faea57461f56967249 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ab4da203740f827015a12d36851c8de196e908bf |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width