feat(node): Add tracing support for AzureOpenAI#18281
feat(node): Add tracing support for AzureOpenAI#18281nicohrubec merged 4 commits intogetsentry:developfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request adds tracing support for the Azure OpenAI client in addition to the existing OpenAI client support, resolving issue #18280.
Key Changes:
- Extended the OpenAI instrumentation to also patch
AzureOpenAIclient constructor - Added test coverage for Azure OpenAI client in both default and v6 test suites
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
packages/node/src/integrations/tracing/openai/instrumentation.ts |
Refactored patching logic to support both OpenAI and AzureOpenAI clients by extracting common wrapping logic into a reusable _patchClient method |
dev-packages/node-integration-tests/suites/tracing/openai/v6/test.ts |
Added test case for Azure OpenAI client with v6 OpenAI SDK |
dev-packages/node-integration-tests/suites/tracing/openai/v6/scenario-azure-openai.mjs |
Created test scenario that instantiates and uses AzureOpenAI client with mock server for v6 |
dev-packages/node-integration-tests/suites/tracing/openai/test.ts |
Added test case for Azure OpenAI client with default OpenAI SDK version |
dev-packages/node-integration-tests/suites/tracing/openai/scenario-azure-openai.mjs |
Created test scenario that instantiates and uses AzureOpenAI client with mock server |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/node/src/integrations/tracing/openai/instrumentation.ts
Outdated
Show resolved
Hide resolved
packages/node/src/integrations/tracing/openai/instrumentation.ts
Outdated
Show resolved
Hide resolved
RulaKhaled
left a comment
There was a problem hiding this comment.
Very nice, thanks for contributing!
As an improvement, we soon will tweak this a little to allow users to differentiate between azure and vanilla openai, but this is fine for now.
I’m not sure how to move forward with this PR. There are what I believe to be random test failures. |
@bignoncedric Some of our tests flake from time to time. I triggered a rerun and now everything passes, so feel free to merge anytime! |
I may be lost in GitHub UI, but it looks like I can't merge it. I only see the "Update branch" button. |
Ah, no you are right my bad. I'll merge this in a sec, thanks for contributing! |
This PR adds the external contributor to the CHANGELOG.md file, so that they are credited for their contribution. See #18281 Co-authored-by: nicohrubec <29484629+nicohrubec@users.noreply.github.com>

This pull request adds the support to Azure OpenAI client in addition to the existing support of the vanilla OpenAI client.
Fixes issue #18280