﻿# Phoenix tracing in short-lived workers: ending a span does not guarantee export

Check Phoenix span-processor configuration and shutdown behavior in short-lived evaluation workers so successful execution is not mistaken for complete trace delivery.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-phoenix-short-lived-worker-span-export-shutdown/
Language: en

## Separate execution from trace delivery

An evaluation worker can return a valid answer and exit before its telemetry reaches Phoenix. The [Phoenix setup guide](https://arize.com/docs/phoenix/tracing/how-to-tracing/setup-tracing/setup-using-phoenix-otel) warns that queued spans may remain unexported when a process terminates. Do not interpret an absent trace as proof that inference never ran. First distinguish the application outcome from span creation, span completion, queue processing and collector acceptance.

## Inspect the actual processor configuration

SDK language and options determine how exporting is scheduled. The current Phoenix reference documents different default batching behavior for its Python and TypeScript wrappers. Read the installed integration's configuration rather than assuming a shared product name implies identical lifecycle behavior. Custom processor configuration can also alter the default export path. Retain the effective endpoint, transport and processor setup in a diagnostic record so missing telemetry can be investigated without changing the evaluated application.

## End the observed work before flushing

The [tracing-helper guide](https://arize.com/docs/phoenix/tracing/how-to-tracing/setup-tracing/instrument) describes span creation around application functions and operations. A flush cannot export an unfinished span as a completed observation merely because the worker is about to exit. Check span scope, exception handling and asynchronous work that may outlive the task function. Close the intended observation and then use the integration's documented lifecycle operations, preserving the order between completing work and delivering its telemetry.

## Treat shutdown as a bounded operation

The [OpenTelemetry SDK specification](https://opentelemetry.io/docs/specs/otel/trace/sdk/) defines force-flush and shutdown responsibilities. These operations have lifecycle and timeout behavior; they are not a promise of unlimited waiting or guaranteed delivery under every network failure. Inspect their results and collector-side evidence where available. A hard process kill may bypass graceful shutdown entirely, so the completeness assumptions of a normal exit should not be applied to interrupted workers without additional evidence.

## Verify a minimal worker end to end

Run a benign diagnostic worker with a uniquely identifiable completed operation, then reconcile the expected span with collector-side records after normal termination. Repeat under the intended batching configuration. The guides to [trace assertion presence](/journal/fg2-promptfoo-trace-assertions-span-presence-selection/) and [measurement coverage](/journal/fg2-ragas-legacy-evaluate-nan-timeout-coverage/) provide related controls. Report missing telemetry separately from incorrect application answers, allowing a reader to distinguish an execution failure from an observation that was created locally but never delivered to the evaluation store.
