Skip to content

Commit 796daae

Browse files
committed
time bucket end
1 parent 5650d06 commit 796daae

File tree

1 file changed

+9
-3
lines changed
  • packages/services/api/src/modules/operations/providers

1 file changed

+9
-3
lines changed

packages/services/api/src/modules/operations/providers/traces.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,15 @@ export class Traces {
271271
)
272272
SELECT
273273
replaceOne(concat(toDateTime64("time_bucket_list"."time_bucket", 9, 'UTC'), 'Z'), ' ', 'T') AS "timeBucketStart"
274-
, replaceOne(concat(toDateTime64("t"."time_bucket_end", 9, 'UTC'), 'Z'), ' ', 'T') AS "timeBucketEnd"
274+
, replaceOne(concat(
275+
toDateTime64(
276+
"time_bucket_list"."time_bucket"
277+
+ INTERVAL ${sql.raw(d.candidate.name)}
278+
- INTERVAL 1 SECOND
279+
, 9
280+
, 'UTC'
281+
) , 'Z') , ' ' , 'T'
282+
) AS "timeBucketEnd"
275283
, coalesce("t"."ok_count_total", 0) as "okCountTotal"
276284
, coalesce("t"."error_count_total", 0) as "errorCountTotal"
277285
, coalesce("t"."ok_count_filtered", 0) as "okCountFiltered"
@@ -282,7 +290,6 @@ export class Traces {
282290
(
283291
SELECT
284292
toStartOfInterval("timestamp", INTERVAL ${sql.raw(d.candidate.name)}) AS "time_bucket_start"
285-
, toStartOfInterval("timestamp", INTERVAL ${sql.raw(d.candidate.name)}) + INTERVAL ${sql.raw(d.candidate.name)} - INTERVAL 1 SECOND AS "time_bucket_end"
286293
, sumIf(1, "graphql_error_count" = 0) AS "ok_count_total"
287294
, sumIf(1, "graphql_error_count" != 0) AS "error_count_total"
288295
, sumIf(1, "graphql_error_count" = 0 ${filterSQLFragment}) AS "ok_count_filtered"
@@ -295,7 +302,6 @@ export class Traces {
295302
AND "otel_traces_normalized"."timestamp" <= toDateTime(${formatDate(endDate)}, 'UTC')
296303
GROUP BY
297304
"time_bucket_start"
298-
, "time_bucket_end"
299305
) AS "t"
300306
ON "t"."time_bucket_start" = "time_bucket_list"."time_bucket"
301307
`,

0 commit comments

Comments
 (0)