Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions apps/web/src/api/warehouse/services.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,4 +289,16 @@ describe("getServiceOverview throughput resolution", () => {
])
}),
)

// Live clock: the TestClock sits at epoch 0, where the fallback window has no positive start.
it.live("divides by the default 24h window it queried when no range is passed", () =>
Effect.gen(function* () {
setActiveOrgId("overview-default-window")
const { data } = yield* getServiceOverview({ data: {} })

// 100 spans over the 24h fallback window, not over a 1h fallback duration.
const expected = 100 / (24 * 3600)
assert.ok(Math.abs(data[0].throughput - expected) < 1e-9, `throughput=${data[0].throughput}`)
}),
)
})
4 changes: 3 additions & 1 deletion apps/web/src/api/warehouse/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ const getServiceOverviewEffect = Effect.fn("QueryEngine.getServiceOverview")(fun
)

return {
data: coerceServiceOverviewRows(result.data, windowDurationSeconds(input.startTime, input.endTime)),
// The window the query actually ran on: the raw inputs fall back to 3600s,
// which would turn a 24h default window into a 24x-inflated rate.
data: coerceServiceOverviewRows(result.data, windowDurationSeconds(startTime, endTime)),
}
})

Expand Down
Loading