Skip to main content

Distributed tracing

Tracing is what makes the Trace Graph possible: following one logical transaction across every service and hop it touches.

How it works​

pymidil builds on OpenTelemetry and propagates trace context using the standard W3C traceparent header. In practice, this is mostly automatic:

  • ConsumerObserver and event-runtime subscribers extract trace context from the incoming message's headers and continue the same trace.
  • ProducerObserver and the built-in producers inject the current trace context into outgoing message headers before the message is sent.

As long as your services pass message headers/metadata through unchanged (which most broker clients do by default), a trace stays connected end to end without any extra code.

If a hop is missing instrumentation​

If a message passes through a service that isn't instrumented yet, the trace picks back up at the next instrumented hop. You'll see it in the Trace Graph as a node without an incoming edge, rather than a broken trace. Instrumenting more services over time fills in more of the picture.

Exporting traces to your own tooling​

If you already run OpenTelemetry in your stack and want these spans to also land in your own tracing backend (not just Observatory), call configure_tracing() once at startup with your service name and exporter:

from pymidil.event.otel import configure_tracing

configure_tracing(service_name="orders-svc")

This is entirely optional. Telemetry to Observatory works the same with or without it.