Skip to content

Conversation

@mydea
Copy link
Member

@mydea mydea commented Jan 29, 2024

This introduces a new onlyIfParent option to the start-span APIs, which, if set, will ensure to not create a span if there is no parent. I've added this also for otel to demonstrate this works there as well.

This PR also uses this option in a few places, esp. for http.client spans, to ensure we do not capture these if there is no ongoing transaction.

This replaces https://github.com/getsentry/sentry-javascript/pull/10375/files with a more generic solution, and includes the test from #10376 (which passes here as well).

@mydea mydea requested review from AbhiPrasad, Lms24 and lforst January 29, 2024 08:44
@mydea mydea self-assigned this Jan 29, 2024
import type { EnvelopeItemType, Event, EventEnvelopeHeaders } from '@sentry/types';

const envelopeUrlRegex = /\.sentry\.io\/api\/\d+\/envelope\//;
export const envelopeUrlRegex = /\.sentry\.io\/api\/\d+\/envelope\//;

Check failure

Code scanning / CodeQL

Missing regular expression anchor

When this is used as a regular expression on a URL, it may match anywhere, and arbitrary hosts may come before or after it.
@github-actions
Copy link
Contributor

github-actions bot commented Jan 29, 2024

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay, Feedback) - Webpack (gzipped) 78.18 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 69.39 KB (+0.02% 🔺)
@sentry/browser (incl. Tracing, Replay with Canvas) - Webpack (gzipped) 73.28 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped) 63.01 KB (+0.03% 🔺)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 33.41 KB (+0.03% 🔺)
@sentry/browser (incl. browserTracingIntegration) - Webpack (gzipped) 33.27 KB (+0.03% 🔺)
@sentry/browser (incl. Feedback) - Webpack (gzipped) 31.33 KB (0%)
@sentry/browser (incl. sendFeedback) - Webpack (gzipped) 31.34 KB (0%)
@sentry/browser - Webpack (gzipped) 22.6 KB (0%)
@sentry/browser (incl. Tracing, Replay, Feedback) - ES6 CDN Bundle (gzipped) 76 KB (+0.05% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 67.54 KB (+0.05% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 33.44 KB (+0.12% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped) 24.66 KB (+0.14% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 213.09 KB (+0.06% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 101.11 KB (+0.11% 🔺)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 73.98 KB (+0.13% 🔺)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 36.56 KB (+0.11% 🔺)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 69.78 KB (-0.02% 🔽)
@sentry/react - Webpack (gzipped) 22.63 KB (0%)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 86.45 KB (+0.01% 🔺)
@sentry/nextjs Client - Webpack (gzipped) 50.76 KB (+0.01% 🔺)
@sentry-internal/feedback - Webpack (gzipped) 17.21 KB (0%)

@mydea mydea force-pushed the fn/startSpanIfParent branch from 4aab2aa to a5108f8 Compare January 29, 2024 09:17
@mydea mydea force-pushed the fn/startSpanIfParent branch from a5108f8 to d4f2740 Compare January 30, 2024 07:58
mydea added 3 commits January 30, 2024 10:17
This introduces a new `onlyIfParent` option to the start-span APIs, which, if set, will ensure to not create a span if there is no parent.

This PR also uses this option in a few places, esp. for http.client spans, to ensure we do not capture these if there is no ongoing transaction.
@mydea mydea force-pushed the fn/startSpanIfParent branch from d4f2740 to 70a7b80 Compare January 30, 2024 09:17
@mydea mydea merged commit 1822af5 into develop Jan 30, 2024
@mydea mydea deleted the fn/startSpanIfParent branch January 30, 2024 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants