Skip to content

feat: implement OpenInference tracing for Responses API output types - #2061

Open
nuthalapativarun wants to merge 6 commits into
envoyproxy:mainfrom
nuthalapativarun:feat/tracing-response-output-types
Open

feat: implement OpenInference tracing for Responses API output types#2061
nuthalapativarun wants to merge 6 commits into
envoyproxy:mainfrom
nuthalapativarun:feat/tracing-response-output-types

Conversation

@nuthalapativarun

Copy link
Copy Markdown
Contributor

Description

Implement span attribute population for 11 output item types in the OpenAI Responses API tracing layer (internal/tracing/openinference/openai/response_attrs.go) that were previously no-ops with TODO comments.

The following types now emit OpenInference-compatible span attributes following the same HideOutputText redaction pattern used by existing handlers:

  • image_generation_call — ID and type
  • code_interpreter_call — ID, type, and code as arguments
  • local_shell_call — CallID, type, and command array as arguments
  • mcp_call — ID, tool name, and arguments
  • mcp_list_tools — ID and type
  • mcp_approval_request — ID, tool name, and arguments
  • shell_call — CallID, type, and commands array as arguments
  • shell_call_output — CallID and type (role=tool)
  • apply_patch_call — CallID and type
  • apply_patch_call_output — CallID, type, and output (role=tool)
  • compaction — ID and type

Unit tests added for all new attribute setter functions (2 test cases each: normal and HideOutputText).

Note: this code was written with AI assistance (Claude Code).

Related Issues/PRs (if applicable)

No linked issue — these are TODO comments left in the codebase referencing the Python OpenInference instrumentation library as the specification.

Special notes for reviewers (if applicable)

Each implementation follows the reference Python implementation linked in the original TODO comments:
https://github.com/Arize-ai/openinference/blob/f6561ca5a169f13d5b40120311b782348550b5ac/python/instrumentation/openinference-instrumentation-openai/src/openinference/instrumentation/openai/_attributes/_responses_api.py

Implement span attribute population for the output item types that were
previously no-ops with TODO comments in setResponseOutputAttrs:

- image_generation_call: ID and type as tool call attributes
- code_interpreter_call: ID, type, and code as arguments
- local_shell_call: CallID, type, and command array as arguments
- mcp_call: ID, tool name, and arguments
- mcp_list_tools: ID and type
- mcp_approval_request: ID, tool name, and arguments
- shell_call: CallID, type, and commands array as arguments
- shell_call_output: CallID and type (role=tool)
- apply_patch_call: CallID and type
- apply_patch_call_output: CallID, type, and output (role=tool)
- compaction: ID and type

Each function follows the existing HideOutputText redaction pattern.
Unit tests added for all new attribute setter functions.

Note: this code was written with AI assistance (Claude Code).
Signed-off-by: Varun Nuthalapati <nuthalapativarun@gmail.com>
@nuthalapativarun
nuthalapativarun requested a review from a team as a code owner April 16, 2026 16:24
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Apr 16, 2026
…e output handlers

Signed-off-by: Varun Nuthalapati <nuthalapativarun@gmail.com>
@codecov-commenter

codecov-commenter commented Apr 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.51%. Comparing base (3d3d346) to head (8db119e).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2061      +/-   ##
==========================================
+ Coverage   84.41%   84.51%   +0.10%     
==========================================
  Files         134      134              
  Lines       19064    19280     +216     
==========================================
+ Hits        16092    16295     +203     
- Misses       1991     1998       +7     
- Partials      981      987       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nuthalapativarun

Copy link
Copy Markdown
Contributor Author

Friendly ping — CI is green and coverage is up (+1.56%). Happy to address any feedback when you get a chance to review.

@nuthalapativarun

Copy link
Copy Markdown
Contributor Author

Investigated the CI failures. Both failures are unrelated to the feature code -- they are flaky infrastructure failures:

1. Data Plane MCP Test (macos-latest) -- TestPublicMCPServers failed because the external Kiwi MCP service returned HTTP 404 at the time the test ran. The sister PR #2062 ran minutes later and the same test passed -- confirming this was a transient external-service failure.

2. E2E Test for Inference Extensions -- Timed out waiting for InferencePool to become Accepted (300s timeout). This is a known infrastructure flake. The test also passed on the sister PR #2062 in the same CI run batch.

The feature code (internal/tracing/openinference/openai/response_attrs.go and its test file) is correct and unchanged. Pushed an empty commit to retrigger CI.

Signed-off-by: Varun Nuthalapati <nuthalapativarun@gmail.com>
@nuthalapativarun
nuthalapativarun force-pushed the feat/tracing-response-output-types branch from 779cdf0 to 8db119e Compare May 29, 2026 05:05
@missBerg missBerg added the area/observability Metrics, tracing, logging, GenAI observability label Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/observability Metrics, tracing, logging, GenAI observability size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants