Skip to content

add note about metric recorder#78

Merged
sourcehawk merged 1 commit intomainfrom
docs/add-metric-recorder-note
Mar 26, 2026
Merged

add note about metric recorder#78
sourcehawk merged 1 commit intomainfrom
docs/add-metric-recorder-note

Conversation

@sourcehawk
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings March 26, 2026 23:33
@sourcehawk sourcehawk merged commit dd0e138 into main Mar 26, 2026
4 checks passed
@sourcehawk sourcehawk deleted the docs/add-metric-recorder-note branch March 26, 2026 23:33
Copy link
Copy Markdown

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

Adds documentation to highlight the ReconcileContext.Metrics dependency used for condition-metrics recording during component reconciliation.

Changes:

  • Documented the Metrics field in docs/component.md and noted the metrics recorder implementation source.
  • Updated the README Quick Start ReconcileContext snippet to include Metrics: r.Metrics.

Reviewed changes

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

File Description
docs/component.md Adds a note explaining that a Metrics recorder is required and links to the recommended implementation.
README.md Updates the Quick Start reconcile snippet to pass a Metrics recorder into ReconcileContext.

Comment on lines +272 to +274
The `Metrics` field is required. The framework records Prometheus metrics for every condition state transition during
reconciliation. The recorder implementation is provided by
[go-crd-condition-metrics](https://github.com/sourcehawk/go-crd-condition-metrics).
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

The text says metrics are recorded for every condition state transition, but the current implementation calls the Metrics recorder every time setStatusCondition runs (even when the condition didn’t change). Consider rewording to reflect that the recorder is invoked on each reconciliation/condition set, with transitions reflected via LastTransitionTime rather than being the only time RecordConditionFor is called.

Suggested change
The `Metrics` field is required. The framework records Prometheus metrics for every condition state transition during
reconciliation. The recorder implementation is provided by
[go-crd-condition-metrics](https://github.com/sourcehawk/go-crd-condition-metrics).
The `Metrics` field is required. The framework invokes the Prometheus metrics recorder whenever it updates a component
condition during reconciliation; condition state transitions are reflected via each condition's `LastTransitionTime`.
The recorder implementation is provided by [go-crd-condition-metrics](https://github.com/sourcehawk/go-crd-condition-metrics).

Copilot uses AI. Check for mistakes.
Comment on lines 144 to 148
Client: r.Client,
Scheme: r.Scheme,
Recorder: r.Recorder,
Metrics: r.Metrics,
Owner: owner,
Copy link

Copilot AI Mar 26, 2026

Choose a reason for hiding this comment

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

The Quick Start snippet now references r.Metrics, but README doesn’t explain what this is or how to construct a component.Recorder (e.g., via go-crd-condition-metrics) or what a minimal/no-op implementation looks like for users who don’t want metrics. Adding a short note/link near this snippet would prevent copy/paste confusion.

Copilot uses AI. Check for mistakes.
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.

2 participants