Skip to content

[bot] Add instrumentation for Azure OpenAI Go SDK (azure-sdk-for-go/sdk/ai/azopenai) #153

@braintrust-bot

Description

@braintrust-bot

Summary

The Braintrust Go SDK instruments OpenAI, Anthropic, Google GenAI, sashabaranov/go-openai, LangChainGo, Firebase Genkit, Google ADK, CloudWeGo Eino, and AWS Bedrock — but does not instrument the Azure OpenAI standalone Go SDK (github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai). Azure is explicitly listed as a supported provider in Braintrust's tracing documentation, yet there is no SDK-level instrumentation wrapper for Go in this repository.

Importantly, azopenai is a standalone client — it does not use openai-go under the hood. It has its own Client type and its own HTTP transport, so the existing trace/contrib/openai middleware (which hooks into openai-go via option.WithMiddleware()) does not cover azopenai calls.

What is missing

A trace/contrib/azopenai/ integration module that wraps execution calls on the azopenai Go client. The key execution surfaces are:

  • GetChatCompletions / GetChatCompletionsStream — conversational model inference (non-streaming and streaming), including tool use and structured outputs
  • GetEmbeddings — vector embedding generation
  • GetCompletions / GetCompletionsStream — legacy text completions

The azopenai client supports both Azure Active Directory (via azidentity) and API key authentication, with Azure-specific endpoints and API versions. Instrumentation could wrap the client's http.Client (similar to the genai integration pattern) or use Azure SDK pipeline middleware hooks.

Braintrust docs status

supported — Braintrust explicitly lists Azure as a supported provider for tracing:

"OpenAI, Anthropic, Gemini, AWS Bedrock, Azure, Mistral, Together, Groq, and many more"

Source: https://www.braintrust.dev/docs/guides/tracing and https://www.braintrust.dev/docs/instrument

Azure OpenAI Service is also acknowledged in the Braintrust AI provider configuration docs. However, there is no Go SDK-level tracing wrapper for azopenai in this repository.

Upstream sources

Braintrust docs sources

Local repo files inspected

  • go.mod — no azure-sdk-for-go/sdk/ai/azopenai dependency
  • trace/contrib/ — no azopenai/ or azure/ directory exists
  • trace/contrib/all/all.go — no Azure OpenAI import
  • trace/contrib/all/go.mod — no azure-sdk-for-go dependency
  • examples/ — no Azure OpenAI example
  • trace/contrib/openai/traceopenai.go — middleware hooks into openai-go via option.WithMiddleware(), which does not apply to the standalone azopenai client
  • trace/contrib/genai/tracegenai.go — reference pattern for HTTP transport wrapping (applicable since azopenai accepts a custom *http.Client)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions