TECHNOLOGY

Recording spans versus exported traces: separate SDK sampling states

In this article
THE QUICK TAKE

IsRecording confirms local recording behavior; it does not promise that the span is selected for export.

The diagnostic situation

A developer guards expensive diagnostic attributes with IsRecording and sees that the branch ran. The corresponding inference trace is absent from the backend. Suspecting a network outage, the team changes collector queues. Yet the SDK sampler may intentionally record locally without selecting the span for export. A valid observation path can therefore end before any network transmission.

Why the observation changes meaning

The tracing SDK distinguishes DROP, RECORD_ONLY and RECORD_AND_SAMPLE decisions. RECORD_ONLY permits recording while leaving the sampled flag unset. This supports local processing without requiring the span to appear as a retained remote trace. The API also separates IsRecording from direct inspection of the sampled flag. Instrumentation should not substitute one property for the other.

Define the instrumentation contract

Document the configured sampler, processors and exporter selection in the installed language implementation. Identify whether a local processor derives metrics from recorded spans that are not exported. Preserve the distinction between application execution, local span recording and destination receipt. A local derived metric can coexist with no remote trace without either observation necessarily being inconsistent or erroneous.

A bounded verification procedure

Build controlled spans under each supported sampling decision using a test sampler or documented equivalent. Observe whether attributes are recorded, whether processors see completed spans and which spans reach the test exporter. Then add a separate exporter failure fixture. The diagnostic should distinguish intentional non-export from failed delivery instead of treating every missing backend trace as transport loss.

Evidence required for acceptance

Acceptance requires the effective sampling configuration, local processing observations and exported identifier inventory. Compare the selected span population with destination receipt rather than comparing all executed requests directly with retained traces. Mark decisions not observable in the chosen integration as unknown. Include instrumentation and SDK versions because wrappers may configure processors or samplers beyond the application’s explicit setup.

Failure cases and limits

Recording does not imply eventual persistence, and sampling selection does not guarantee successful delivery. Conversely, missing traces cannot establish that a request never ran. This protocol explains the local recording/export boundary; it does not estimate rare-failure prevalence from a selected trace sample or recover traces discarded before downstream retention. Those questions require independent population counters and a defined sampling study.

IsRecording confirms local recording behavior; it does not promise that the span is selected for export. OpenTelemetry tracing API specification; OpenTelemetry tracing SDK specification.

The proposed investigation of recording versus exported span is not an executed deployment benchmark. Related reading: Phoenix tracing in short-lived workers: ending a span does not guarantee export; From a slow histogram bucket to a trace through an exemplar.

Earn rental income from GPUs

Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.

Explore GPU hosting
← All articles