Skip to main content
Distributed tracing follows one request or operation through instrumented services. A trace groups the spans for that work. Each span is one timed operation, such as an HTTP request, a database call, a queue operation, or a background job. A missing span leaves part of the path unknown. Use a trace when a log reports a failure but not the path of the operation. A trace can show:
  • Which operation started the request.
  • Where the request spent time.
  • Which child operation returned an error.
  • Which logs, issues, actions, and metrics have the same trace ID.
  • Which service, environment, and release sent each span.

Trace and span fields

A root span starts a trace and has no parent. Child spans have the same trace ID, their own span IDs, and a parent ID. Only these IDs connect operations. Timestamps alone do not. LogBrew counts a span as an error span only when its status is error.

A request across services

  1. The web service starts a server span for the checkout route.
  2. A payment client creates a child span for its outbound HTTP request.
  3. The payment service continues the trace with its own server span.
  4. A database helper records a child span for the write.
  5. The app sends a safe error log inside the active payment span.
All five records have the same trace ID. If a service does not receive trace context, its work does not join the trace, even when the times overlap.

Propagate context

LogBrew SDKs use W3C trace context. For example, the Node.js SDK continues a valid incoming traceparent header with a new request span. If the header is missing or invalid, it starts a new root. Logs, issues, actions, and metrics captured inside that request scope carry the request trace. Outbound instrumentation writes a traceparent header only to the targets that you configure, such as tracePropagationTargets. Send trace context only to trusted, instrumented services. A trace ID correlates operations. It is not authentication. A queue message can also carry trace context. In Node.js, call createLogBrewQueueTraceHeaders() in the producer operation to add a traceparent header to the message. In the consumer, pass that header to queueOperationWithLogBrewSpan() as traceparent. See JavaScript queue tracing. The Node.js and Python request and outbound integrations do not record request or response bodies, query strings, arbitrary headers, or the raw traceparent value in spans. Name spans after route templates, not concrete URLs. For the integrations of your runtime, read the SDK ingestion guide.

Capture spans

LogBrew stores every new log, issue, action, and metric with a trace ID. If a signal does not refer to a span in the same delivery, LogBrew adds one capture span for it: The signal’s span_id then identifies its capture span. If the signal had no trace context, LogBrew creates a new trace ID for it. That trace shows that LogBrew stored the signal. It does not show a request path. Do not read the capture spans in one trace as one request. Capture spans count in span_count and error_span_count. Thus an error log can make --status error select a trace in which no application operation failed. Read the operation of each error span before you draw a conclusion.

Read a trace

Use an exact trace ID from a log, an issue, or a trace list:
--status error selects traces with at least one error span. --status ok selects traces with no error span. --min-duration-ms 500 selects traces that ran for 500 milliseconds or more. Read the root span duration first. Then examine the longest child spans and error statuses. Keep the project, service, environment, and release in view, so that a staging trace does not become evidence about production. One trace shows one execution, not a performance baseline. Before you propose a performance change, compare several traces with the related metric trend.

Trace summary

GET /api/telemetry/traces/{trace_id}/summary returns a summary without span attributes: If root_span.parent_span_id has a value, the real root span is not in the trace. Do not read root_span as the start of the request.

Explain a trace

logbrew explain trace returns a trace investigation:
analysis.causality is evidence_only. The analysis does not prove a root cause. The CLI requests response version 3, in which each related issue, action, and metric also has its exact span_id. To examine one span with its parent, children, and service boundaries, run:
topology.parent_chain_status tells you if the chain of parents is complete:

Missing trace context

Not every event has a trace of its request. Read the trace state: not_linked is not an error. An available trace can also show that the event had no request context. If the event’s capture span has no parent_span_id, no span was active when the app captured the event. Background work outside a request scope often gives this result. To find a missing relationship:
  1. Read the event’s project, service, environment, release, and time.
  2. Check that the work ran inside an instrumented request or operation.
  3. Check that the client and server integrations propagate context across that boundary.
  4. After you correct the instrumentation, capture a new event and read it.
A new SDK version does not add trace context to events sent earlier. Do not link an event to a trace by timestamp, route, message, or release.

Plan tracing for one project

Start with one important request or job, such as checkout. Instrument one boundary at a time:
  1. Create a span for the incoming request or the background operation.
  2. Add child spans for important outbound calls.
  3. Continue W3C trace context across trusted service boundaries.
  4. Send a safe log inside the active span.
  5. Read that log, open its trace ID, and check the root, children, service, environment, release, status, and duration.
Add the next boundary only after this check passes. A shared trace shows correlation. It does not prove that one span caused an issue. To check span names, run logbrew traces --project "<project_id>" --pagination cursor --json. The naming_quality object counts the traces on that page with a generic root name (generic_name_traces) or an unmatched route (unmatched_route_traces). If naming needs attention, naming_quality.next_action.code is improve_trace_naming.