MCPcopy Create free account
hub / github.com/AgentOps-AI/agentops / get_sessions_as_traces

Function get_sessions_as_traces

app/api/agentops/exporter/processor.py:249–258  ·  view source on GitHub ↗

Get sessions and convert them to traces with parallel processing

(offset: int, limit: int)

Source from the content-addressed store, hash-verified

247
248
249async def get_sessions_as_traces(offset: int, limit: int) -> AsyncGenerator[Trace, None]:
250 """Get sessions and convert them to traces with parallel processing"""
251 sessions = await get_sessions(offset, limit)
252 for i in range(0, len(sessions), PARALLEL_READS):
253 batch = sessions[i : i + PARALLEL_READS]
254 tasks = [asyncio.create_task(get_session_as_trace(session)) for session in batch]
255 for task in asyncio.as_completed(tasks):
256 trace = await task
257 print(trace.id)
258 yield trace
259
260
261# Cache for session_id to project_id mapping

Callers 1

process_pageFunction · 0.85

Calls 2

get_sessionsFunction · 0.85
get_session_as_traceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…