startTrace method

void startTrace({
  1. String name = 'trace',
})

Starts a new distributed trace. All network requests made while this trace is active share one trace id, so they appear together in a single trace. This allows for automatic trace coordination without manual header injection.

The first request made in the trace is its root span, and every later request is a direct child of that first request: siblings of one another, never nested inside the request before them. Every parent is therefore a span that is actually reported. No separate root span is reported; earlier versions sent one as a placeholder atatus-trace:// resource, which trace views do not render, so every request showed a missing parent.

name is accepted for API compatibility and is currently unused. A trace that is still active when this is called is stopped first.

Implementation

void startTrace({String name = 'trace'}) {
  stopTrace();
  activeTraceContext = generateTracingContext(AtatusSdk.instance, this);
}