Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/platforms/javascript/common/configuration/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,31 @@ If a root span matches any of the specified patterns, the entire local trace wil

By default, no spans are ignored.

Here are some predefined matches for common spans to get you started:
```javascript
Sentry.init({
ignoreSpans: [
// Browser connection events
{op: /^browser\.(cache|connect|DNS)$/},

// Fonts
{op: 'resource.other', name: /.+\.(woff2|woff|ttf|eot)$/},

// CSS files
{op: 'resource.link', name: /.+\.css.*$/},

// JS files
{op: /resource\.(link|script)/, name: /.+\.js.*$/},

// Images
{op: /resource\.(other|img)/, name: /.+\.(png|svg|jpe?g|gif|bmp|tiff?|webp|avif|heic?|ico).*$/},
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Regex Patterns Incorrectly Match File Extensions

The ignoreSpans examples for CSS, JS, and image files use regex patterns that are too broad. The .*$ at the end allows them to incorrectly match filenames containing the extension string but not ending with it (e.g., file.css.map, script.js.backup). This could lead to unintended spans being ignored.

Fix in Cursor Fix in Web

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .* at the end is to match the cache fingerprint segment, but yes coincidentally it's going to match .css.map and .js.backup. Either way, if we ignore the .css files we'll most likely want to ignore the rest, so we should be good.


// Measure spans
{op: 'measure'},
]
});
```

</SdkOption>

<SdkOption name="propagateTraceparent" type='boolean' defaultValue='false' availableSince='10.10.0' categorySupported={['browser']}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Tree Shaking
sidebar_order: 11000
sidebar_order: 70
description: "Learn how to reduce Sentry bundle size by tree shaking unused code."
notSupported:
- javascript.aws-lambda
Expand Down
Loading