feat: implement OpenInference tracing for Responses API output types - #2061
feat: implement OpenInference tracing for Responses API output types#2061nuthalapativarun wants to merge 6 commits into
Conversation
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>
…e output handlers Signed-off-by: Varun Nuthalapati <nuthalapativarun@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
Friendly ping — CI is green and coverage is up (+1.56%). Happy to address any feedback when you get a chance to review. |
|
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>
779cdf0 to
8db119e
Compare
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
HideOutputTextredaction pattern used by existing handlers:image_generation_call— ID and typecode_interpreter_call— ID, type, and code as argumentslocal_shell_call— CallID, type, and command array as argumentsmcp_call— ID, tool name, and argumentsmcp_list_tools— ID and typemcp_approval_request— ID, tool name, and argumentsshell_call— CallID, type, and commands array as argumentsshell_call_output— CallID and type (role=tool)apply_patch_call— CallID and typeapply_patch_call_output— CallID, type, and output (role=tool)compaction— ID and typeUnit 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