- }>
+ }>
@@ -368,3 +344,31 @@ function RunDetailPageContent({ workflowRunId }: RunDetailPageProps) {
);
}
+
+const Timing = ({ workflow }: { workflow: V1WorkflowRun }) => {
+ const timings: JSX.Element[] = [
+
+ Created
+
+ ,
+
+ Started
+
+ ,
+
+ Duration
+
+
+
+ ,
+ ];
+ return (
+
+ {timings}
+
+ );
+};
diff --git a/pkg/repository/v1/olap.go b/pkg/repository/v1/olap.go
index fbc2f8928..c60039240 100644
--- a/pkg/repository/v1/olap.go
+++ b/pkg/repository/v1/olap.go
@@ -1392,6 +1392,8 @@ func (r *OLAPRepositoryImpl) GetTaskTimings(ctx context.Context, tenantId string
// start out by getting a list of task external ids for the workflow run id
rootTaskExternalIds := make([]pgtype.UUID, 0)
+ sevenDaysAgo := time.Now().Add(-time.Hour * 24 * 7)
+ minInsertedAt := time.Now()
rootTasks, err := r.queries.FlattenTasksByExternalIds(ctx, r.readPool, sqlcv1.FlattenTasksByExternalIdsParams{
Externalids: []pgtype.UUID{workflowRunId},
@@ -1404,12 +1406,24 @@ func (r *OLAPRepositoryImpl) GetTaskTimings(ctx context.Context, tenantId string
for _, task := range rootTasks {
rootTaskExternalIds = append(rootTaskExternalIds, task.ExternalID)
+
+ if task.InsertedAt.Time.Before(minInsertedAt) {
+ minInsertedAt = task.InsertedAt.Time
+ }
+ }
+
+ // Setting the maximum lookback period to 7 days
+ // to prevent scanning a zillion partitions on the tasks,
+ // runs, and dags tables.
+ if minInsertedAt.Before(sevenDaysAgo) {
+ minInsertedAt = sevenDaysAgo
}
runsList, err := r.queries.GetRunsListRecursive(ctx, r.readPool, sqlcv1.GetRunsListRecursiveParams{
Taskexternalids: rootTaskExternalIds,
Tenantid: sqlchelpers.UUIDFromStr(tenantId),
Depth: depth,
+ Createdafter: sqlchelpers.TimestamptzFromTime(minInsertedAt),
})
if err != nil {
diff --git a/pkg/repository/v1/sqlcv1/olap.sql b/pkg/repository/v1/sqlcv1/olap.sql
index 1bf782ebb..df370f950 100644
--- a/pkg/repository/v1/sqlcv1/olap.sql
+++ b/pkg/repository/v1/sqlcv1/olap.sql
@@ -1321,6 +1321,8 @@ WITH RECURSIVE all_runs AS (
WHERE
r.tenant_id = @tenantId::uuid
AND ar.depth < @depth::int
+ AND r.inserted_at >= @createdAfter::timestamptz
+ AND t.inserted_at >= @createdAfter::timestamptz
)
SELECT
tenant_id,
diff --git a/pkg/repository/v1/sqlcv1/olap.sql.go b/pkg/repository/v1/sqlcv1/olap.sql.go
index dd5c290bc..fd008d2be 100644
--- a/pkg/repository/v1/sqlcv1/olap.sql.go
+++ b/pkg/repository/v1/sqlcv1/olap.sql.go
@@ -317,6 +317,8 @@ WITH RECURSIVE all_runs AS (
WHERE
r.tenant_id = $1::uuid
AND ar.depth < $3::int
+ AND r.inserted_at >= $4::timestamptz
+ AND t.inserted_at >= $4::timestamptz
)
SELECT
tenant_id,
@@ -332,9 +334,10 @@ WHERE
`
type GetRunsListRecursiveParams struct {
- Tenantid pgtype.UUID `json:"tenantid"`
- Taskexternalids []pgtype.UUID `json:"taskexternalids"`
- Depth int32 `json:"depth"`
+ Tenantid pgtype.UUID `json:"tenantid"`
+ Taskexternalids []pgtype.UUID `json:"taskexternalids"`
+ Depth int32 `json:"depth"`
+ Createdafter pgtype.Timestamptz `json:"createdafter"`
}
type GetRunsListRecursiveRow struct {
@@ -347,7 +350,12 @@ type GetRunsListRecursiveRow struct {
}
func (q *Queries) GetRunsListRecursive(ctx context.Context, db DBTX, arg GetRunsListRecursiveParams) ([]*GetRunsListRecursiveRow, error) {
- rows, err := db.Query(ctx, getRunsListRecursive, arg.Tenantid, arg.Taskexternalids, arg.Depth)
+ rows, err := db.Query(ctx, getRunsListRecursive,
+ arg.Tenantid,
+ arg.Taskexternalids,
+ arg.Depth,
+ arg.Createdafter,
+ )
if err != nil {
return nil, err
}