From b8f2f40a58a99dd4f33eb4fa240638a792d04879 Mon Sep 17 00:00:00 2001 From: Lazar Nikolov Date: Thu, 2 Oct 2025 13:10:16 -0400 Subject: [PATCH 1/3] docs(js-browser): adding predefined matches for ignoring common spans --- .../common/configuration/options.mdx | 25 +++++++++++++++++++ .../common/configuration/tree-shaking.mdx | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/docs/platforms/javascript/common/configuration/options.mdx b/docs/platforms/javascript/common/configuration/options.mdx index 39d18858533a4..e9b4e86d59556 100644 --- a/docs/platforms/javascript/common/configuration/options.mdx +++ b/docs/platforms/javascript/common/configuration/options.mdx @@ -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).*$/}, + + // Measure spans + {op: 'measure'}, + ] +}); +``` + diff --git a/docs/platforms/javascript/common/configuration/tree-shaking.mdx b/docs/platforms/javascript/common/configuration/tree-shaking.mdx index 29fe10525d155..aae211e95447f 100644 --- a/docs/platforms/javascript/common/configuration/tree-shaking.mdx +++ b/docs/platforms/javascript/common/configuration/tree-shaking.mdx @@ -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 From 9641a8f93b9dd30de3a6dabefe14f36cfdc8b587 Mon Sep 17 00:00:00 2001 From: Lazar Nikolov Date: Thu, 2 Oct 2025 13:53:47 -0400 Subject: [PATCH 2/3] docs(js-browser): escaping dots in ignoreSpans examples --- docs/platforms/javascript/common/configuration/options.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/platforms/javascript/common/configuration/options.mdx b/docs/platforms/javascript/common/configuration/options.mdx index e9b4e86d59556..7dfebf0e1b676 100644 --- a/docs/platforms/javascript/common/configuration/options.mdx +++ b/docs/platforms/javascript/common/configuration/options.mdx @@ -463,10 +463,10 @@ Sentry.init({ {op: 'resource.link', name: /.+\.css.*$/}, // JS files - {op: /resource.(link|script)/, name: /.+\.js.*$/}, + {op: /resource\.(link|script)/, name: /.+\.js.*$/}, // Images - {op: /resource.(other|img)/, name: /.+\.(png|svg|jpe?g|gif|bmp|tiff?|webp|avif|heic?|ico).*$/}, + {op: /resource\.(other|img)/, name: /.+\.(png|svg|jpe?g|gif|bmp|tiff?|webp|avif|heic?|ico).*$/}, // Measure spans {op: 'measure'}, From 89b4e025c1a9369eeea4be8dd30ec6e211c03b70 Mon Sep 17 00:00:00 2001 From: Lazar Nikolov Date: Tue, 7 Oct 2025 14:49:07 -0400 Subject: [PATCH 3/3] Apply suggestion from @sfanahata Co-authored-by: Shannon Anahata --- docs/platforms/javascript/common/configuration/options.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/javascript/common/configuration/options.mdx b/docs/platforms/javascript/common/configuration/options.mdx index 7dfebf0e1b676..bdc37e8143f41 100644 --- a/docs/platforms/javascript/common/configuration/options.mdx +++ b/docs/platforms/javascript/common/configuration/options.mdx @@ -457,7 +457,7 @@ Sentry.init({ {op: /^browser\.(cache|connect|DNS)$/}, // Fonts - {op: 'resource.other', name: /\.(woff2|woff|ttf|eot)$/}, + {op: 'resource.other', name: /.+\.(woff2|woff|ttf|eot)$/}, // CSS files {op: 'resource.link', name: /.+\.css.*$/},