Skip to content

feat: configurable monitor latency display - #792

Open
123FLO321 wants to merge 22 commits into
rajnandan1:mainfrom
123FLO321:feature/configurable-monitor-latency-display
Open

feat: configurable monitor latency display#792
123FLO321 wants to merge 22 commits into
rajnandan1:mainfrom
123FLO321:feature/configurable-monitor-latency-display

Conversation

@123FLO321

@123FLO321 123FLO321 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

The monitor bar on a status page always shows average latency in the top-right corner, with no way to change it.

Add a per-page setting to choose which latency stats appear (a checkbox for average, minimum, and maximum ) shown as a short labeled string:
e.g. avg. 250ms | min. 10ms | max. 900ms | now 30ms

Default stays average only (current behavior).

image image image

requires #789

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Added “Monitor Latency Display” page controls (Current, Average, Minimum, Maximum) to configure which latency stats appear in monitor bars.
    • Average latency is enabled by default; the other options can be toggled independently.
  • Bug Fixes
    • Improved latency formatting so disabled/missing metrics are hidden and the displayed stats follow a consistent order.
  • Tests
    • Expanded unit/component coverage for latency display settings and monitor rendering, and updated CI to run the full test suite (server and client) with Playwright.

123FLO321 and others added 19 commits July 13, 2026 20:51
…superpowers

Shell scripts checked out with CRLF on Windows (core.autocrlf=true) broke
the Docker entrypoint at container start. Force LF for all text files at
the git layer, matching the existing .editorconfig and Prettier settings.
Add a workflow-level concurrency group keyed by workflow + ref with
cancel-in-progress, so pushing a new commit cancels the still-running
test job for the previous commit on that branch/PR.
The status icon sat at the left edge of a shrink-to-fit, right-pinned block
whose width was driven by the (now multi-metric) latency line, so a longer
avg|min|max line pushed the icon left and rows no longer aligned. Move the icon
next to the uptime % and drop the latency onto its own line below, so the icon
tracks only the % width (its pre-feature behavior).
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7f0f3334-1555-416a-b3b2-e37b1fc0775d

📥 Commits

Reviewing files that changed from the base of the PR and between 69bce77 and ca6ef3a.

📒 Files selected for processing (14)
  • src/lib/clientTools.test.ts
  • src/lib/clientTools.ts
  • src/lib/components/MonitorBar.svelte
  • src/lib/components/MonitorBar.svelte.test.ts
  • src/lib/locales/en.json
  • src/lib/server/api-server/monitor-bar/get.ts
  • src/lib/server/api-server/monitor-bar/shared.ts
  • src/lib/server/api-server/monitor-bars/get.ts
  • src/lib/server/controllers/dashboardController.ts
  • src/lib/server/pageSettings.test.ts
  • src/lib/server/pageSettings.ts
  • src/lib/types/api.ts
  • src/routes/(manage)/manage/app/pages/[page_id]/+page.svelte
  • static/api-references/v4.json

📝 Walkthrough

Walkthrough

Adds configurable latency statistics to page settings and monitor bars, including current, average, minimum, and maximum values. Adds Vitest server/browser projects, Playwright setup, CI execution, and broad component and utility test coverage.

Changes

Configurable monitor latency display

