Skip to content

Allow adding collectors to OpinionatedWatcher and OpinionatedReconciler#1272

Draft
IfSentient wants to merge 1 commit intomainfrom
IfSentient/opinionated-collectors
Draft

Allow adding collectors to OpinionatedWatcher and OpinionatedReconciler#1272
IfSentient wants to merge 1 commit intomainfrom
IfSentient/opinionated-collectors

Conversation

@IfSentient
Copy link
Copy Markdown
Contributor

@IfSentient IfSentient commented Mar 2, 2026

What Changed? Why?

Addresses Issue #1271

Both OpinionatedWatcher and OpinionatedReconciler now support direct registration of Prometheus collectors without requiring users to implement the full ResourceWatcher/Reconciler interface. This adds a RegisterMetricsCollectors() method to both types, following the established pattern in simple.App.RegisterMetricsCollectors.

How was it tested?

All new functionality is covered by comprehensive tests:

  • Direct collector registration
  • Additive calls (multiple registrations)
  • Combination with existing Wrap() functionality
  • No-op with no arguments

All existing tests continue to pass.

Where did you document your changes?

Documentation is in code comments for the new public methods.

Notes to Reviewers

This is a minimal, non-breaking change that adds optional functionality. The collectors field is internal to both types, and the new methods follow existing patterns in the codebase.

Authored by claude code

…nd OpinionatedReconciler

Addresses issue #1271 by allowing direct registration of Prometheus collectors
on both OpinionatedWatcher and OpinionatedReconciler without implementing the
full ResourceWatcher/Reconciler interface. Follows the same pattern as
simple.App.RegisterMetricsCollectors.

Changes:
- Add collectors field to both types
- Add RegisterMetricsCollectors() method
- Add PrometheusCollectors() method to OpinionatedReconciler
- Update Wrap() to extract collectors from wrapped types
- Add comprehensive tests for the new functionality

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
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