Repository navigation
refactor(vrf): Create ingress sidecar metrics with the library - #1187
Merged
Merged
Conversation
This was referenced Oct 28, 2026
privateip
force-pushed
the
fix/issue-1149-ingress
branch
from
October 28, 2026 14:14
3263a9c to
8cdeb49
Compare
11 tasks
The ingress sidecar built seven metric types unregistered and registered each on controller-runtime's registry at startup, so the instrumentation library's reserved-label check and lint skipped them. - Every counter, gauge and histogram is created by the library's constructors. The library's registry keeps a series across constructions, so each constructor starts its series over, as an unregistered value used to: vectors are reset, gauges set to their initial value, and the label-free counters and histograms are held as vectors with no labels so they can be reset too. - The three types that own a custom collector (startup stage, datapath check and node source address status) keep a MustRegister method, now without a registry, which registers it through the library once per process. The other MustRegister methods are gone. - galactic-vrf creates all of them in newSidecarMetrics, which its scrape test also calls, so the test scrapes and lints every series the sidecar serves. Tests register a type's collectors on their own registry, as before, so each reads only the series it set up. The endpoint exports the same series as before. Refs: #1149 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
newSidecarMetrics registers three custom collectors, which a process can register once, as runCmd does. TestMetricsScrape called it on every run, so a second run in the same test process, such as go test -count=2, panicked on the duplicate. Its setup now runs once. Refs: #1149 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
privateip
force-pushed
the
fix/issue-1149-ingress
branch
from
October 28, 2026 14:22
8cdeb49 to
be404a1
Compare
privateip
marked this pull request as ready for review
October 28, 2026 14:58
scotwells
previously approved these changes
Oct 28, 2026
ecv
previously approved these changes
Oct 28, 2026
ecv
left a comment
Contributor
There was a problem hiding this comment.
Approve.
All galactic_sidecar_* series keep their names, labels and buckets. Counters and histograms that had no labels are now created as zero-label vectors and re-fetched with WithLabelValues(), which exposes the identical un-labelled series at zero.
- Each constructor does its
Reset()before seeding the label values, so the zero-valued series that rate queries rely on are still present at startup. - The status collectors (
stageStatus, datapathstatus, node-sourcecheck) are still registered once, viaMustRegister. - Re-running a constructor resets the shared series and detaches the earlier handle. Safe because
runCmdbuilds them once, but a second call in production would silently orphan the counters in use.
privateip
dismissed stale reviews from ecv and scotwells
October 28, 2026 15:06
The merge-base changed after approval.
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.
Summary
The ingress sidecar built seven metric types unregistered and registered each on controller-runtime's registry at startup, so the instrumentation library's checks skipped them.
They are now created by the library, and the three custom collectors register through it once per process.
The library keeps a series across constructions, so each constructor now starts its series over, which keeps every test reading only the series it set up.
Stack
Merge in order:
Compatibility
The sidecar endpoint exports the same families as before. Rolling back restores the previous code with no other effect.
Test plan
Related to #1149
🤖 Generated with Claude Code