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

Function assign_correct_project_id

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

Assign the correct project id to each row

(span_id: str, project_id: str)

Source from the content-addressed store, hash-verified

329
330
331async def assign_correct_project_id(span_id: str, project_id: str) -> bool:
332 """Assign the correct project id to each row"""
333 clickhouse_client = await get_async_clickhouse()
334 query = """
335 ALTER TABLE otel_2.{table_name}
336 UPDATE ResourceAttributes = mapUpdate(ResourceAttributes, map('agentops.project.id', "{project_id}"))
337 WHERE SpanId = {span_id};
338 """
339 if project_id is None:
340 raise Exception(f"Project id is None for span_id: {span_id}")
341
342 query = query.format(table_name=IMPORT_TABLE_NAME, project_id=project_id, span_id=span_id)
343 result = await clickhouse_client.query(query)
344 if result.rows_affected > 0:
345 return True
346 return False
347
348
349async def count_v2_sourced_rows() -> int:

Callers

nothing calls this directly

Calls 2

get_async_clickhouseFunction · 0.90
formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…