Uh oh!
There was an error while loading. Please reload this page.
feat(core): Apply request data to segment spans in span streaming - #20654
Conversation
size-limit report 📦
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit fd48621. Configure here.
Uh oh!
There was an error while loading. Please reload this page.
| function applyScopeToSegmentSpan(_segmentSpanJSON: StreamedSpanJSON, _scopeData: ScopeData): void { | ||
| // TODO: Apply all scope and request data from auto instrumentation (contexts, request) to segment span | ||
| // TODO: Apply contexts data from auto instrumentation to segment span |
There was a problem hiding this comment.
l: are the changes here just leftovers or intentional?
| if (include.headers) { | ||
| requestData.headers = headers; | ||
| // Remove the Cookie header in case cookie data should not be included in the event |
| if (include.ip) { | ||
| const ip = (normalizedRequest.headers && getClientIPAddress(normalizedRequest.headers)) || ipAddress || undefined; | ||
| if (ip) { | ||
| safeSetSpanJSONAttributes(span, { [SEMANTIC_ATTRIBUTE_USER_IP_ADDRESS]: ip }); |
There was a problem hiding this comment.
l: any reason not to aggregate all attributes and then call safeSetSpanJSONAttributes once instead of splitting this up?
There was a problem hiding this comment.
To set cookies before headers for precedence
| return event; | ||
| }, | ||
| processSegmentSpan(span, client) { | ||
| const { sdkProcessingMetadata } = getIsolationScope().getScopeData(); |
There was a problem hiding this comment.
l: could sdkProcessingMetadata ever be undefined? in the event processing path we use a default here to be safe
nicohrubec
left a comment
There was a problem hiding this comment.
have a few minor comments, but else good to go 🚀

Implements the span-streaming counterpart of the
requestDataIntegration.processEventhook.Request data from the scope's
sdkProcessingMetadatais mapped to span attributes following sentry-conventions, reusinghttpHeadersToSpanAttributesfor sensitivity filtering and gating IP extraction behindsendDefaultPii.Note: The logic is also guarded by
client.getIntegrationByName('RequestData')so users who opt out of the integration don't get request data on streamed spans either.This approach was chosen over adding a
processSegmentSpanhook to the integration because captureSpan is tree-shakeable for non-streaming users, keeping the request data code out of bundles that don't need it (see linked ticket).Closes#20380