Skip to content

feat: session and act spans via plugin hooks #1048

Closed

Description

@ajbozarth

Background

Session-level and act-level spans are currently emitted via direct trace_application(...) calls in mellea/stdlib/session.py and mellea/stdlib/functional.py. This leaks tracing concerns into stdlib.

Replaces retired sub-issue #470.

Scope

Phase & dependencies

Phase 2 (coverage). Depends on Phase 1 (#1045, #1046, #1047). Can proceed in parallel with #1049, #1050, #1051, #1052, and with PR #1036 rebased onto Phase 1.

Acceptance criteria

  • mellea/stdlib/ no longer imports from mellea.telemetry.tracing.
  • Session → aact → backend span hierarchy preserved.
  • Tests cover parent-child span relationships.

Parent epic: #444

Activity

  1. added
    area/stdlib
    area/telemetry
    enhancement
    on May 20, 2026
  2. self-assigned this
    on Jun 3, 2026
  3. ajbozarth commented on Jun 8, 2026

    @ajbozarth
    MemberAuthor

    While going through PR #1181 review, surfaced a privacy bug from
    @planetf1 that's in scope for this issue:

    mellea.response (set in aact at stdlib/functional.py:707) currently
    captures up to 500 chars of model output unconditionally — it doesn't gate
    on is_content_tracing_enabled() / MELLEA_TRACES_CONTENT. Pre-existing
    leak, but PR #1181 makes MELLEA_TRACES_CONTENT user-visible in the docs,
    which turns this from undocumented behavior into a documented broken
    contract.

    Disposition: not fixing in #1181 because the inline emission code is what
    this issue replaces. When moving aact span emission to the new plugin,
    the mellea.response capture should be gated on
    is_content_tracing_enabled(). mellea.response_length is fine to keep
    ungated (a non-content metric).

    Original review comment: #1181 (comment)

  4. planetf1 commented on Jun 9, 2026

    @planetf1
    Contributor

    While reviewing PR #1181, two related findings were deferred here that aren't currently reflected in the acceptance criteria:

    1. is_content_tracing_enabled() is defined and exported but never called anywhere in the codebase. Setting MELLEA_TRACES_CONTENT=true or OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=true has no effect.
    2. mellea.response is set unconditionally on every aact span in stdlib/functional.py, regardless of whether the operator has opted in to content capture.

    When the aact span emission moves to a plugin in this issue, the fix is natural: check is_content_tracing_enabled() before setting mellea.response (and mellea.prompt if that gets added). Worth adding to the acceptance criteria so it doesn't slip through.

  5. added 3 commits that reference this issue on Jun 17, 2026
    76c5538
    ab9c6b5
    c870348
  6. added
    p2
    on Jun 18, 2026
  7. added a commit that references this issue on Jun 22, 2026
    17fb232
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/stdlibarea/telemetryenhancementp2refactor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions