Assign the correct project id to each row
(span_id: str, project_id: str)
| 329 | |
| 330 | |
| 331 | async 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 | |
| 349 | async def count_v2_sourced_rows() -> int: |
nothing calls this directly
no test coverage detected
searching dependent graphs…