(
runId: string,
type: TraceEventType,
organizationId?: string | null,
)
| 132 | } |
| 133 | |
| 134 | async countByType( |
| 135 | runId: string, |
| 136 | type: TraceEventType, |
| 137 | organizationId?: string | null, |
| 138 | ): Promise<number> { |
| 139 | const runFilter = this.buildRunFilter(runId, organizationId); |
| 140 | const [result] = await this.db |
| 141 | .select({ value: sql<number>`count(*)` }) |
| 142 | .from(workflowTracesTable) |
| 143 | .where(and(runFilter, eq(workflowTracesTable.type, type))); |
| 144 | |
| 145 | return Number(result?.value ?? 0); |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * Get the first and last event timestamps for a run to calculate accurate duration |
no test coverage detected