Layer / File(s) Summary
Vitest and CI test foundation
.gitattributes, .github/workflows/test.yml, package.json, vite.config.ts, vitest-setup-client.ts, .gitignore, CLAUDE.md
Adds server/browser Vitest projects, Playwright setup, test scripts, CI execution, development commands, and workspace ignore rules.
Latency settings contract and persistence
src/lib/types/api.ts, src/lib/server/types/db.ts, src/lib/server/pageSettings.ts, src/lib/server/controllers/dashboardController.ts, static/api-references/v4.json
Adds latency display types, defaults, merging, sanitization, validation, dashboard fallback, and API schema.
Page settings management UI
src/routes/(manage)/manage/app/pages/[page_id]/+page.svelte, src/lib/locales/en.json
Adds translated controls for selecting current, average, minimum, and maximum latency metrics.
Monitor latency data and rendering
src/lib/server/api-server/monitor-bar/*, src/lib/clientTools.ts, src/lib/components/MonitorBar.svelte, src/lib/components/GroupMonitorPopover.svelte, src/routes/(kener)/*
Adds current latency to monitor responses, builds ordered latency text, propagates page configuration, and renders selected metrics.
Component and server utility coverage
src/lib/components/*.test.ts, src/lib/server/pageSettings.test.ts, src/lib/server/tool.test.ts
Adds browser component tests, page-settings validation tests, and deterministic coverage for server utilities and alert validation.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Administrator
  participant PageSettings
  participant MonitorPage
  participant MonitorBar
  Administrator->>PageSettings: select latency metrics
  PageSettings->>MonitorPage: provide monitor_latency_display
  MonitorPage->>MonitorBar: pass latencyDisplay
  MonitorBar->>MonitorBar: build configured latency text
  MonitorBar-->>Administrator: render latency display
Loading

Possibly related PRs

  • rajnandan1/kener#746: Modifies the shared page-settings merge, sanitization, and validation pipeline.
  • rajnandan1/kener#789: Shares the Vitest, CI, browser setup, and test-suite infrastructure changes.

Suggested reviewers: rajnandan1

Poem

I’m a rabbit with toggles, fluffy and bright,
Choosing latency stats to hop into sight.
Avg, min, max, and current join the queue,
While tests check every burrow too.
CI thumps its paws: “All tests green!”

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding configurable monitor latency display settings.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes monitor latency statistics configurable per status page. The main changes are:

  • Adds settings for current, average, minimum, and maximum latency.
  • Passes the settings through monitor APIs and status-page components.
  • Updates the page-management UI and translations.
  • Adds server and browser tests for settings, formatting, and rendering.

Confidence Score: 5/5

The reviewed follow-up changes look safe to merge.

  • The updated group rendering path forwards the page setting through loading, success, error, and nested monitor branches.
  • No additional blocking issue qualifies for this follow-up review.

Important Files Changed

Filename Overview
src/lib/components/GroupMonitorPopover.svelte Passes the configured latency display to child monitor bars in every rendering branch.
src/lib/components/MonitorBar.svelte Formats and displays the selected latency statistics with an average-only default.
src/lib/server/pageSettings.ts Adds defaults, merging, validation, and API conversion for latency display settings.
src/lib/server/api-server/monitor-bar/shared.ts Adds the latest latency value to monitor-bar API responses.

Reviews (3): Last reviewed commit: "style(monitor-bar): use "label:" and mid..." | Re-trigger Greptile

Comment thread src/lib/components/MonitorBar.svelte Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/test.yml:
- Around line 20-41: Pin the third-party actions in the workflow, including
actions/checkout@v4.2.2, actions/setup-node@v4, and actions/cache@v4, to their
exact immutable commit SHAs. Preserve the current action versions and
configuration while replacing mutable version tags with the corresponding SHA
references.
- Around line 17-18: Correct the indentation of the contents property under the
permissions configuration in the workflow YAML so it is indented exactly two
spaces relative to permissions, preserving the existing contents: read value.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 3ecd3cda-18f0-4353-8b74-7082a408f25c

📥 Commits

Reviewing files that changed from the base of the PR and between e5b745e and 34b892f.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (24)
  • .gitattributes
  • .github/workflows/test.yml
  • .gitignore
  • CLAUDE.md
  • package.json
  • src/lib/clientTools.test.ts
  • src/lib/clientTools.ts
  • src/lib/components/CopyButton.svelte.test.ts
  • src/lib/components/MonitorBar.svelte
  • src/lib/components/MonitorBar.svelte.test.ts
  • src/lib/components/StatusBarCalendar.svelte.test.ts
  • src/lib/locales/en.json
  • src/lib/server/controllers/dashboardController.ts
  • src/lib/server/pageSettings.test.ts
  • src/lib/server/pageSettings.ts
  • src/lib/server/tool.test.ts
  • src/lib/server/types/db.ts
  • src/lib/types/api.ts
  • src/routes/(kener)/+page.svelte
  • src/routes/(kener)/[page_path]/+page.svelte
  • src/routes/(manage)/manage/app/pages/[page_id]/+page.svelte
  • static/api-references/v4.json
  • vite.config.ts
  • vitest-setup-client.ts

Comment thread .github/workflows/test.yml
Comment thread .github/workflows/test.yml
GroupMonitorPopover rendered its child MonitorBar instances without
latencyDisplay, so a group's included-monitors drawer always showed avg-only
regardless of the page's configured min/max/avg setting. Thread the prop
MonitorBar -> GroupMonitorPopover -> child MonitorBar. Also switch the prop
type to the shared PageSettingsLatencyDisplay (removes the duplicated inline
shape).
Adds a fourth per-page latency stat: the current/latest reading, shown as
"now. 123ms". Fixed bar order is now current -> avg -> min -> max; default is
off (unchanged behavior).

- Server: expose currentLatency (latest monitoring row latency, formatted like
  the aggregates) in the monitor-bar response. Both the single and batch
  endpoints already fetch the latest row for status, so no extra queries.
- Config: current flag added to PageSettingsLatencyDisplay + default/merge/
  sanitize/validate in pageSettings, server + manage defaults, and the v4
  OpenAPI schema.
- UI: buildLatencyDisplay handles current (first); MonitorBar passes the value
  and "now." label; admin gets a Current checkbox; i18n keys "now."/"Current".
- Tests updated (clientTools 11, pageSettings 8, MonitorBar 4); check 0/0.
Per feedback: labels now read "now:" / "avg:" / "min:" / "max:" (colon instead
of period), and metrics are joined with a middle dot " · " instead of " | ",
which reads lighter in the muted caption. Renders e.g.
"now: 123ms · avg: 250ms · min: 10ms · max: 900ms".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant