feat(frontend,ad,payment): propagate enduser.id as span attribute and W3C baggage - #3366
Conversation
… W3C baggage Add enduser.id (the existing per-browser UUID) as a span attribute on every browser span via SessionIdProcessor, propagate it in W3C baggage on all outgoing API requests via the ApiGateway Proxy, and extract it in the ad and payment backend services to stamp their own spans.
6834e1a to
edc7c47
Compare
osullivandonal
left a comment
There was a problem hiding this comment.
Hey thanks for the contribution, can you please add a changelog entry as per the contributing guidelines. Thanks.
changelog entry added |
|
There is a semantic convention for a user that we should use. We should be using Can you change all references and attribute names to show this as |
|
Both In this case, according to this PR, I believe we're trying to describe end users of the Astronomy Shop, and propagate that ID via Baggage. IMO this is a great use case to showcase client-side semconv. I think it's fine right now to have |
|
I'd add that the fact that this is a common source of confusion means we could make semconv clearer about these two attributes. One should not need to know the lore to reason about this. I'll open an issue. |
|
TIL: Enduser is in the spec. |
|
Hey @dpacheconr thanks for that, would you be able to also add an entry on the telemetry schema for this? |
Add enduser.id (OTel semconv) to the telemetry schema service refs for frontend, ad, and payment — the three services that instrument this attribute per the enduser.id propagation PR.
Keep enduser.id alongside upstream's renamed demo.user_context.loyalty_level in payment service schema; preserve both CHANGELOG entries.
… W3C baggage (open-telemetry#3366) * feat(frontend,ad,payment): propagate enduser.id as span attribute and W3C baggage Add enduser.id (the existing per-browser UUID) as a span attribute on every browser span via SessionIdProcessor, propagate it in W3C baggage on all outgoing API requests via the ApiGateway Proxy, and extract it in the ad and payment backend services to stamp their own spans. * docs: add changelog entry for enduser.id propagation (open-telemetry#3366) * feat(telemetry-schema): add enduser.id to service attribute refs Add enduser.id (OTel semconv) to the telemetry schema service refs for frontend, ad, and payment — the three services that instrument this attribute per the enduser.id propagation PR.
Summary
AttributeNames.ts— addsENDUSER_ID = 'enduser.id'enum value alongside the existingSESSION_IDSessionIdProcessor.ts— stampsenduser.idon every browser span inonStart, using the same per-browser UUID already used forsession.idApi.gateway.ts— chains.setEntry(AttributeNames.ENDUSER_ID, { value: userId })onto the baggage Proxy wrapper, injectingenduser.idinto the W3Cbaggageheader on every outgoing/api/*callAdService.java— inside the existingif (baggage != null)block, extracts"enduser.id"from baggage and callsspan.setAttribute("enduser.id", enduserId)when presentcharge.js— after the existingsynthetic_requestbaggage check, extracts'enduser.id'from baggage and stamps it on thechargespan when presentMotivation
enduser.idis the OTel-recommended semantic convention attribute for identifying the end user associated with a request. Populating it consistently across browser and backend spans enables observability backends to correlate traces to individual users, power "impacted users" counts in error views, and filter/group by user out of the box — without any custom attribute naming.The demo already had a stable per-browser UUID in localStorage used as
session.id. This change re-uses that same value forenduser.idso there is no new data collection, and the attribute flows end-to-end: browser spans carry it directly, and the ad and payment services extract it from the propagated W3C baggage and stamp their own spans.Test plan
npm run buildinsrc/frontend/)ENDUSER_ID="enduser.id"enum,setEntry(ENDUSER_ID)baggage call, andsetAttribute(ENDUSER_ID)span callbaggage: session.id=<uuid>,enduser.id=<uuid>on every/api/*callenduser.id=<uuid>on paymentchargespans for browser-initiated checkouts