feat(realtime): extract inbound Kafka-header traceparent in the relay (GC-23 (b) consumer half) #8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/relay-extract-kafka-traceparent"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Header
im2be-realtime-service · GC-23 (b) producer→relay origin (consumer half) · branch
feat/relay-extract-kafka-traceparent→mainTL;DR
The notification relay now extracts the W3C
traceparentfrom the consumed Kafka message headers and roots itscentrifugo.relay_publishspan as a child of the producer's trace — so a business event flows producer → Kafka → relay → Centrifugo under ONEtrace_id. Forward-compatible: no header → roots fresh (prior behaviour).Summary
Completes the picture for GC-23: boundary (a) (relay→Centrifugo) is already closed end-to-end (Tempo
d2b8b4ab2cd2fc119a8574c29372904— the Centrifugo/api/publishspan joins the relay trace as a child). This PR adds the consumer half of boundary (b).handleNotificationMessagenow takes the Kafkaheadersand usespropagation.extractwith a kafkajsIHeadersTextMapGetter(decodes Buffer header values to UTF-8, takes first-of-array). The relay span is started with the extracted context as its parent (getTracer().startSpan(name, opts, parentCtx)); the active context is set under that parent so the existing inject-to-Centrifugo continues the chain.The producer half (im2be-platform-libs
OutboxRecord.traceParentcolumn + capture-at-write inOutboxPublisher.publish()+ inject-into-Kafka-headers in the hot relaytryHotPublishand the cold pollertryColdPublish) is a separate follow-up PR. Until it lands, thetraceparentheader is absent and the relay roots its own trace — no regression.Findings (self-review)
headersparam.Verdict
NEEDS_REVIEW — feature change, consumer half of GC-23 (b). No new prod deps (uses the already-present
@opentelemetry/apipropagation API + kafkajsIHeaders).tsc --noEmitclean; vitest 157/157.Footer
im2be-realtime-service · GC-23(b) consumer half · R0 (open) · tests 157/157 · typecheck clean · 2026-06-01
hib-pr-reviewer review — PR #8 (affinity-intelligence-rework/im2be-realtime-service)
Round 1 — head
63c7c55de1b2, basemain, triggeropenedTL;DR: NO_NEW_FINDINGS — No new findings this round.
Summary
[quorum-converged] A=0 = B=0. ## Review: feat(realtime) — inbound Kafka-header traceparent extraction (GC-23 (b))
The implementation is correct.
KAFKA_HEADER_GETTERcorrectly handles all kafkajs header value variants (Buffer,string,(Buffer|string)[],undefined),propagation.extractis called withheaders ?? {}so the fallback-to-no-remote-span path works before the producer side lands, andtrace.setSpan(parentCtx, span)(rather thancontext.active()) correctly preserves anytracestate/baggage extracted intoparentCtx. The new end-to-end test wires a realW3CTraceContextPropagatorand asserts both same-trace_idcontinuity and a fresh relayspan_id— that is the right shape for this kind of propagation test.One minor finding: the JSDoc for
handleNotificationMessagewas not updated to document the newheadersparameter.CI status (head
63c7c55de1b2)No CI checks reported for this commit.
Findings
No new findings this round.
Quorum converged on empty findings (A + B both returned 0).
Verdict
NO_NEW_FINDINGS
hib-pr-reviewer • round 1 • 0 findings • 2026-06-01T13:33:15.669Z → 2026-06-01T13:35:24.044Z • posted-as: pr-reviewer-bot • model: auto • [bookkeeping fallback]