This integration populates event.request, including headers, IP, cookies, etc. We need to set all this data as attributes on the segment span. Two strategies:
- add the logic to
applyScopeToSegmentSpan in captureSpan. This is preferrable from bundle-size perspective because captureSpan can be tree-shaken out for non-streaming users. But means request attribute creation isn't co-located with the integration. Might be a fine tradeoff though 🙂
- I started a version of this for contexts in my experimental PoC branch:
|
function applyScopeToSegmentSpan(segmentSpanJSON: SpanV2JSON, scopeData: ScopeData): void { |
|
// TODO: Apply all scope and request data from auto instrumentation (contexts, request) to segment span |
|
const { contexts } = scopeData; |
|
|
|
safeSetSpanJSONAttributes(segmentSpanJSON, contextsToAttributes(contexts)); |
|
} |
- This also applies to other contexts kept on the scope.
- Alternatively add a processSegmentSpan implementation to the integration
This integration populates
event.request, including headers, IP, cookies, etc. We need to set all this data as attributes on the segment span. Two strategies:applyScopeToSegmentSpanincaptureSpan. This is preferrable from bundle-size perspective becausecaptureSpancan be tree-shaken out for non-streaming users. But means request attribute creation isn't co-located with the integration. Might be a fine tradeoff though 🙂sentry-javascript/packages/core/src/spans/captureSpan.ts
Lines 80 to 85 in 957ccf8