Skip to content

Commit f502206

Browse files
committed
chore: apply oxfmt formatting
1 parent 67b91ec commit f502206

15 files changed

Lines changed: 448 additions & 262 deletions

File tree

apps/webapp/app/presenters/v3/BuiltInDashboards.server.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,11 @@ const queuesDashboard: BuiltInDashboard = {
635635
pressure: {
636636
title: "Queue pressure",
637637
query: `SELECT queue,\n argMax(max_running, bucket_start) AS running,\n argMax(max_queued, bucket_start) AS queued,\n argMax(max_limit, bucket_start) AS limit,\n running + queued AS demand,\n max(max_queued) AS peak_queued,\n sum(throttled_count) AS throttled,\n multiIf(running >= limit AND queued > 0, 'queue-limited', queued > 0, 'backlogged', 'healthy') AS status\nFROM queue_metrics\nGROUP BY queue\nORDER BY peak_queued DESC`,
638-
display: { type: "table", prettyFormatting: true, sorting: [{ id: "peak_queued", desc: true }] },
638+
display: {
639+
type: "table",
640+
prettyFormatting: true,
641+
sorting: [{ id: "peak_queued", desc: true }],
642+
},
639643
},
640644
"t-trends": { title: "Per-queue trends", query: "", display: { type: "title" } },
641645
"running-q": {

apps/webapp/app/presenters/v3/QueueMetricsPresenter.server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ export class QueueMetricsPresenter {
5858
const bucketSeconds = Math.max(60, Math.round(windowSeconds / SPARKLINE_POINTS));
5959
const numBuckets = Math.ceil(windowSeconds / bucketSeconds);
6060
const nowSeconds = Math.floor(Date.now() / 1000);
61-
const gridStartSeconds = Math.floor((nowSeconds - windowSeconds) / bucketSeconds) * bucketSeconds;
61+
const gridStartSeconds =
62+
Math.floor((nowSeconds - windowSeconds) / bucketSeconds) * bucketSeconds;
6263
const bucketStartMs = gridStartSeconds * 1000;
6364
const bucketIntervalMs = bucketSeconds * 1000;
6465

@@ -144,5 +145,4 @@ export class QueueMetricsPresenter {
144145
return empty;
145146
}
146147
}
147-
148148
}

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.dashboards.$dashboardKey/route.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => {
5353

5454
// The built-in "queues" dashboard is part of the metrics UI (unlinked, but reachable by
5555
// URL), so gate it per-org like the rest of the Queue Metrics view.
56-
if (dashboardKey === "queues" && !(await canAccessQueueMetricsUi({ userId: user.id, organizationSlug }))) {
56+
if (
57+
dashboardKey === "queues" &&
58+
!(await canAccessQueueMetricsUi({ userId: user.id, organizationSlug }))
59+
) {
5760
throw new Response(undefined, { status: 404, statusText: "Not found" });
5861
}
5962

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.queues/route.tsx

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,11 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => {
109109
const { organizationSlug, projectParam, envParam } = EnvironmentParamSchema.parse(params);
110110

111111
const url = new URL(request.url);
112-
const { page, query, period: rawPeriod } = SearchParamsSchema.parse(
113-
Object.fromEntries(url.searchParams)
114-
);
112+
const {
113+
page,
114+
query,
115+
period: rawPeriod,
116+
} = SearchParamsSchema.parse(Object.fromEntries(url.searchParams));
115117
const period: QueueMetricsWindow = isQueueMetricsWindow(rawPeriod) ? rawPeriod : "24h";
116118

117119
const project = await findProjectBySlug(organizationSlug, projectParam, userId);
@@ -153,7 +155,10 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => {
153155
window: QueueMetricsWindow;
154156
bucketStartMs: number;
155157
bucketIntervalMs: number;
156-
byQueue: Record<string, import("~/presenters/v3/QueueMetricsPresenter.server").QueueListMetric>;
158+
byQueue: Record<
159+
string,
160+
import("~/presenters/v3/QueueMetricsPresenter.server").QueueListMetric
161+
>;
157162
} | null = null;
158163

159164
if (queueMetricsUiEnabled && queues.success) {
@@ -404,8 +409,7 @@ function QueuesWithMetricsView() {
404409
</LinkButton>
405410
)
406411
) : null}
407-
{environment.runsEnabled &&
408-
env.pauseSource !== ENVIRONMENT_PAUSE_SOURCE_BILLING_LIMIT ? (
412+
{environment.runsEnabled && env.pauseSource !== ENVIRONMENT_PAUSE_SOURCE_BILLING_LIMIT ? (
409413
<EnvironmentPauseResumeButton env={env} />
410414
) : null}
411415
<LinkButton
@@ -1209,7 +1213,13 @@ const QUEUE_HEADER_TILES: QueueHeaderTile[] = [
12091213
},
12101214
];
12111215

1212-
function QueueEnvMetricTile({ tile, period }: { tile: QueueHeaderTile; period: QueueMetricsWindow }) {
1216+
function QueueEnvMetricTile({
1217+
tile,
1218+
period,
1219+
}: {
1220+
tile: QueueHeaderTile;
1221+
period: QueueMetricsWindow;
1222+
}) {
12131223
const organization = useOrganization();
12141224
const project = useProject();
12151225
const environment = useEnvironment();
@@ -1288,7 +1298,9 @@ function QueueEnvMetricTile({ tile, period }: { tile: QueueHeaderTile; period: Q
12881298
{showLoading ? (
12891299
<div className="h-12 w-full animate-pulse rounded bg-grid-bright/60" />
12901300
) : failed ? (
1291-
<div className="flex h-12 items-center text-xs text-text-dimmed">Unable to load metrics</div>
1301+
<div className="flex h-12 items-center text-xs text-text-dimmed">
1302+
Unable to load metrics
1303+
</div>
12921304
) : (
12931305
<MiniChart data={sparkline} color={tile.color} />
12941306
)}
@@ -1407,7 +1419,6 @@ function formatWaitMs(ms: number): string {
14071419
return `${(ms / 3_600_000).toFixed(1)}h`;
14081420
}
14091421

1410-
14111422
// Classic Queues page, restored verbatim from before the Queue Metrics feature. Rendered
14121423
// when queueMetricsUiEnabled is off so a gated org sees exactly the pre-metrics UI.
14131424
function ClassicQueuesView() {

apps/webapp/app/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.queues_.$queueParam/route.tsx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => {
5555
if (!project) throw new Response(undefined, { status: 404, statusText: "Project not found" });
5656

5757
const environment = await findEnvironmentBySlug(project.id, envParam, userId);
58-
if (!environment) throw new Response(undefined, { status: 404, statusText: "Environment not found" });
58+
if (!environment)
59+
throw new Response(undefined, { status: 404, statusText: "Environment not found" });
5960

6061
const retrieve = await new QueueRetrievePresenter().call({ environment, queueInput: queueParam });
6162
if (!retrieve.success) {
@@ -330,7 +331,9 @@ function QueueDetailChartCard({
330331
/>
331332
<Tooltip
332333
cursor={{ stroke: "rgba(255,255,255,0.12)" }}
333-
content={<QueueChartTooltip series={series} formatX={formatX} valueFormat={valueFormat} />}
334+
content={
335+
<QueueChartTooltip series={series} formatX={formatX} valueFormat={valueFormat} />
336+
}
334337
allowEscapeViewBox={{ x: true, y: true }}
335338
wrapperStyle={{ zIndex: 1000 }}
336339
animationDuration={0}
@@ -382,7 +385,10 @@ function QueueChartTooltip({
382385
const value = entry?.value;
383386
return (
384387
<div key={s.key} className="flex items-center gap-2 text-xs">
385-
<span className="inline-block h-2 w-2 rounded-full" style={{ backgroundColor: s.color }} />
388+
<span
389+
className="inline-block h-2 w-2 rounded-full"
390+
style={{ backgroundColor: s.color }}
391+
/>
386392
<span className="text-text-dimmed">{s.label}</span>
387393
<span className="tabular-nums text-text-bright">
388394
{value === null || value === undefined
@@ -421,13 +427,21 @@ function QueueStats({
421427
<div className="grid grid-cols-2 gap-2 sm:grid-cols-4 lg:grid-cols-6">
422428
<Stat label="Running now" value={queue.running.toLocaleString()} />
423429
<Stat label="Queued now" value={queue.queued.toLocaleString()} />
424-
<Stat label="Limit" value={row ? toNumber(row.lim).toLocaleString() : "–"} loading={showLoading} />
430+
<Stat
431+
label="Limit"
432+
value={row ? toNumber(row.lim).toLocaleString() : "–"}
433+
loading={showLoading}
434+
/>
425435
<Stat
426436
label="Peak queued"
427437
value={row ? toNumber(row.peak_queued).toLocaleString() : "–"}
428438
loading={showLoading}
429439
/>
430-
<Stat label="Started" value={row ? toNumber(row.started).toLocaleString() : "–"} loading={showLoading} />
440+
<Stat
441+
label="Started"
442+
value={row ? toNumber(row.started).toLocaleString() : "–"}
443+
loading={showLoading}
444+
/>
431445
<Stat
432446
label="Worst delay p95"
433447
value={worstP95 > 0 ? formatWaitMs(worstP95) : "–"}

apps/webapp/app/routes/admin.queue-metrics.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ export default function AdminQueueMetricsRoute() {
141141
</div>
142142
<Paragraph variant="extra-small">
143143
Depth = entries buffered in the shard stream; Lag = entries not yet delivered to the
144-
consumer group (rising = consumer falling behind; "unknown" = entries were trimmed
145-
past the group, i.e. data was lost); Pending = unacked entries. Gauges and counters
146-
share one stream family on the metrics Redis.
144+
consumer group (rising = consumer falling behind; "unknown" = entries were trimmed past
145+
the group, i.e. data was lost); Pending = unacked entries. Gauges and counters share one
146+
stream family on the metrics Redis.
147147
</Paragraph>
148148
{lagUnknownCount > 0 && (
149149
<Callout variant="error">

apps/webapp/app/v3/querySchemas.ts

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -722,35 +722,60 @@ export const queueMetricsSchema: TableSchema = {
722722
},
723723
max_queued: {
724724
name: "max_queued",
725-
...column("UInt32", { description: "Peak queue depth in the bucket. Aggregate with max().", coreColumn: true, fillMode: "carry" }),
725+
...column("UInt32", {
726+
description: "Peak queue depth in the bucket. Aggregate with max().",
727+
coreColumn: true,
728+
fillMode: "carry",
729+
}),
726730
},
727731
max_running: {
728732
name: "max_running",
729-
...column("UInt32", { description: "Peak running (concurrency) in the bucket. Aggregate with max().", coreColumn: true, fillMode: "carry" }),
733+
...column("UInt32", {
734+
description: "Peak running (concurrency) in the bucket. Aggregate with max().",
735+
coreColumn: true,
736+
fillMode: "carry",
737+
}),
730738
},
731739
max_limit: {
732740
name: "max_limit",
733-
...column("UInt32", { description: "The queue concurrency limit. Aggregate with max().", coreColumn: true, fillMode: "carry" }),
741+
...column("UInt32", {
742+
description: "The queue concurrency limit. Aggregate with max().",
743+
coreColumn: true,
744+
fillMode: "carry",
745+
}),
734746
},
735747
max_env_queued: {
736748
name: "max_env_queued",
737-
...column("UInt32", { description: "Peak environment-wide queued in the bucket. Aggregate with max().", fillMode: "carry" }),
749+
...column("UInt32", {
750+
description: "Peak environment-wide queued in the bucket. Aggregate with max().",
751+
fillMode: "carry",
752+
}),
738753
},
739754
max_env_running: {
740755
name: "max_env_running",
741-
...column("UInt32", { description: "Peak environment-wide running in the bucket. Aggregate with max().", fillMode: "carry" }),
756+
...column("UInt32", {
757+
description: "Peak environment-wide running in the bucket. Aggregate with max().",
758+
fillMode: "carry",
759+
}),
742760
},
743761
max_env_limit: {
744762
name: "max_env_limit",
745-
...column("UInt32", { description: "The environment concurrency limit. Aggregate with max().", fillMode: "carry" }),
763+
...column("UInt32", {
764+
description: "The environment concurrency limit. Aggregate with max().",
765+
fillMode: "carry",
766+
}),
746767
},
747768
wait_ms_sum: {
748769
name: "wait_ms_sum",
749-
...column("UInt64", { description: "Sum of scheduling delays (ms). Mean = wait_ms_sum/wait_ms_count." }),
770+
...column("UInt64", {
771+
description: "Sum of scheduling delays (ms). Mean = wait_ms_sum/wait_ms_count.",
772+
}),
750773
},
751774
wait_ms_count: {
752775
name: "wait_ms_count",
753-
...column("UInt64", { description: "Count of scheduling-delay samples. Aggregate with sum()." }),
776+
...column("UInt64", {
777+
description: "Count of scheduling-delay samples. Aggregate with sum().",
778+
}),
754779
},
755780
wait_quantiles: {
756781
name: "wait_quantiles",

apps/webapp/app/v3/queueMetrics.server.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,7 @@ export type LabeledShardState = ShardState & { stream: "queue_metrics" };
127127

128128
export async function probeQueueMetricsStreams(): Promise<LabeledShardState[]> {
129129
const def = metricsDefinition();
130-
const states = await probeShardStates(
131-
metricsAdminRedis(),
132-
allStreamKeys(def),
133-
def.consumerGroup
134-
);
130+
const states = await probeShardStates(metricsAdminRedis(), allStreamKeys(def), def.consumerGroup);
135131
return states.map((s) => ({ ...s, stream: "queue_metrics" as const }));
136132
}
137133

0 commit comments

Comments
 (0)