Skip to content

add VR health checks to prometheus output#13218

Open
DaanHoogland wants to merge 1 commit into
apache:mainfrom
shapeblue:ghi6212-routerHealthToPrometheus
Open

add VR health checks to prometheus output#13218
DaanHoogland wants to merge 1 commit into
apache:mainfrom
shapeblue:ghi6212-routerHealthToPrometheus

Conversation

@DaanHoogland
Copy link
Copy Markdown
Contributor

Description

This PR...

Fixes: #6212

aided by AI

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR extends the Prometheus exporter plugin to expose Virtual Router health-check results via the /metrics endpoint, addressing the need to monitor VR health checks without per-router API polling (Fixes #6212).

Changes:

  • Collect router health-check results from router_health_check and export per-check status as cloudstack_virtualrouter_healthcheck_result.
  • Export the last update time (Unix epoch seconds) per check as cloudstack_virtualrouter_healthcheck_lastcheck.
  • Wire in the required DAOs (DomainRouterDao, RouterHealthCheckResultDao) and add new metric item types.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +520 to +524
if (router.getRole() != VirtualRouter.Role.VIRTUAL_ROUTER) {
continue;
}
List<RouterHealthCheckResultVO> checks = routerHealthCheckResultDao.getHealthCheckResults(router.getId());
if (checks == null || checks.isEmpty()) {
Comment on lines +519 to +523
for (DomainRouterVO router : routers) {
if (router.getRole() != VirtualRouter.Role.VIRTUAL_ROUTER) {
continue;
}
List<RouterHealthCheckResultVO> checks = routerHealthCheckResultDao.getHealthCheckResults(router.getId());
Comment on lines +514 to +518
private void addVirtualRouterHealthCheckMetrics(final List<Item> metricsList, final long dcId, final String zoneName, final String zoneUuid) {
List<DomainRouterVO> routers = domainRouterDao.listByDataCenter(dcId);
if (routers == null) {
return;
}
@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

❌ Patch coverage is 0% with 51 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.09%. Comparing base (850b443) to head (4aede97).
⚠️ Report is 18 commits behind head on main.

Files with missing lines Patch % Lines
...che/cloudstack/metrics/PrometheusExporterImpl.java 0.00% 51 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #13218      +/-   ##
============================================
- Coverage     18.09%   18.09%   -0.01%     
- Complexity    16732    16733       +1     
============================================
  Files          6037     6037              
  Lines        542811   542862      +51     
  Branches      66471    66479       +8     
============================================
+ Hits          98230    98233       +3     
- Misses       433533   433581      +48     
  Partials      11048    11048              
Flag Coverage Δ
uitests 3.51% <ø> (ø)
unittests 19.25% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Export Virtual Router Health Checks to Prometheus

3 participants