diff --git a/apps/dashboard/components/logs/overview-charts/overview-bar-chart.tsx b/apps/dashboard/components/logs/overview-charts/overview-bar-chart.tsx index 0dce1c44a5..3ad0a095f5 100644 --- a/apps/dashboard/components/logs/overview-charts/overview-bar-chart.tsx +++ b/apps/dashboard/components/logs/overview-charts/overview-bar-chart.tsx @@ -211,7 +211,7 @@ export function OverviewBarChart({
- {payload[0]?.payload?.total} + {formatNumber(payload[0]?.payload?.total)}
@@ -235,7 +235,7 @@ export function OverviewBarChart({
- {payload[0]?.payload?.[item.dataKey]} + {formatNumber(payload[0]?.payload?.[item.dataKey])}
diff --git a/apps/dashboard/components/stats-card/components/chart/stats-chart.tsx b/apps/dashboard/components/stats-card/components/chart/stats-chart.tsx index 24b14cf43d..768db9b1a3 100644 --- a/apps/dashboard/components/stats-card/components/chart/stats-chart.tsx +++ b/apps/dashboard/components/stats-card/components/chart/stats-chart.tsx @@ -7,6 +7,7 @@ import { ChartTooltip, ChartTooltipContent, } from "@/components/ui/chart"; +import { formatNumber } from "@/lib/fmt"; import { Grid } from "@unkey/icons"; import { Bar, BarChart, CartesianGrid, ResponsiveContainer, YAxis } from "recharts"; import { LogsChartError } from "./components/logs-chart-error"; @@ -87,7 +88,7 @@ export function StatsTimeseriesBarChart({
- {payload[0]?.payload?.total} + {formatNumber(payload[0]?.payload?.total)}
diff --git a/apps/dashboard/lib/trpc/routers/utils/granularity.ts b/apps/dashboard/lib/trpc/routers/utils/granularity.ts index 86450339c9..f58b86b60f 100644 --- a/apps/dashboard/lib/trpc/routers/utils/granularity.ts +++ b/apps/dashboard/lib/trpc/routers/utils/granularity.ts @@ -89,9 +89,9 @@ export const getTimeseriesGranularity = ( } else if (timeRange >= MONTH_IN_MS) { granularity = "per3Days"; } else if (timeRange >= WEEK_IN_MS * 2) { - granularity = "per6Hours"; + granularity = "perHour"; } else if (timeRange >= WEEK_IN_MS) { - granularity = "per4Hours"; + granularity = "perHour"; } else { granularity = "perHour"; } @@ -105,13 +105,13 @@ export const getTimeseriesGranularity = ( } else if (timeRange >= HOUR_IN_MS * 16) { granularity = "per2Hours"; } else if (timeRange >= HOUR_IN_MS * 12) { - granularity = "perHour"; + granularity = "per30Minutes"; } else if (timeRange >= HOUR_IN_MS * 8) { granularity = "per30Minutes"; } else if (timeRange >= HOUR_IN_MS * 6) { - granularity = "per30Minutes"; + granularity = "per5Minutes"; } else if (timeRange >= HOUR_IN_MS * 4) { - granularity = "per15Minutes"; + granularity = "per5Minutes"; } else if (timeRange >= HOUR_IN_MS * 2) { granularity = "per5Minutes"; } else { diff --git a/internal/clickhouse/src/keys/active_keys.ts b/internal/clickhouse/src/keys/active_keys.ts index 1548c44613..7ce5919358 100644 --- a/internal/clickhouse/src/keys/active_keys.ts +++ b/internal/clickhouse/src/keys/active_keys.ts @@ -152,7 +152,7 @@ function createActiveKeysTimeseriesQuery(interval: TimeInterval, whereClause: st ORDER BY x ASC WITH FILL FROM toUnixTimestamp64Milli(CAST(toStartOfInterval(toDateTime(fromUnixTimestamp64Milli({startTime: Int64})), INTERVAL ${interval.stepSize} ${intervalUnit}) AS DateTime64(3))) - TO toUnixTimestamp64Milli(CAST(toStartOfInterval(toDateTime(fromUnixTimestamp64Milli({endTime: Int64})), INTERVAL ${interval.stepSize} ${intervalUnit}) AS DateTime64(3))) + TO toUnixTimestamp64Milli(CAST(toStartOfInterval(toDateTime(fromUnixTimestamp64Milli({endTime: Int64})), INTERVAL ${interval.stepSize} ${intervalUnit}) AS DateTime64(3))) + ${stepMs} STEP ${stepMs}`; } diff --git a/internal/clickhouse/src/logs.ts b/internal/clickhouse/src/logs.ts index dda45ea913..4a7b5baf69 100644 --- a/internal/clickhouse/src/logs.ts +++ b/internal/clickhouse/src/logs.ts @@ -293,7 +293,7 @@ function createTimeseriesQuery(interval: TimeInterval, whereClause: string) { ORDER BY x ASC WITH FILL FROM toUnixTimestamp64Milli(CAST(toStartOfInterval(toDateTime(fromUnixTimestamp64Milli({startTime: Int64})), INTERVAL ${interval.stepSize} ${intervalUnit}) AS DateTime64(3))) - TO toUnixTimestamp64Milli(CAST(toStartOfInterval(toDateTime(fromUnixTimestamp64Milli({endTime: Int64})), INTERVAL ${interval.stepSize} ${intervalUnit}) AS DateTime64(3))) + TO toUnixTimestamp64Milli(CAST(toStartOfInterval(toDateTime(fromUnixTimestamp64Milli({endTime: Int64})), INTERVAL ${interval.stepSize} ${intervalUnit}) AS DateTime64(3))) + ${stepMs} STEP ${stepMs}`; } diff --git a/internal/clickhouse/src/ratelimits.ts b/internal/clickhouse/src/ratelimits.ts index 82d7f82f85..498bf5043b 100644 --- a/internal/clickhouse/src/ratelimits.ts +++ b/internal/clickhouse/src/ratelimits.ts @@ -126,7 +126,7 @@ function createTimeseriesQuery(interval: TimeInterval, whereClause: string) { ORDER BY x ASC WITH FILL FROM toUnixTimestamp64Milli(CAST(toStartOfInterval(toDateTime(fromUnixTimestamp64Milli({startTime: Int64})), INTERVAL ${interval.stepSize} ${interval.step}) AS DateTime64(3))) - TO toUnixTimestamp64Milli(CAST(toStartOfInterval(toDateTime(fromUnixTimestamp64Milli({endTime: Int64})), INTERVAL ${interval.stepSize} ${interval.step}) AS DateTime64(3))) + TO toUnixTimestamp64Milli(CAST(toStartOfInterval(toDateTime(fromUnixTimestamp64Milli({endTime: Int64})), INTERVAL ${interval.stepSize} ${intervalUnit}) AS DateTime64(3))) + ${stepMs} STEP ${stepMs}`; } diff --git a/internal/clickhouse/src/verifications.ts b/internal/clickhouse/src/verifications.ts index 1654adbb9c..78423adcf3 100644 --- a/internal/clickhouse/src/verifications.ts +++ b/internal/clickhouse/src/verifications.ts @@ -293,7 +293,7 @@ function createVerificationTimeseriesQuery(interval: TimeInterval, whereClause: ORDER BY x ASC WITH FILL FROM toUnixTimestamp64Milli(CAST(toStartOfInterval(toDateTime(fromUnixTimestamp64Milli({startTime: Int64})), INTERVAL ${interval.stepSize} ${intervalUnit}) AS DateTime64(3))) - TO toUnixTimestamp64Milli(CAST(toStartOfInterval(toDateTime(fromUnixTimestamp64Milli({endTime: Int64})), INTERVAL ${interval.stepSize} ${intervalUnit}) AS DateTime64(3))) + TO toUnixTimestamp64Milli(CAST(toStartOfInterval(toDateTime(fromUnixTimestamp64Milli({endTime: Int64})), INTERVAL ${interval.stepSize} ${intervalUnit}) AS DateTime64(3))) + ${stepMs} STEP ${stepMs}`; } @@ -363,7 +363,6 @@ function getVerificationTimeseriesWhereClause( }; } -// Updated timeseries querier function function createVerificationTimeseriesQuerier(interval: TimeInterval) { return (ch: Querier) => async (args: VerificationTimeseriesParams) => { const { whereClause, paramSchema } = getVerificationTimeseriesWhereClause(args, [