Skip to content

fix(pressure_reconciler): emit Reconciliation metric event#754

Merged
cbartz merged 9 commits intomainfrom
fix/pressure-reconciler-missing-reconciliation-metric
Mar 18, 2026
Merged

fix(pressure_reconciler): emit Reconciliation metric event#754
cbartz merged 9 commits intomainfrom
fix/pressure-reconciler-missing-reconciliation-metric

Conversation

@cbartz
Copy link
Collaborator

@cbartz cbartz commented Mar 16, 2026

Overview

Issue the reconciliation metric (and related prometheus metrics) in the pressure reconciler.

Rationale

The panels in the dashboards metrics.json and metrics_prometheus.json that are based on the reconciliation metrics are currently non-functional when the pressure_reconciler mode is used.

Checklist

  • The charm style guide was applied.
  • The contributing guide was applied.
  • The changes are compliant with ISD054 - Managing Charm Complexity
  • The documentation for charmhub is updated.
  • The PR is tagged with appropriate label (urgent, trivial, complex).
  • The changelog is updated with changes that affects the users of the charm.
  • The application version number is updated in github-runner-manager/pyproject.toml.

@cbartz cbartz force-pushed the fix/pressure-reconciler-missing-reconciliation-metric branch 2 times, most recently from ca738ef to ad8f67e Compare March 17, 2026 08:54
@cbartz cbartz requested a review from Copilot March 17, 2026 09:25
Copy link
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 updates the planner-driven PressureReconciler to emit the Reconciliation metric event and update reconciliation-related Prometheus gauges, aligning the planner-based reconcile path with the legacy scaler behavior so dashboards don’t go empty.

Changes:

  • Add reconciliation metric emission + Prometheus gauge updates to PressureReconciler._handle_timer_reconcile.
  • Add/adjust unit test stubs and a new unit test to assert the reconciliation event is emitted with expected runner counts.
  • Document the user-visible metrics fix in docs/changelog.md.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
github-runner-manager/src/github_runner_manager/manager/pressure_reconciler.py Adds reconciliation metric/gauge emission during timer reconcile.
github-runner-manager/tests/unit/manager/test_pressure_reconciler.py Extends test scaffolding and adds a unit test for the reconciliation event.
docs/changelog.md Notes the metrics behavior change in the user-facing changelog.

PressureReconciler._handle_timer_reconcile never issued the
Reconciliation metric event or updated Prometheus gauges (idle/busy
runners count, reconcile duration). This caused the reconciliation
metric to be missing when using the planner-driven code path.

Add _issue_reconciliation_metric to PressureReconciler that emits the
Reconciliation event and updates Prometheus gauges, matching the
behavior of RunnerScaler.reconcile.
@cbartz cbartz force-pushed the fix/pressure-reconciler-missing-reconciliation-metric branch from ad8f67e to cdf4733 Compare March 17, 2026 09:55
cbartz added 4 commits March 17, 2026 12:45
Use cleanup() metric stats to compute crashed_runners instead of
hardcoding zero. Scale-down stats from soft_delete_runners are not
included (it returns only an int), documented as an accepted trade-off.
Copy link
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 fixes missing reconciliation observability in the planner-driven PressureReconciler path by emitting the Reconciliation metric event and updating the same Prometheus reconcile gauges used by RunnerScaler.reconcile, restoring expected dashboard signals.

Changes:

  • Add _issue_reconciliation_metric() and call it from PressureReconciler._handle_timer_reconcile() to emit the Reconciliation event and update reconcile gauges/histogram.
  • Extend unit test stubs to model runner state/health and add a test asserting the Reconciliation event is issued.
  • Document the user-facing metrics fix in docs/changelog.md.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
github-runner-manager/src/github_runner_manager/manager/pressure_reconciler.py Emit Reconciliation metric event in timer reconcile and update reconcile Prometheus gauges/histogram.
github-runner-manager/tests/unit/manager/test_pressure_reconciler.py Add runner/manager stubs needed for metric counting and a unit test for event emission.
docs/changelog.md Add changelog entry for restored reconciliation metrics in pressure reconciler.

@cbartz cbartz force-pushed the fix/pressure-reconciler-missing-reconciliation-metric branch from 75830d2 to 95d7ef0 Compare March 17, 2026 13:02
@cbartz cbartz marked this pull request as ready for review March 17, 2026 14:25
@cbartz cbartz changed the title fix: emit Reconciliation metric event in PressureReconciler fix(pressure_reconciler): emit Reconciliation metric event in PressureReconciler Mar 18, 2026
@cbartz cbartz changed the title fix(pressure_reconciler): emit Reconciliation metric event in PressureReconciler fix(pressure_reconciler): emit Reconciliation metric event Mar 18, 2026
Copy link
Member

@yanksyoon yanksyoon left a comment

Choose a reason for hiding this comment

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

Thanks for updating it!

@cbartz cbartz enabled auto-merge (squash) March 18, 2026 06:17
@cbartz cbartz merged commit c499186 into main Mar 18, 2026
311 of 353 checks passed
@cbartz cbartz deleted the fix/pressure-reconciler-missing-reconciliation-metric branch March 18, 2026 12:45
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.

3 participants