Repository navigation
OpenAI instrumentation - #14
Merged
Hector Hernandez (hectorhdzg) merged 6 commits intoApr 17, 2026
Merged
Hector Hernandez (hectorhdzg) merged 6 commits into
Hector Hernandez (hectorhdzg) merged 6 commits into
Conversation
# Conflicts: # package-lock.json # package.json
Hector Hernandez (hectorhdzg)
requested review from
Jackson Weber (JacksonWeber),
Nev (MSNev),
Leighton Chen (lzchen) and
Radhika Gupta (rads-1996)
as code owners
April 11, 2026 03:45
Copilot started reviewing on behalf of
Hector Hernandez (hectorhdzg)
April 11, 2026 03:47
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Adds OpenAI Agents SDK instrumentation to the GenAI module so OpenAI Agents spans can be converted into OpenTelemetry spans with GenAI semantic-convention attributes, with accompanying unit/functional tests and a usage sample.
Changes:
- Introduces OpenAI Agents trace processor + instrumentor (registration via
@openai/agentstrace processors). - Adds OpenAI-specific utils/semconv helpers for span naming, attribute extraction, and content-gating.
- Adds unit + functional tests and a new sample demonstrating instrumentation usage; updates changelog and dependencies.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| test/internal/unit/genai/openai/utils.test.ts | Unit coverage for OpenAI utils/semconv attribute extraction & helpers. |
| test/internal/unit/genai/openai/openAIAgentsTraceProcessor.test.ts | Unit coverage for processor span lifecycle + attribute stamping. |
| test/internal/unit/genai/openai/openAIAgentsTraceInstrumentor.test.ts | Unit coverage for instrumentor singleton lifecycle and config acceptance. |
| test/internal/functional/openai.test.ts | End-to-end functional test using InMemorySpanExporter validating emitted spans/attributes. |
| src/genai/instrumentations/openai/utils.ts | Adds OpenAI Agents span parsing utilities and content-key remapping helpers. |
| src/genai/instrumentations/openai/semconv.ts | Defines OpenAI-specific constants (span-kind classifiers and content keys). |
| src/genai/instrumentations/openai/openAIAgentsTraceProcessor.ts | Core processor mapping Agents SDK callbacks to OTel spans + GenAI attributes. |
| src/genai/instrumentations/openai/openAIAgentsTraceInstrumentor.ts | Instrumentation wrapper to register/enable/disable the processor with @openai/agents. |
| src/genai/instrumentations/openai/index.ts | Exposes OpenAI instrumentation entry points. |
| samples/src/openaiInstrumentation.ts | Sample demonstrating enabling OpenAI Agents instrumentation in the distro. |
| samples/README.md | Links the new OpenAI sample in the samples index. |
| samples/package.json | Adds @openai/agents dependency for running the sample. |
| package.json | Adds @openai/agents dev dependency for repo builds/tests. |
| package-lock.json | Locks newly added OpenAI Agents dependency tree. |
| CHANGELOG.md | Notes the new OpenAI Agents SDK instrumentation feature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| this.processor = new OpenAIAgentsTraceProcessor(this.otelTracer, { | ||
| suppressInvokeAgentInput: this._config.suppressInvokeAgentInput ?? false, | ||
| isContentRecordingEnabled: this._config.isContentRecordingEnabled ?? false, |
There was a problem hiding this comment.
Is the equivalent of the env variable that python sets - OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT
Leighton Chen (lzchen)
approved these changes
Apr 17, 2026
Hector Hernandez (hectorhdzg)
merged commit Apr 17, 2026
ac0b255
into
microsoft:main
5 checks passed
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.
No description provided.