Skip to content

feat: sampling, validator, and formatter spans via plugin hooks #1050

@ajbozarth

Description

@ajbozarth

Background

Covers what retired sub-issues #471, #472, #473 were trying to do, rolled into one since the mechanism is identical across all three.

Scope

For each of sampling (BaseSamplingStrategy loop), validator (Requirement.check), and formatter (Formatter.apply / render_prompt / parse_response), add a plugin in tracing_plugins.py that hooks the existing pre/post hooks. The metrics plugins for these already exist (SamplingMetricsPlugin, RequirementMetricsPlugin) — mirror their structure.

  • Use semconv-compliant attribute names where defined; fall back to mellea.* for custom.
  • Each plugin can land as its own PR if preferred (this issue collapses the three only for planning purposes; the implementation can be split if it's cleaner).

Phase & dependencies

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

Acceptance criteria

  • Sampling iteration, requirement check, and formatter pass each produce spans with appropriate parent-child relationships.
  • Tests cover span emission for each component.

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