-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(replays): Record segment names that occur during replay #21851
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import type { StreamedSpanJSON } from '@sentry/core'; | ||
| import type { ReplayContainer } from '../types'; | ||
| import { addSegmentDetailsToContext } from './util/addSegmentDetailsToContext'; | ||
|
|
||
| type ProcessSegmentSpanCallback = (spanJSON: StreamedSpanJSON) => void; | ||
|
|
||
| export function handleProcessSegmentSpan(replay: ReplayContainer): ProcessSegmentSpanCallback { | ||
| return (spanJSON: StreamedSpanJSON) => { | ||
| if (!replay.isEnabled()) { | ||
| return; | ||
| } | ||
|
|
||
| const traceId = spanJSON.trace_id; | ||
| const segmentName = spanJSON.name; | ||
| if (traceId && segmentName) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. m/q: This couples the AFAIK, Since Suggest recording the trace_id whenever present and moving the empty-name guard into If the coupling is intentional, a comment explaining why would help. |
||
| addSegmentDetailsToContext(replay, traceId, segmentName); | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty segment name drops traceMedium Severity Under span streaming, replay no longer records a Reviewed by Cursor Bugbot for commit 8f45b63. Configure here. |
||
| }; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import type { ReplayContainer } from '../../types'; | ||
|
|
||
| const MAX_CONTEXT_VALUES = 100; | ||
|
|
||
| export function addSegmentDetailsToContext(replay: ReplayContainer, traceId: string, segmentName: string): void { | ||
| const replayContext = replay.getContext(); | ||
| if (replayContext.traceIds.size < MAX_CONTEXT_VALUES) { | ||
| replayContext.traceIds.add(traceId); | ||
| } | ||
| if (replayContext.segmentNames.size < MAX_CONTEXT_VALUES) { | ||
| replayContext.segmentNames.add(segmentName); | ||
| } | ||
| } |
This file was deleted.


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.
m/q: This was
if (traceId)before, so a transaction event with atrace_idbut notransactionname will no longer record its trace_id.event.transactionis optional, so this is a behavioral change for nameless transactions. I think we can decouple setting atraceIdfrom setting asegmentNamesso that both enrich the replay independently where possible.What do you think?