-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat: Span Streaming #19119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: Span Streaming #19119
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
90df33e
feat(core): Add span v2 and envelope type definitions (#19100)
Lms24 97fc6bd
feat(core): Add `traceLifecycle` option and `beforeSendSpan` compatib…
Lms24 80dd3e0
feat(core): Add `StreamedSpanEnvelope` creation function (#19153)
Lms24 930ceea
feat(core): Add span serialization utilities (#19140)
Lms24 ca76525
feat(core): Add `captureSpan` pipeline and helpers (#19197)
Lms24 10ba7e9
feat(core): Add `SpanBuffer` implementation (#19204)
Lms24 25be928
feat(browser): Add `spanStreamingIntegration` (#19218)
Lms24 b26aa94
feat(core): Add weight-based flushing to span buffer (#19579)
Lms24 414af7c
test(browser): Add span streaming integration tests (#19581)
Lms24 5308c92
fix(browser): Apply Http timing attributes to streamed `http.client` …
Lms24 6007a29
fix(core): Replace global interval with trace-specific interval based…
Lms24 0e80fde
feat(node-core): Add POtel server-side span streaming implementation …
Lms24 59784b6
test(node,node-core): Add span streaming integration tests (#19806)
Lms24 595985b
feat(core): Apply `ignoreSpans` to streamed spans (#19934)
Lms24 1275bd5
fix(core): Fix `withStreamedSpan` typing error add missing exports (#…
Lms24 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
dev-packages/browser-integration-tests/suites/public-api/beforeSendSpan-streamed/init.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import * as Sentry from '@sentry/browser'; | ||
|
|
||
| window.Sentry = Sentry; | ||
|
|
||
| Sentry.init({ | ||
| dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
| integrations: [Sentry.browserTracingIntegration(), Sentry.spanStreamingIntegration()], | ||
| tracesSampleRate: 1, | ||
| beforeSendSpan: Sentry.withStreamedSpan(span => { | ||
| if (span.attributes['sentry.op'] === 'pageload') { | ||
| span.name = 'customPageloadSpanName'; | ||
| span.links = [ | ||
| { | ||
| context: { | ||
| traceId: '123', | ||
| spanId: '456', | ||
| }, | ||
| attributes: { | ||
| 'sentry.link.type': 'custom_link', | ||
| }, | ||
| }, | ||
| ]; | ||
| span.attributes['sentry.custom_attribute'] = 'customAttributeValue'; | ||
| span.status = 'something'; | ||
| } | ||
| return span; | ||
| }), | ||
| }); |
35 changes: 35 additions & 0 deletions
35
dev-packages/browser-integration-tests/suites/public-api/beforeSendSpan-streamed/test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import { expect } from '@playwright/test'; | ||
| import { sentryTest } from '../../../utils/fixtures'; | ||
| import { shouldSkipTracingTest, testingCdnBundle } from '../../../utils/helpers'; | ||
| import { getSpanOp, waitForStreamedSpan } from '../../../utils/spanUtils'; | ||
|
|
||
| sentryTest('beforeSendSpan applies changes to streamed span', async ({ getLocalTestUrl, page }) => { | ||
| sentryTest.skip(shouldSkipTracingTest() || testingCdnBundle()); | ||
|
|
||
| const url = await getLocalTestUrl({ testDir: __dirname }); | ||
|
|
||
| const pageloadSpanPromise = waitForStreamedSpan(page, span => getSpanOp(span) === 'pageload'); | ||
|
|
||
| await page.goto(url); | ||
|
|
||
| const pageloadSpan = await pageloadSpanPromise; | ||
|
|
||
| expect(pageloadSpan.name).toBe('customPageloadSpanName'); | ||
| expect(pageloadSpan.links).toEqual([ | ||
| { | ||
| context: { | ||
| traceId: '123', | ||
| spanId: '456', | ||
| }, | ||
| attributes: { | ||
| 'sentry.link.type': { type: 'string', value: 'custom_link' }, | ||
| }, | ||
| }, | ||
| ]); | ||
| expect(pageloadSpan.attributes?.['sentry.custom_attribute']).toEqual({ | ||
| type: 'string', | ||
| value: 'customAttributeValue', | ||
| }); | ||
| // we allow overriding any kinds of fields on the span, so we have to expect invalid values | ||
| expect(pageloadSpan.status).toBe('something'); | ||
| }); |
10 changes: 10 additions & 0 deletions
10
dev-packages/browser-integration-tests/suites/public-api/startSpan/streamed/init.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import * as Sentry from '@sentry/browser'; | ||
|
|
||
| window.Sentry = Sentry; | ||
|
|
||
| Sentry.init({ | ||
| dsn: 'https://public@dsn.ingest.sentry.io/1337', | ||
| integrations: [Sentry.spanStreamingIntegration()], | ||
| tracesSampleRate: 1.0, | ||
| debug: true, | ||
| }); |
13 changes: 13 additions & 0 deletions
13
dev-packages/browser-integration-tests/suites/public-api/startSpan/streamed/subject.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| Sentry.startSpan({ name: 'test-span', op: 'test' }, () => { | ||
| Sentry.startSpan({ name: 'test-child-span', op: 'test-child' }, () => { | ||
| // noop | ||
| }); | ||
|
|
||
| const inactiveSpan = Sentry.startInactiveSpan({ name: 'test-inactive-span' }); | ||
| inactiveSpan.end(); | ||
|
|
||
| Sentry.startSpanManual({ name: 'test-manual-span' }, span => { | ||
| // noop | ||
| span.end(); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bundle size limits increased for browser packages
Medium Severity
Multiple browser package size limits have been increased (e.g.,
@sentry/browserwith treeshaking 24.5→25 KB, sendFeedback 31→32 KB, Metrics 27→28 KB, React tracing 45.1→46 KB, plus several CDN bundles). Per the project rules, large bundle size increases in browser packages need to be flagged even when they're unavoidable for a new feature.Additional Locations (1)
.size-limit.js#L105-L120Triggered by project rule: PR Review Guidelines for Cursor Bot
Reviewed by Cursor Bugbot for commit 1275bd5. Configure here.