From 81d87cf1f94fb962a9eff4b8600a9af406b623ea Mon Sep 17 00:00:00 2001 From: emallson Date: Wed, 24 Sep 2025 18:42:33 -0400 Subject: [PATCH] remove median calculation from server metrics, increase cache time --- src/route/metrics.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/route/metrics.ts b/src/route/metrics.ts index 27ebf92..1f88d31 100644 --- a/src/route/metrics.ts +++ b/src/route/metrics.ts @@ -29,7 +29,7 @@ const serverMetrics: FastifyPluginAsync = async (app) => { async () => { const data = await db.query( ` - select configName, metricId, min(metricValue) as minValue, median(metricValue) over (partition by configName, metricId) as medValue, avg(metricValue) as avgValue, max(metricValue) as \`maxValue\` + select configName, metricId, min(metricValue) as minValue, avg(metricValue) as avgValue, max(metricValue) as \`maxValue\` from spec_analysis_metric_key as k join spec_analysis_metric_data data on data.keyId = k.id where k.analysisTimestamp >= now() - interval 2 week @@ -42,7 +42,7 @@ const serverMetrics: FastifyPluginAsync = async (app) => { metricId: METRIC_NAMES_BY_ID[v.metricId as number], })); }, - 60, + 600, ); return reply.header("content-type", "application/json").send(data);