-
Notifications
You must be signed in to change notification settings - Fork 5
[nodejs] Clean up inputs/outputs for InvokeAgent spans based on new OTel format #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request refactors the handling of input messages for InvokeAgent spans to align with a new OpenTelemetry format. Instead of storing the complete input structure and extracting attributes separately, the code now intelligently processes input arrays to extract user text content when available, falling back to the full array JSON when no user messages are present.
Key Changes:
- Introduced a new
buildInputMessagesmethod that extracts text content from user role messages or returns the full array - Removed the previous logic that called
Utils.getAttributesFromInputand set additional attributes from input - Added comprehensive test coverage for both extraction scenarios (user messages present and assistant-only messages)
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
packages/agents-a365-observability-extensions-openai/src/OpenAIAgentsTraceProcessor.ts |
Implements new buildInputMessages method to extract user text content from input arrays, replacing previous attribute extraction logic |
tests/observability/extension/openai/OpenAIAgentsTraceProcessor.test.ts |
Adds two test cases validating the new input message processing behavior for both user and assistant-only scenarios |
tests/observability/extension/openai/OpenAIAgentsTraceProcessor.test.ts
Outdated
Show resolved
Hide resolved
tests/observability/extension/openai/OpenAIAgentsTraceProcessor.test.ts
Outdated
Show resolved
Hide resolved
packages/agents-a365-observability-extensions-openai/src/OpenAIAgentsTraceProcessor.ts
Outdated
Show resolved
Hide resolved
packages/agents-a365-observability-extensions-openai/src/OpenAIAgentsTraceProcessor.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
packages/agents-a365-observability-extensions-openai/src/OpenAIAgentsTraceProcessor.ts
Outdated
Show resolved
Hide resolved
packages/agents-a365-observability-extensions-openai/src/OpenAIAgentsTraceProcessor.ts
Outdated
Show resolved
Hide resolved
packages/agents-a365-observability-extensions-openai/src/OpenAIAgentsTraceProcessor.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| spanData: { | ||
| type: 'response' as const, | ||
| name: 'ResponseArray', | ||
| _input: inputArray, |
Copilot
AI
Jan 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is trailing whitespace after the comma on this line. Remove the extra spaces to maintain consistent formatting.
| _input: inputArray, | |
| _input: inputArray, |
| startedAt: new Date().toISOString(), | ||
| spanData: { | ||
| type: 'response' as const, | ||
| name: 'ResponseArray', |
Copilot
AI
Jan 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test case uses the same span name 'ResponseArray' as the test on line 592. This creates ambiguity in the test suite as both tests access spansByName['ResponseArray']. Use a unique name like 'ResponseArrayNonStandard' to distinguish this test case.
nikhilNava
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you post the before and after for the input / output values?
Clean up inputs/outputs for InvokeAgent spans based on new OTel format