Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(scripts): server metrics read event-loop delay and GC in every window #41252

Mergedjuliusmarmingemerged 6 commits intomain fromrefs/pull/41252/headmerged by juliusmarminge View on GitHub

Showing 3 changed files with 106 additions and 5 deletions (loading 1).

x
0 of 3 viewed, 3 left
38 additions and 1 deletionscripts/server-metrics-report.tsModified
View file
@@ -7,6 +7,19 @@
rssPeakMB: Schema.Number,
rssMB: Schema.Number,
heapAfterGcMB: Schema.Number,
+ // Files written before these were recorded still decode, and compare shows them as n/a.
+ /** Event-loop delay past the 10 ms sampling interval, from a histogram inside the server. */
+ loopDelayP50Ms: Schema.optional(Schema.Number),
+ loopDelayP99Ms: Schema.optional(Schema.Number),
+ loopDelayMaxMs: Schema.optional(Schema.Number),
+ /**
+ * Delay samples taken. Each can wake an idle loop, so they sit inside `wakeupsPerSec` (up to
+ * 100/s at rest, near none under load, when the loop is already awake); not compared.
+ */
+ loopSamples: Schema.optional(Schema.Number),
+ /** GC events and their summed pause in the window, from a `gc` PerformanceObserver. */
+ gcCount: Schema.optional(Schema.Number),
+ gcPauseMs: Schema.optional(Schema.Number),
});
export type Window = typeof Window.Type;
const Spread = Schema.Struct({ median: Schema.Number, p90: Schema.Number });
@@ -143,6 +156,11 @@
if (metric.endsWith("cpuPct")) return 1;
if (metric.endsWith("wakeupsPerSec")) return 20;
if (metric.endsWith("MB")) return 15;
+ if (metric.endsWith("loopDelayP50Ms")) return 2;
+ if (metric.endsWith("loopDelayP99Ms")) return 5;
+ if (metric.endsWith("loopDelayMaxMs")) return 20;
+ if (metric.endsWith("gcPauseMs")) return 10;
+ if (metric.endsWith("gcCount")) return 20;