Skip to content

feat: add Python Azure OpenAI instrumentation package#156

Open
louayboukhris wants to merge 1 commit into
future-agi:mainfrom
louayboukhris:feat/python-azure-openai-integration
Open

feat: add Python Azure OpenAI instrumentation package#156
louayboukhris wants to merge 1 commit into
future-agi:mainfrom
louayboukhris:feat/python-azure-openai-integration

Conversation

@louayboukhris

@louayboukhris louayboukhris commented Apr 17, 2026

Copy link
Copy Markdown

Add traceai-azure-openai package for tracing Azure OpenAI API calls. This brings Python parity with the existing Java Azure OpenAI integration.

  • AzureOpenAIInstrumentor for auto-instrumenting AzureOpenAI/AsyncAzureOpenAI clients
  • Azure-specific attributes: deployment name, API version, endpoint
  • Chat completions, embeddings, and completions tracing
  • Streaming and async support
  • Unit tests (7 tests) and usage examples

Pull Request

Description

tracing Azure OpenAI API calls

Add traceai-azure-openai package for tracing Azure OpenAI API calls.
This brings Python parity with the existing Java Azure OpenAI integration.

- AzureOpenAIInstrumentor for auto-instrumenting AzureOpenAI/AsyncAzureOpenAI clients
- Azure-specific attributes: deployment name, API version, endpoint
- Chat completions, embeddings, and completions tracing
- Streaming and async support
- Unit tests (7 tests) and usage examples
@louayboukhris
louayboukhris marked this pull request as draft April 20, 2026 15:52
@louayboukhris
louayboukhris marked this pull request as ready for review April 20, 2026 15:54
@nik13 nik13 added the enhancement New feature or request label Apr 21, 2026
@abhijaisrivastava15
abhijaisrivastava15 requested review from JayaSurya-27 and removed request for atharva-bhange June 24, 2026 13:55
@Phoenix1454

Copy link
Copy Markdown

Nice work on this the streaming and async coverage is solid. One thing I noticed in init.py: _instrument patches openai.OpenAI.request rather than openai.AzureOpenAI.request directly. Since AzureOpenAI inherits from OpenAI this works in isolation, but if someone has both OpenAIInstrumentor and AzureOpenAIInstrumentor active in the same process they'd both be patching the same method on the same base class which could cause double instrumentation or one silently overwriting the other's wrapper. Would wrapping AzureOpenAI.request directly be cleaner so each instrumentor owns its own target?

Also logger = logging.getLogger(name) appears twice in init.py (before and after the try/except block) second one's redundant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants