Azure OpenAI (tracing)
Azure OpenAI (tracing)
Trace calls made through the openai package’s AzureOpenAI client. The instrumentation differs by language:
- TypeScript uses the dedicated
@respan/instrumentation-azure-openaiinstrumentor. It also supports the legacy@azure/openaiOpenAIClientwhen that package is present. - Python has no separate Azure package. The
AzureOpenAIclient ships inside theopenaipackage, so the OpenAI instrumentation (respan-instrumentation-openai) captures Azure OpenAI calls.
This tracing setup uses your Azure OpenAI credentials directly. To route requests through Respan instead, use the Azure OpenAI gateway setup.
Set up Respan
Create an account at platform.respan.ai and grab an API key.
Run npx @respan/cli setup to set up with your coding agent.
Use Respan Gateway
See Azure OpenAI gateway setup to route calls through the Respan gateway.
Setup
Install packages
Python has no dedicated Azure instrumentation package. The respan-instrumentation-openai OpenAIInstrumentor traces AzureOpenAI client calls because that client is part of the openai package.
Set environment variables
AZURE_OPENAI_API_KEY, AZURE_OPENAI_ENDPOINT, and OPENAI_API_VERSION are used for Azure OpenAI requests. RESPAN_API_KEY exports traces to Respan.
View your trace
Open the Traces page to see Azure OpenAI chat, completion, embedding, and streaming spans.
Configuration
The configuration, attributes, and captured-operations below describe the TypeScript AzureOpenAIInstrumentor. In Python, configuration lives on the OpenAI instrumentation — see the OpenAI SDK tracing page.
Attributes
With propagateAttributes
Override per-request attributes using a context scope.
Captured operations
AzureOpenAI.chat.completions.create()AzureOpenAI.completions.create()AzureOpenAI.embeddings.create()- Streaming chat and text completion calls
- Legacy
@azure/openaiOpenAIClientchat, completion, embedding, and streaming methods