This page uses Temporal’s built-in OpenTelemetry support plus OpenInference LLM instrumentation. It isn’t a Temporal-specific OpenInference instrumentor.
Install
Setup
Set your API keys as environment variables:create_tracer_provider(), which is replay-safe: workflow spans get deterministic IDs and aren’t exported again when Temporal replays workflow code. Export it to Phoenix and enable the OpenInference OpenAI instrumentor before any Temporal client or worker code runs:
instrumentation.py
Run Temporal
Register Temporal’sOpenTelemetryPlugin when you create the client. With the plugin installed, Temporal creates spans for client calls, workflows, and activities, and propagates trace context across those boundaries. Temporal workflow code must stay deterministic, so put network I/O, including LLM calls, in activities:
app.py
instrumentation.py and connect with the OpenTelemetryPlugin, so trace context flows from the client through the worker.
Observe
Open thetemporal project in Phoenix. Each workflow run is one trace:
- Temporal client, workflow, and activity spans from the
OpenTelemetryPlugin - An OpenInference LLM span for the OpenAI call, nested under the activity span, with the prompt, response, and token usage
- Errors, retries, and latency for each step
Troubleshooting
- LLM spans aren’t nested under activities. Make sure the LLM call runs inside the activity, and that Temporal and the OpenInference instrumentor use the same tracer provider.
- Duplicate or unexpected workflow spans. Temporal replays workflow code. Keep I/O and LLM calls in activities, not in workflow methods, and create the tracer provider with
create_tracer_provider(). - No traces in Phoenix. Confirm
instrumentation.pyruns before the Temporal client and worker are created, and thatPHOENIX_COLLECTOR_ENDPOINTis set in every process.

