Skip to content

Implement Trace Context Propagation over NATS #19

Description

@taitelee

Problem

When the API publishes a message to NATS and the Worker picks it up, the "trace" normally breaks. The Worker starts a new trace, making it impossible to see that the Worker's action was caused by a specific API call. This is known as a "Context Gap."

Proposed Solution

Use OpenTelemetry's TextMapPropagator to inject and extract trace headers.

  • Producer (API): Before publishing to NATS, "inject" the current span context into the NATS message headers.
  • Consumer (Worker): Upon receiving a message, "extract" the context from the headers and use it as the parent for the Worker's new span.

Alternatives Considered

Passing IDs in JSON payload: Rejected as it litters the business logic with telemetry data. Using NATS headers keeps the payload clean.

Additional Context

None

Activity

  1. closed this as completedby moving to Done in WaveHouse Task Boardon Apr 13, 2026
  2. self-assigned this
    on Apr 20, 2026
  3. changed the title [-][feature] [Observability] Implement Trace Context Propagation over NATS[/-] [+]Implement Trace Context Propagation over NATS[/+] on Apr 20, 2026
  4. added theissue type on Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/observabilityMetrics, logs, traces, health, profilingenhancementNew feature or request

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions