Skip to content

HYPERFLEET-1361 - feat: Add Grafana dashboard for API and DB metrics#311

Open
tirthct wants to merge 1 commit into
openshift-hyperfleet:mainfrom
tirthct:hyperfleet-1361
Open

HYPERFLEET-1361 - feat: Add Grafana dashboard for API and DB metrics#311
tirthct wants to merge 1 commit into
openshift-hyperfleet:mainfrom
tirthct:hyperfleet-1361

Conversation

@tirthct

@tirthct tirthct commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a pre-built Grafana dashboard (charts/dashboards/hyperfleet-api.json) covering all 11 hyperfleet_api_* and hyperfleet_db_* Prometheus metrics across 12 panels
  • Update docs/metrics.md to replace the stub dashboard section with actual import instructions, coverage inventory, and behavioral notes
  • Bump Helm chart version 1.1.0 → 1.2.0 for the new dashboard artifact

Dashboard panels

# Panel Metric(s) Key PromQL
1 HTTP Request Rate requests_total sum by (code) (rate(...))
2 Build Info (API Status) build_info stat panel, value mapping
3 Request Duration request_duration_seconds histogram_quantile P50/P95/P99
4 Server Error Rate requests_total{code=~"5.."} sum by (path) (rate(...))
5 Reconciliation Started reconciliation_started_total sum by (resource_type, is_delete) (rate(...))
6 Pending Reconciliation resource_pending_reconciliation max by (resource_type, is_delete)
7 Stuck Resources resource_pending_reconciliation_stuck max by (resource_type, is_delete)
8 Max Stuck Duration resource_pending_reconciliation_stuck_duration_seconds max by (resource_type, is_delete)
9 DB Query Duration db_query_duration_seconds histogram_quantile P50/P95/P99
10 DB Error Rate db_errors_total sum by (error_type) (rate(...))
11 DB Connection Pool db_connections_open + db_connections_in_use sum(...)
12 Top Paths requests_total topk(10, ...) instant table

Design decisions

  • Parameterized datasource — no hardcoded UIDs; works across environments
  • Multi-replica aware — reconciliation gauges use max by (identical SQL results), connection pool uses sum (per-instance)
  • No stacking on error panels — error types shown as individual trends to avoid masking low-volume types
  • Reconciliation gauge panels show "No data" when no resources match (expected, not a broken datasource)

Test plan

  • Import dashboard into Grafana with a Prometheus datasource configured to scrape hyperfleet-api
  • Verify all 12 panels render data (or "No data" for reconciliation gauges when no resources are pending)
  • Confirm datasource variable dropdown works and panels update on selection
  • Validate helm-test CI check passes (make helm-docs already run)
  • Verify charts/README.md reflects version 1.2.0

@openshift-ci
openshift-ci Bot requested review from crizzo71 and sherine-k July 23, 2026 18:47
@openshift-ci

openshift-ci Bot commented Jul 23, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign jsell-rh for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Adds a 12-panel Grafana dashboard for HyperFleet API, reconciliation, and database metrics with a parameterized Prometheus datasource and one-hour default range. Documents import steps and expected reconciliation gauge behavior, updates the changelog, and bumps the Helm chart version and README badge to 1.2.0.

Sequence Diagram(s)

sequenceDiagram
  participant Grafana
  participant Prometheus
  participant HyperFleet API
  Grafana->>Prometheus: Query configured HyperFleet metrics
  Prometheus->>HyperFleet API: Collect exposed metric series
  Prometheus-->>Grafana: Return metric results
  Grafana-->>Grafana: Render dashboard panels
Loading

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: crizzo71, sherine-k

