Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix baggage propagation
  • Loading branch information
timfish committed Sep 2, 2024
commit 5d2d0f22ed408bda4c37f973d32e0d3b9f9f01e2
7 changes: 1 addition & 6 deletions packages/node/src/integrations/node-fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,8 @@ const _nativeNodeFetchIntegration = ((options: NodeFetchOptions = {}) => {

return false;
},
startSpanHook: request => {
const url = getAbsoluteUrl(request.origin, request.path);

startSpanHook: () => {
return {
// We manually set 'http.url' because the instrumentation doesn't set this and we use it when determining
// whether to propagate W3C baggage headers
[SEMATTRS_HTTP_URL]: url,
SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN: 'auto.http.otel.node_fetch',
};
},
Expand Down
3 changes: 2 additions & 1 deletion packages/opentelemetry/src/propagator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,8 @@ function getExistingBaggage(carrier: unknown): string | undefined {
* 2. Else, if the active span has no URL attribute (e.g. it is unsampled), we check a special trace state (which we set in our sampler).
*/
function getCurrentURL(span: Span): string | undefined {
const urlAttribute = spanToJSON(span).data?.[SEMATTRS_HTTP_URL];
const spanData = spanToJSON(span).data;
const urlAttribute = spanData?.[SEMATTRS_HTTP_URL] || spanData?.['url.full'];
if (urlAttribute) {
return urlAttribute;
}
Expand Down