Skip to content

Tracing

Distributed tracing for observability

Extension URN: urn:mesh:ext:tracing


The tracing extension enables distributed tracing across Mesh calls. Pass correlation IDs through requests and responses to track operations across service boundaries.


Tracing SHOULD be used for:

  • Microservices architectures
  • Debugging cross-service requests
  • Performance monitoring
  • Request correlation in logs

FieldTypeRequiredDescription
trace_idstringYesRoot trace identifier
span_idstringYesCurrent span identifier
parent_span_idstringNoParent span identifier
baggageobjectNoKey-value pairs propagated across services

FieldTypeDescription
span_idstringServer-generated span ID for this operation
trace_idstringEchoed trace ID
durationobjectServer-side processing duration

When the tracing extension is included:

  1. Server MUST propagate trace_id to downstream calls
  2. Server MUST generate new span_id for its operation
  3. Server SHOULD use client’s span_id as parent_span_id in downstream calls
  4. Server MUST return its span_id in response
  5. Server SHOULD log with trace context attached

{
"protocol": { "name": "mesh", "version": "0.1.0" },
"id": "req_123",
"call": {
"function": "orders.create",
"version": "1",
"arguments": { "product_id": 42, "quantity": 1 }
},
"extensions": [
{
"urn": "urn:mesh:ext:tracing",
"options": {
"trace_id": "abc123def456",
"span_id": "span_client_001",
"baggage": {
"user_tier": "premium",
"region": "us-west"
}
}
}
]
}
{
"protocol": { "name": "mesh", "version": "0.1.0" },
"id": "req_123",
"result": {
"order_id": "ord_789",
"status": "created"
},
"extensions": [
{
"urn": "urn:mesh:ext:tracing",
"data": {
"trace_id": "abc123def456",
"span_id": "span_server_002",
"duration": { "value": 45, "unit": "millisecond" }
}
}
]
}

When the server makes downstream calls, it propagates the trace:

{
"extensions": [
{
"urn": "urn:mesh:ext:tracing",
"options": {
"trace_id": "abc123def456",
"span_id": "span_server_003",
"parent_span_id": "span_server_002"
}
}
]
}

Mesh FieldOpenTelemetry
trace_idtrace_id
span_idspan_id
parent_span_idparent_span_id
baggageBaggage

Servers MAY support W3C Trace Context headers alongside this extension for HTTP transport interoperability.