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
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export function OverviewBarChart({
</div>
<div className="ml-auto">
<span className="font-mono tabular-nums text-accent-12">
{payload[0]?.payload?.total}
{formatNumber(payload[0]?.payload?.total)}
</span>
</div>
</div>
Expand All @@ -235,7 +235,7 @@ export function OverviewBarChart({
</div>
<div className="ml-auto">
<span className="font-mono tabular-nums text-accent-12">
{payload[0]?.payload?.[item.dataKey]}
{formatNumber(payload[0]?.payload?.[item.dataKey])}
</span>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -87,7 +88,7 @@ export function StatsTimeseriesBarChart<T extends BaseTimeseriesData>({
</div>
<div className="ml-auto">
<span className="font-mono tabular-nums text-accent-12">
{payload[0]?.payload?.total}
{formatNumber(payload[0]?.payload?.total)}
</span>
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions apps/dashboard/lib/trpc/routers/utils/granularity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ export const getTimeseriesGranularity = <TContext extends TimeseriesContext>(
} 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";
}
Expand All @@ -105,13 +105,13 @@ export const getTimeseriesGranularity = <TContext extends TimeseriesContext>(
} 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 {
Expand Down
2 changes: 1 addition & 1 deletion internal/clickhouse/src/keys/active_keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
}

Expand Down
2 changes: 1 addition & 1 deletion internal/clickhouse/src/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
}

Expand Down
2 changes: 1 addition & 1 deletion internal/clickhouse/src/ratelimits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
}

Expand Down
3 changes: 1 addition & 2 deletions internal/clickhouse/src/verifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
}

Expand Down Expand Up @@ -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, [
Expand Down
Loading