Repository navigation
Add secure opt-in fleet metrics and Git synchronization reporting - #419
Merged
Merged
Conversation
|
Sorry @cooktheryan, you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 3 days and 17 hours by commenting |
Reviewer's GuideThis PR adds an opt-in, dedicated Prometheus endpoint that reports secure fleet-level Git synchronization state and freshness without exposing repository metadata, integrates generation-safe reconciliation observations across reloads and failures, propagates validated host identity through metrics and status APIs, and validates the behavior through unit/race tests, CI integration, documentation, and real Podman scenarios. Sequence diagram for Git reconciliation metrics reportingsequenceDiagram
participant Scheduler
participant Method
participant Metrics
participant Git
participant Target
Scheduler->>Metrics: begin(ctx, m)
Scheduler->>Method: Process(ctx, conn, skew)
Method->>Git: fetch latest revision
Git-->>Method: latest revision
Method->>Metrics: observeGit(ctx, unknown, true)
Method->>Target: getCurrent(...)
Target-->>Method: current revision
Method->>Metrics: observeGit(ctx, out_of_sync, false)
alt application succeeds or baseline is complete
Method->>Target: applyWithRecovery(...)
Method->>Metrics: observeGit(ctx, synced, false)
else source, clone, replay, or application failure
Method-->>Scheduler: reconciliation error
end
Note over Metrics: Scrapes read registry memory only
Flow diagram for secure fleet metric collectionflowchart TD
Start[FetchIt starts] --> Host[configuredHostname]
Host --> Registry["metrics.replace(methods, hostname)"]
Registry --> OptIn{FETCHIT_METRICS_ADDR configured?}
OptIn -->|no| Run[Run configured methods]
OptIn -->|yes| Listener[startMetricsServer]
Listener --> Endpoint[GET /metrics]
Endpoint --> Snapshot[Read registry memory under lock]
Snapshot --> Labels[Emit bounded kind and state labels]
Labels --> Output[Emit configured counts, Git sync state, freshness, hostname]
Run --> Observe[Reconciliation observations update registry]
Observe --> Snapshot
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Signed-off-by: Ryan Cook <rcook@redhat.com>
cooktheryan
force-pushed
the
feat/418-fleet-metrics
branch
from
October 11, 2026 20:27
291615b to
e5e7a80
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FetchIt previously exposed liveness and invocation attempts, leaving fleet operators unable to tell whether configured Git methods had applied the latest observed revision. Add an opt-in Prometheus
/metricslistener reporting configured method counts, synchronized/out-of-sync/unknown counts, observation freshness, and host identity.The dedicated
FETCHIT_METRICS_ADDRlistener exposes only metrics, avoiding publication of the existing status endpoint's repository URLs.FETCHIT_HOSTNAMEidentifies the underlying host in metrics, response headers, and status JSON. Scrapes read memory and do not invoke Git or Podman; labels exclude repository URLs, method names, paths, credentials, error text, and revision SHAs. The guide documents explicit port publication, trusted-network access restrictions, the absence of native TLS/authentication, an existing remote Prometheus scrape configuration, and alert examples.Git reconciliation explicitly records observations and successful application/baseline completion. Failed application, rollback, and skipped bad commits remain out of sync; clone/replay/source failures remain unknown. Failed source checks retain their previous observation timestamp. Generation and run tokens reject retired or superseded results. Disconnected/non-Git methods are counted as configured declarations but excluded from connected Git synchronization counts.
Validation:
go vetpassed.promtool check rulespassed.promtool check metricspassed.Fixes #418.
Summary by Sourcery
Add secure opt-in fleet metrics and Git synchronization reporting for operators.
New Features:
Bug Fixes:
Enhancements:
CI:
Documentation:
Tests: