feat: add Python Azure OpenAI instrumentation package#156
Open
louayboukhris wants to merge 1 commit into
Open
Conversation
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
marked this pull request as draft
April 20, 2026 15:52
louayboukhris
marked this pull request as ready for review
April 20, 2026 15:54
abhijaisrivastava15
requested review from
JayaSurya-27
and removed request for
atharva-bhange
June 24, 2026 13:55
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add traceai-azure-openai package for tracing Azure OpenAI API calls. This brings Python parity with the existing Java Azure OpenAI integration.
Pull Request
Description
tracing Azure OpenAI API calls