mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-06 02:48:13 +00:00
feat(tracing): add TraceReceiver.get_trace_markdown
This commit is contained in:
parent
66db6ec124
commit
b27bc3ae2b
1 changed files with 8 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue