services
Get a key

library / Blockchain ideas / Dashboards and explorers / BI0126

Slot time chart panel

Read the last hour of per-minute performance samples, turn each into milliseconds per slot, and draw a panel with a median, a range and a bar line, in one runnable main.ts you can point a dashboard at.

By Carbium · Dashboards and explorers · BI0126 · updated 2026-11-23

01

What the panel draws

A slot time panel answers two questions: how long the chain is taking per slot right now, and whether that figure has moved in the last hour. Since the Alpenglow switch on 2026-10-21 a mainnet slot lasts about 200 ms, so the chart carries one flat reference line at 200 and everything worth looking at is drift away from it. Charts drawn before the switch against 400 ms need that line moved.

The raw material already sits on the node. getRecentPerformanceSamples returns one record for each 60 second window: the slot where the window ended, how many slots passed in it, how many transactions landed, and the length of the window in seconds. Milliseconds per slot is the window length times 1000, divided by the slots that passed. A limit of 60 returns the last hour, and the node keeps up to 720 records, which is twelve hours.

That makes this panel simpler to build than a chart that needs its own history. Network fee trend chart has to run a sampler for days before its line means anything. Here the first run already draws an hour, because the node did the sampling.

02

Reading the samples

One run makes two calls at the same time and settles each, so a failed slot read does not hide the chart.

  1. getRecentPerformanceSamples with the number of minutes to draw. The node answers newest first, so the code reverses the array to put time left to right.
  2. getSlot at confirmed commitment names the current slot for the panel header.
  3. Each record becomes a point: milliseconds per slot, and transactions per second as the transaction count over the window length. A record with no slots would divide by zero, so the code drops any point that is not a finite number.
  4. The code prints the current slot, the median, the minimum and maximum figure, how many windows ran more than a quarter above the 200 ms reference, and a bar line scaled between the minimum and maximum point.
main.ts
// BI0126 · Slot time chart panel// https://carbium.sh/library/blockchainideas/slot-time-chart-panel// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.// SPDX-License-Identifier: MITimport { createDefaultRpcTransport, createSolanaRpcFromTransport } from "@solana/kit";const key = process.env.CARBIUM_KEY;if (!key) {  console.error("Set CARBIUM_KEY to your Carbium API key.");  process.exit(1);}const rpc = createSolanaRpcFromTransport(  createDefaultRpcTransport({    url: process.env.CARBIUM_RPC_URL ?? "https://services.carbium.sh",    headers: { "x-api-key": key },  }),);const why = (e: unknown) => (e instanceof Error ? e.message : String(e));const REFERENCE_MS = 200;const minutes = Math.min(Math.max(Number(process.argv[2]) || 60, 1), 720);const [samples, slot] = await Promise.allSettled([  rpc.getRecentPerformanceSamples(minutes).send(),  rpc.getSlot({ commitment: "confirmed" }).send(),]);if (slot.status === "rejected") console.error(`getSlot failed: ${why(slot.reason)}`);if (samples.status === "rejected") {  console.error(`getRecentPerformanceSamples failed: ${why(samples.reason)}`);  process.exit(1);}// The node answers newest first; a chart reads oldest to newest.const points = [...samples.value]  .reverse()  .map((s) => ({    slot: Number(s.slot),    ms: (Number(s.samplePeriodSecs) * 1000) / Number(s.numSlots),    tps: Number(s.numTransactions) / Number(s.samplePeriodSecs),  }))  .filter((p) => Number.isFinite(p.ms));if (points.length === 0) {  console.error("no usable samples returned");  process.exit(1);}const ms = points.map((p) => p.ms);const sorted = [...ms].sort((a, b) => a - b);const lo = sorted[0] ?? 0;const hi = sorted[sorted.length - 1] ?? 0;const median = sorted[Math.floor((sorted.length - 1) / 2)] ?? 0;const slow = ms.filter((v) => v > REFERENCE_MS * 1.25).length;const bars = "▁▂▃▄▅▆▇█";const line = ms.map((v) => bars[Math.round(((v - lo) / (hi - lo || 1)) * 7)]).join("");const newest = points[points.length - 1];console.log(`current slot ${slot.status === "fulfilled" ? slot.value : "unknown"}, ${points.length} one-minute windows`);console.log(`slot time ms: median ${median.toFixed(0)}, low ${lo.toFixed(0)}, high ${hi.toFixed(0)}, reference ${REFERENCE_MS}`);console.log(`windows over ${REFERENCE_MS * 1.25} ms: ${slow}, newest ${newest?.tps.toFixed(0)} tx/s up to slot ${newest?.slot}`);console.log(line);

run: CARBIUM_KEY=<YOUR_KEY> node main.ts 60

$Each figure is an average over one minute. A single slow slot disappears into it, and a stall of several seconds lifts one bar by a few milliseconds. Read a high bar as a minute that ran slow, never as one slow slot.

The argument is the number of minutes, from 1 to 720, and defaults to 60. Transactions per second in the output is the transaction count over the window, which is user transactions only, because mainnet blocks carry no vote transactions since Alpenglow.

03

Laying out the panel

A status panel is read in a glance, so it holds a few elements in a fixed order. The table lists what each element is computed from.

ElementComputed fromWhat it tells a reader
Headline in msMedian of the window figuresWhere the chain sits now, unaffected by one odd minute
Bar line or area chartEvery window figure, oldest firstWhether the hour was steady or drifted
Reference line at 200A constantHow far the chain is from its normal slot length
RangeLowest and highest window figureHow wide the swing was
Slots per minutenumSlots of the newest recordThe same fact as the headline, in whole numbers
Transactions per secondnumTransactions over the windowWhether a slow minute was also a busy one

Colour the bars by their ratio to the reference. An ordinary mainnet hour runs a little over the 200 ms target, with minutes between about 210 and 225 ms, so a window under 1.15 times the reference reads as normal, one up to 1.25 times as watch, and anything higher as slow. Those cut-offs are a starting point you tune against a few days of your own data, since the right alarm level depends on who reads the panel.

Put the transaction line on a second axis under the slot chart and share the time axis. Slow minutes that line up with busy ones point at load. Slow minutes with ordinary traffic point at the network or at the node you are reading from, and that is the case to flag first.

04

Serving it to a dashboard

The samples change once a minute, so one fetch a minute is all a panel needs. Run the fetch on your server and hand the points to every viewer as JSON. A browser that calls the RPC itself spends credits for each open tab, and credits meter RPC work, so one server-side poll keeps the draw small and steady. Limits are per account, which means the panel's calls count against whatever else uses the same keys.

A page that wants a live edge on top of the minute bars can add a slot subscription over the WebSocket and chart the time between notifications. A slot its leader never produced sends no notification, so the gap after a skipped slot spans two slot times. Treat that line as a different chart from the minute bars.

Teams that already run Grafana can store the points and let it draw them, as in Grafana network metrics. The calls in the script are plain JSON-RPC, so any language with an HTTP client can fill the same table.

05

Where it ends

  • The chart is as long as the node's sample list. Twelve hours is the most one call returns, and older minutes need a store you fill yourself.
  • One figure covers a whole minute, so the panel cannot show a single slow slot or a stall shorter than the window.
  • Slot time is the length of the slot clock. It says nothing about whether transactions landed or how many blocks were skipped.
  • Samples come from the node that answers. Two nodes can differ by a slot or two in a window, so compare a chart against itself over time and avoid comparing two sources.
  • The 200 ms line describes mainnet after the Alpenglow switch. Data from before it sits near 400 ms and a long chart will show the step.
06

When it goes wrong

what goes wrongwhat to do
The run prints a getRecentPerformanceSamples failure and no chart.Read the message printed after the method name. A rate limit means the call went over its rate, so wait for the retry-after hint and run again.
Every call answers 401.The key is unknown at the door. Check that CARBIUM_KEY holds the whole key with nothing cut off.
Every bar is the same height.The minimum and maximum figures are equal, which happens on a very short range. Ask for more minutes, or draw against a fixed axis from 0 to 400 so a flat hour looks flat.
The header shows the slot as unknown.The getSlot call failed while the samples call worked. The message is printed on the line above. The chart is still valid, so retry the slot read on the next poll.
The 200 ms line sits far below every bar.Those minutes ran slow on the node that answered, either because the cluster slowed or because the node fell behind. Check whether the transaction rate rose in the same minutes, then run the same call against a second node: if its bars sit near 200, the first node is the problem.
07

Questions

Why does the chart read around 200 ms when slots used to be longer?

The Alpenglow switch on 2026-10-21 cut mainnet slot time to about 200 ms. Older samples sit near 400 ms, so a chart that spans the switch shows a step.

Can I draw more than twelve hours?

Not from one call. The node keeps up to 720 minute samples, so keep each hour you read in your own table and chart from that table for longer spans.

How often should the panel poll?

Once a minute. The samples are minute windows, so a faster poll reads the same records again and spends credits for no new points.

Does a high bar mean the network was down?

No. It means the slots in that minute took longer on average. A bad slowdown shows up as a window with very few slots and a figure many times the reference, and a full halt as a window with no slots, which the script drops, so a production panel should draw a dropped window as a halt.