feat: custom telemetry configuration

This commit is contained in:
Abhishek Kumar 2026-03-23 11:36:39 +05:30
parent 1967a71935
commit affb39e57f
23 changed files with 927 additions and 139 deletions

View file

@ -365,13 +365,22 @@ class CampaignClient(BaseDBClient):
result = await session.execute(query)
return list(result.scalars().all())
async def get_completed_runs_for_report(
self, campaign_id: int
) -> list[WorkflowRunModel]:
"""Get completed workflow runs with call duration for campaign report CSV."""
async def get_completed_runs_for_report(self, campaign_id: int) -> list:
"""Get completed workflow runs for campaign report CSV.
Returns rows with only the columns needed for report generation.
"""
async with self.async_session() as session:
query = (
select(WorkflowRunModel)
select(
WorkflowRunModel.id,
WorkflowRunModel.created_at,
WorkflowRunModel.initial_context,
WorkflowRunModel.gathered_context,
WorkflowRunModel.cost_info,
WorkflowRunModel.logs,
WorkflowRunModel.public_access_token,
)
.where(
WorkflowRunModel.campaign_id == campaign_id,
WorkflowRunModel.is_completed.is_(True),
@ -379,14 +388,10 @@ class CampaignClient(BaseDBClient):
.as_string()
.isnot(None),
)
.order_by(
WorkflowRunModel.cost_info["call_duration_seconds"]
.as_float()
.desc()
)
.order_by(WorkflowRunModel.created_at.desc())
)
result = await session.execute(query)
return list(result.scalars().all())
return list(result.all())
async def create_queued_run(
self,