* Get the first and last event timestamps for a run to calculate accurate duration
(
runId: string,
organizationId?: string | null,
)
| 149 | * Get the first and last event timestamps for a run to calculate accurate duration |
| 150 | */ |
| 151 | async getEventTimeRange( |
| 152 | runId: string, |
| 153 | organizationId?: string | null, |
| 154 | ): Promise<{ firstTimestamp: Date | null; lastTimestamp: Date | null }> { |
| 155 | const runFilter = this.buildRunFilter(runId, organizationId); |
| 156 | const [result] = await this.db |
| 157 | .select({ |
| 158 | firstTimestamp: sql<Date>`min(${workflowTracesTable.timestamp})`, |
| 159 | lastTimestamp: sql<Date>`max(${workflowTracesTable.timestamp})`, |
| 160 | }) |
| 161 | .from(workflowTracesTable) |
| 162 | .where(runFilter); |
| 163 | |
| 164 | return { |
| 165 | firstTimestamp: result?.firstTimestamp ?? null, |
| 166 | lastTimestamp: result?.lastTimestamp ?? null, |
| 167 | }; |
| 168 | } |
| 169 | |
| 170 | async getLastSequence(runId: string, organizationId?: string | null): Promise<number> { |
| 171 | const runFilter = this.buildRunFilter(runId, organizationId); |
no test coverage detected