Skip to content

feat: tool call spans via tool_post_invoke hook #1049

@ajbozarth

Description

@ajbozarth

Background

Tool calls have no tracing today. The tool_post_invoke hook exists (consumed by ToolMetricsPlugin) and is the right attach point. Replaces retired sub-issue #474.

Scope

  • Add a ToolTracingPlugin in tracing_plugins.py that emits a tool.call span on tool_post_invoke (and a companion pre-invoke hook if one exists, or a small prerequisite issue to add one).
  • Attributes: gen_ai.tool.name, gen_ai.tool.call.id (semconv), plus Mellea-specific mellea.tool.arguments_hash, mellea.tool.status.
  • Make tool spans children of the backend generation span when possible.

Phase & dependencies

Phase 2 (coverage). Depends on Phase 1 (#1045, #1046, #1047). Can proceed in parallel with {{NEW-D}}, {{NEW-F}}, {{NEW-G}}, {{NEW-H}}, and with PR #1036 rebased onto Phase 1.

Acceptance criteria

  • Every tool invocation emits a span.
  • Span attributes follow OTel GenAI semconv where defined.

Parent epic: #444

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions