Skip to content

DashboardState

The rolling in-memory store fed by OtlpReceiver’s decoded batches and read by the render loop via DashboardState::snapshot().

Single-threaded (one Revolt event loop drives both ingestion and rendering), so plain arrays with no locking are correct here.

Worth calling out: throughput, latency (avg/p95/max), error rate, per-route stats, and the recent-request/error feeds are all derived from root spans, not from http.server.request.count/ http.server.request.duration metrics. The root span itself already carries http.route/route_name/quiote.cache.hit/http.response.status_code attributes (see RoutingMiddleware::process() and TelemetryMiddleware::recordMeasurements()) plus its own real duration and OTel Status — a strictly richer, per-request-precise source than aggregated histogram buckets, and it means genuine percentiles (not bucket-boundary estimates) are possible from a bounded reservoir of raw samples. Metrics are still the only source for CPU time and memory, which spans don’t carry, and for worker RSS, an aggregate signal with no meaningful per-span equivalent at all.

final class DashboardState

SourceDashboardState.php

public function __construct(): mixed

Returns mixed

MethodDescription
ingestMetrics(array<ReceivedMetric> $metrics, int $second): void
ingestSpans(array<ReceivedSpan> $spans, int $second): void
snapshot(int $second): DashboardSnapshotBuilds the immutable view model the dashboard renders for $second.

public function ingestMetrics(array<ReceivedMetric> $metrics, int $second): void

ParameterTypeDescription
$metricsarray``<ReceivedMetric>
$secondint

public function ingestSpans(array<ReceivedSpan> $spans, int $second): void

ParameterTypeDescription
$spansarray``<ReceivedSpan>
$secondint

public function snapshot(int $second): DashboardSnapshot

Builds the immutable view model the dashboard renders for $second.

Aggregates the throughput and latency ring buffers into series, derives the current requests-per-second from the last five seconds only (so the figure tracks recent traffic rather than the whole window), and reverses the recent-span and recent-error feeds into newest-first order. Reads state only; nothing is mutated or pruned here.

ParameterTypeDescription
$secondint

Returns DashboardSnapshot