Version: opentelemetry-util-genai 1.1b0 (_tool_invocation.py:120).
What happens. InferenceInvocation._apply_finish and WorkflowInvocation._apply_finish
call _call_completion_hook(...) before ending the span, so a CompletionHook registered through
the opentelemetry_genai_completion_hook entry point (the documented way to add redaction or
upload) sees inference and workflow content. ToolInvocation._apply_finish writes
gen_ai.tool.call.arguments and gen_ai.tool.call.result and ends the span without calling the
hook, so tool content bypasses every hook, including redaction.
Reproduce. Register a hook that records every call; run handler.tool("t") with
arguments={"token": "sk-..."}; the hook is never called and the attribute reaches the exporter.
Suggested fix. Call _call_completion_hook from ToolInvocation._apply_finish with the
arguments and result as inputs/outputs (or add a dedicated hook method for tools), consistently
with the other invocation types.
Version:
opentelemetry-util-genai1.1b0 (_tool_invocation.py:120).What happens.
InferenceInvocation._apply_finishandWorkflowInvocation._apply_finishcall
_call_completion_hook(...)before ending the span, so aCompletionHookregistered throughthe
opentelemetry_genai_completion_hookentry point (the documented way to add redaction orupload) sees inference and workflow content.
ToolInvocation._apply_finishwritesgen_ai.tool.call.argumentsandgen_ai.tool.call.resultand ends the span without calling thehook, so tool content bypasses every hook, including redaction.
Reproduce. Register a hook that records every call; run
handler.tool("t")witharguments={"token": "sk-..."}; the hook is never called and the attribute reaches the exporter.Suggested fix. Call
_call_completion_hookfromToolInvocation._apply_finishwith thearguments and result as inputs/outputs (or add a dedicated hook method for tools), consistently
with the other invocation types.