liveBook · Manning

Correlation id

As explained in Designing AI Systems

A correlation ID is an identifier carried across related records or service calls so they can be associated with the same request or operation.

A correlation ID links records and service calls belonging to the same request. In a distributed trace, a shared trace ID follows the request across service boundaries, letting operators reconstruct its end-to-end path instead of matching timestamps across separate logs. section 7.1.2 section 7.2.2

A shared trace ID supports practical investigation:

  • Services record their own spans against the ID; the Observability Service assembles them into a complete trace. section 7.3.1
  • Structured logs carry trace and span IDs, so an operator can retrieve events across services and inspect the span linked to a problem. section 7.4.1
Listing 7.2 Structured log event Protocol Buffer definition
message LogEvent {
  string event_id = 1;
  string trace_id = 2;    #A
  string span_id = 3;    #A
  google.protobuf.Timestamp timestamp = 4;
  string service = 5;
  Severity severity = 6;
  string event_type = 7;    #B
  string message = 8;
  map<string, string> attributes = 9;    #C
  map<string, double> numeric_attributes = 10;    #C
  string workflow_id = 11;
  string user_id = 12;
}

The log event schema shows trace_id and span_id alongside service, timestamp, and queryable attributes. section 7.4.1

Following a request

A patient request passes through session, data, guardrails, and model services. The Gateway creates a trace ID, and each service uses it for its part of the trace, enabling the request’s spans and model generation to be viewed together. section 7.2.2

How Designing AI Systems covers it

How deep it goes
Defines shared trace IDs and shows their use in spans and logs, without specifying a propagation protocol.
Examples
Uses a multi-service patient request and provider-fallback log events to illustrate trace correlation.
What you can do after
Diagnose/debug with it by retrieving logs across services for a trace and locating problematic spans.
How it connects
Connects distributed tracing, spans, structured logging, and observability across service boundaries.

Also explained in

Compare how 8 books explain correlation id →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Designing AI Systems. The section links point to the parts of the book it draws on.