🚥 Pre-merge checks | ✅ 11
✅ Passed checks (11 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Sec-02: Secrets In Log Output ✅ Passed No log statements were added in the PR diff; only docs/metadata/dashboard JSON changed. No token/password/secret fields or interpolated strings found (CWE-532).
No Hardcoded Secrets ✅ Passed No new hardcoded secrets found in the patch; added lines contain only docs/version changes and a Grafana JSON with no apiKey/secret/token/password literals or embedded creds (CWE-798/CWE-259).
No Weak Cryptography ✅ Passed Only docs/dashboard/chart metadata changed; diff scan found no md5/des/rc4/SHA1/ECB or secret comparisons. No CWE-327/CWE-208 issue.
No Injection Vectors ✅ Passed PASS: Changed files are docs/chart metadata plus a Grafana JSON with static PromQL; no SQL concat, exec.Command, template.HTML, or yaml.Unmarshal patterns (CWE-89/78/79/502).
No Privileged Containers ✅ Passed Changed files are docs/chart metadata/Grafana JSON only; no privileged:true, hostNetwork/IPC/PID, allowPrivilegeEscalation:true, runAsUser:0, or SYS_ADMIN found (CWE-269).
No Pii Or Sensitive Data In Logs ✅ Passed No changed code adds slog/logr/zap/fmt.Print*; only docs/chart/dashboard artifacts changed, so no CWE-532 log leak.
Title check ✅ Passed Summarizes the dashboard addition and chart/docs version bump.
Description check ✅ Passed Describes the Grafana dashboard, docs update, and Helm version bump.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

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

@hyperfleet-ci-bot

Copy link
Copy Markdown

Risk Score: 2 — risk/medium

Signal Detail Points
PR size 1223 lines (>500) +2
Sensitive paths none +0

Computed by hyperfleet-risk-scorer

@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: 1

🤖 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 `@charts/Chart.yaml`:
- Line 5: Add a short note to charts/templates/NOTES.txt mentioning the bundled
charts/dashboards/hyperfleet-api.json dashboard, alongside the existing API,
validation schema, and JWT settings notes, so install and upgrade output
includes this user-facing artifact.
🪄 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: Central YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: ee8bf80a-5749-467a-af9e-0ec817167be8

📥 Commits

Reviewing files that changed from the base of the PR and between 913cd01 and 9fe2730.

📒 Files selected for processing (5)
  • CHANGELOG.md
  • charts/Chart.yaml
  • charts/README.md
  • charts/dashboards/hyperfleet-api.json
  • docs/metrics.md
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • openshift-hyperfleet/architecture (manual)
  • openshift-hyperfleet/hyperfleet-api (manual)
  • openshift-hyperfleet/hyperfleet-sentinel (manual)
  • openshift-hyperfleet/hyperfleet-adapter (manual)
  • openshift-hyperfleet/hyperfleet-broker (manual)

Comment thread charts/Chart.yaml
description: HyperFleet API - Cluster Lifecycle Management Service
type: application
version: 1.1.0
version: 1.2.0

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
fd -p 'NOTES.txt' charts | xargs -I{} sh -c 'echo "--- {} ---"; cat {}'

Repository: openshift-hyperfleet/hyperfleet-api

Length of output: 2053


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== chart files referencing dashboard =="
rg -n --hidden --glob 'charts/**' -i 'dashboard|grafana' charts || true

echo
echo "== chart NOTES file =="
cat -n charts/templates/NOTES.txt

Repository: openshift-hyperfleet/hyperfleet-api

Length of output: 2608


Add the bundled dashboard to charts/templates/NOTES.txt
charts/dashboards/hyperfleet-api.json ships with the chart, but the NOTES file only covers the API, validation schema, and JWT settings. Add a short dashboard note so install/upgrade output covers the user-facing artifact.

🤖 Prompt for 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.

In `@charts/Chart.yaml` at line 5, Add a short note to charts/templates/NOTES.txt
mentioning the bundled charts/dashboards/hyperfleet-api.json dashboard,
alongside the existing API, validation schema, and JWT settings notes, so
install and upgrade output includes this user-facing artifact.

Source: Path instructions

@tirthct tirthct changed the title HYPERFLEET-1361: Add Grafana dashboard for API and database metrics HYPERFLEET-1361 - feat: Add Grafana dashboard for API and DB metrics Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant