Skip to content

Add detailed tracing to session operations beyond the current top-level context span #470

@psschwei

Description

@psschwei

Description:
Add detailed tracing to session operations beyond the current top-level context span.

Detailed Requirements:

  1. Add spans for key session methods:
    • session.act - Action execution
    • session.instruct - Instruction-based generation
    • session.chat - Chat interactions
    • session.validate - Requirement validation
    • session.sample - Sampling orchestration
  2. Add attributes:
    • action_type - Type of action being executed
    • instruction - Truncated instruction text (if privacy allows)
    • validator_count - Number of validators
    • strategy - Sampling strategy name
  3. Maintain parent-child span relationships
  4. Use existing trace_application helper

Files to Modify:

  • mellea/stdlib/session.py - Add spans to methods
  • mellea/core/mfuncs.py - Instrument core functions if applicable

Span Hierarchy Example:

session_context (existing)
├── session.instruct
│   ├── backend.request
│   └── formatter.apply
├── session.validate
│   └── validator.check (per validator)
└── session.sample
    ├── sampler.iterate
    └── ...

Acceptance Criteria:

  • All session methods have corresponding spans
  • Spans correctly nested under session context
  • Relevant attributes captured
  • No performance impact when tracing disabled

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions