feat(tracing): add TraceReceiver.get_trace_markdown

This commit is contained in:
Ishaan Jaff 2026-09-30 08:07:57 -07:00
parent 66db6ec124
commit b27bc3ae2b
No known key found for this signature in database

View file

@ -25,6 +25,7 @@ from litellm.constants import (
from litellm.integrations.clickhouse.clickhouse_client import ClickHouseClient
from litellm.integrations.clickhouse.schema import ensure_schema
from litellm.tracing.decode import decode_otlp
from litellm.tracing.markdown import trace_to_markdown
from litellm.tracing.store import ClickHouseTraceStore
from litellm.tracing.types import (
SpanDetail,
@ -121,5 +122,12 @@ class TraceReceiver:
async def get_trace(self, trace_id: str, scope: TraceScope) -> Trace | None:
return await self.store.get_trace(trace_id, scope)
async def get_trace_markdown(self, trace_id: str, scope: TraceScope, span_id: str | None = None) -> str | None:
"""The trace (or the subtree under span_id) as Markdown, for pasting into Claude / Codex."""
trace = await self.store.get_trace(trace_id, scope)
if trace is None:
return None
return trace_to_markdown(trace, await self.store.get_span_io(trace_id, scope), span_id)
async def get_span(self, trace_id: str, span_id: str, scope: TraceScope) -> SpanDetail | None:
return await self.store.get_span(trace_id, span_id, scope)