Skip to content

Initial propagation headers#1457

Merged
waltjones merged 9 commits into
masterfrom
waltjones/propagation-headers
Mar 11, 2026
Merged

Initial propagation headers#1457
waltjones merged 9 commits into
masterfrom
waltjones/propagation-headers

Conversation

@waltjones
Copy link
Copy Markdown
Contributor

@waltjones waltjones commented Feb 10, 2026

Description of the change

Adds support for the baggage request header, enabling propagation of session id. Additional headers (traceparent, tracestate) and additional baggage keys may be enabled in follow up PRs.

Background:

Organized by commit:

  • Add telemetry for Node fetch, 9d28078
  • Add ts types for propagation config and middleware, 8b42186
  • Add propagation utility functions, 8b640b3
  • Enable baggage header for browser xhr and fetch, 33666df
  • Enable baggage header for Node fetch and requests, e3dd993
  • Add session_id attribute to Node (server) payloads, a6669ee
  • Add Express middleware for propagation headers, d202180

Type of change

  • New feature (non-breaking change that adds functionality)

Checklists

Development

  • Lint rules pass locally
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development

@waltjones waltjones force-pushed the waltjones/propagation-headers branch from 80e41b9 to d202180 Compare February 11, 2026 14:20
Copy link
Copy Markdown

@shankj3 shankj3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still brain-fog here, so I had some questions to understand. Also, where is the sessionId added to the item attributes? Do we just get that for free, since tracing.sessionId is set?

}

return function rollbarExpressMiddlewareHandler(req, _res, next) {
const sessionId = extractSessionId(getBaggageHeader(req));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to create a sessionId, if one is not present?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a doc forthcoming to discuss that. Whatever we do, it won't go in this PR.

Comment thread src/server/telemetry.js
if (!mergedOptions.options.headers) {
mergedOptions.options.headers = {};
}
mergedOptions.options.headers.baggage = `rollbar.session.id=${sessionId}`;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, this means we only forward the rollbar.session.id in the baggage header. Is there a reason why wouldn't we forward the entire thing?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answered async - duplicates of the same header are concatenated

@waltjones
Copy link
Copy Markdown
Contributor Author

@shankj3 : where is the sessionId added to the item attributes?

That's existing code in src/rollbar.js _addItemAttributes. The only change we make in this PR is to also look for it in AsyncLocalStorage.

@waltjones waltjones marked this pull request as ready for review February 26, 2026 16:42
@waltjones waltjones force-pushed the waltjones/propagation-headers branch from 55beef7 to fc8a8bf Compare March 10, 2026 18:36
@waltjones waltjones force-pushed the waltjones/propagation-headers branch from fc8a8bf to 5161ca4 Compare March 11, 2026 13:09
@waltjones waltjones merged commit cc2faca into master Mar 11, 2026
7 checks passed
@waltjones waltjones deleted the waltjones/propagation-headers branch March 11, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants