Skip to content

Commit 15a3b2e

Browse files
authored
fix(dashboard): broken InfluxDB query on trigger count (#241)
Because - The `GET https://api.instill.tech/v1beta/metrics/vdp/pipeline/tables` endpoint (for relatively large datasets and time ranges) returned the following error: ``` message: "Invalid query: internal error: panic: arrow/array: index out of range" ``` - The culprit was the `max` function used in the [InfluxDB query](https://github.com/instill-ai/mgmt-backend/blob/main/pkg/repository/influx.go#L186). This commit - Replaces the `max` function by `sort` + `first`, which don't produce the error.
1 parent 7d16977 commit 15a3b2e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/repository/influx.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ func (i *influxDB) QueryPipelineTriggerTableRecords(ctx context.Context, owner s
183183
)
184184
|> group(columns: ["pipeline_uid"])
185185
|> map(fn: (r) => ({r with trigger_time: time(v: r.trigger_time)}))
186-
|> max(column: "trigger_time")
186+
|> sort(columns: ["trigger_time"], desc: true)
187+
|> first(column: "trigger_time")
187188
|> rename(columns: {trigger_time: "most_recent_trigger_time"})
188189
triggerCount =
189190
base

0 commit comments

Comments
 (0)