Skip to content

feat(stats): sparklines for connections and transactions or queries per second (#1165) - #1228

Merged
ZhuchkaTriplesix merged 3 commits into
devfrom
feat/1165-sparklines
Oct 9, 2026
Merged

ZhuchkaTriplesix merged 3 commits into
devfrom
feat/1165-sparklines

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Refs #1165

What was wrong

The Overview polled the server every few seconds but showed only the current numbers, so a spike between two looks was invisible.

Changes

  • MetricHistory (core/stats/metric_history.dart): the last 120 samples per metric (ten minutes at the 5 s poll), kept in memory while the Overview is open. A counter's change between two samples becomes a rate per second; a counter that goes down (a restart) gives none.
  • QueryaSparkline (shared/widgets/querya_sparkline.dart): a line of the samples; the tooltip names the latest value and its time; draws nothing until there are two samples.
  • PostgreSQL: active connections and transactions per second (from xact_commit across databases), in the Connections card.
  • MySQL: connected threads and queries per second (from Questions), in the Connections card.
  • The history is fed from the numbers each poll already fetched, so no query is added. The view rebuilds on every poll sample, so the lines move.
  • Tests: the capacity, the rate from a counter, the restart case, read-only series.

Not in this PR

  • The acceptance test "no extra queries per poll with a counting fake service" is not written; the counting is by construction (the history reads the fetched stats only).
  • The sparkline widget itself is not tested.
  • Cache hit ratio, locks and waiting sessions are not added, and MongoDB is not changed. Those need the driver queries the issue names.
  • The history is kept while the view is mounted; it is not kept across closing the Overview.

Not verified locally

Tests were not run locally, per the project rule.

…er second (#1165)

The Overview polled the server every few seconds but showed only the current
numbers. Each poll now also feeds an in-memory history (ten minutes of samples,
kept while the Overview is open). Counters become rates per second from their
change. PostgreSQL shows active connections and transactions per second; MySQL
shows connected threads and queries per second. The sparklines come from the
numbers each poll already fetched, so no query is added.
@github-actions github-actions Bot added enhancement New feature or request ui User interface components and widgets P4 Backlog / Minor enhancement labels Oct 9, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit f652699 into dev Oct 9, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request P4 Backlog / Minor enhancement ui User interface components and widgets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant