You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today, mellea/core/base.py:520–541 reaches into mot._meta["_telemetry_span"], calls set_span_error / end_backend_span, and then fires the generation_error hook. This means:
Core code knows about tracing internals.
Any tracing plugin hooking generation_error would find the span already closed.
After PR #1036 lands, the error-path closure is consolidated through finalize_backend_span(error=...) but still lives in core/base.py. Once #1045 lands, tracing plugins should own error-path span closure.
Scope
Remove the tracing-specific block from core/base.py entirely.
Handle error-path span closure inside BackendTracingPlugin (or a dedicated ErrorTracingPlugin if cleaner) via the generation_error hook.
Retire or internalize finalize_backend_span as part of this move — its logic becomes plugin-internal rather than a helper called from core/base.py.
Background
Today,
mellea/core/base.py:520–541reaches intomot._meta["_telemetry_span"], callsset_span_error/end_backend_span, and then fires thegeneration_errorhook. This means:generation_errorwould find the span already closed.After PR #1036 lands, the error-path closure is consolidated through
finalize_backend_span(error=...)but still lives incore/base.py. Once #1045 lands, tracing plugins should own error-path span closure.Scope
core/base.pyentirely.BackendTracingPlugin(or a dedicatedErrorTracingPluginif cleaner) via thegeneration_errorhook.finalize_backend_spanas part of this move — its logic becomes plugin-internal rather than a helper called fromcore/base.py.ERRORwithrecord_exception()so semconv-compliant receivers see it correctly. This overlaps with the error-status gap addressed by feat(telemetry): close five OTel GenAI semantic convention emission gaps (#1035) #1036.Phase & dependencies
Phase 1 (foundation). Depends on #1045. Likely lands in the same PR as #1045 and {{NEW-B}}.
Acceptance criteria
mellea/core/base.pyno longer imports anything frommellea.telemetry.tracingorbackend_instrumentation.finalize_backend_spanis either deleted or made plugin-internal.Parent epic: #444