MCPcopy Create free account
hub / github.com/ShipSecAI/studio / getEventTimeRange

Method getEventTimeRange

backend/src/trace/trace.repository.ts:151–168  ·  view source on GitHub ↗

* Get the first and last event timestamps for a run to calculate accurate duration

(
    runId: string,
    organizationId?: string | null,
  )

Source from the content-addressed store, hash-verified

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);

Callers 1

buildRunSummaryMethod · 0.80

Calls 2

buildRunFilterMethod · 0.95
fromMethod · 0.80

Tested by

no test coverage detected