Repository navigation
refactor(router): Create router metrics with the instrumentation library - #1185
Merged
Merged
Conversation
This was referenced Oct 28, 2026
11 tasks
galactic-router registered its service route metrics, its BMP station gauge and the traffic policy collector on controller-runtime's registry directly, so the instrumentation library's reserved-label check and lint skipped them. - The service route metrics are created by the library's constructors when run calls serviceroute.NewMetrics, as before. - galactic_router_bmp_station_up moves from package main to internal/runtime/gobgp, beside the route install gauge, because the lint can only link metrics defined outside a main package. The observer the BMP keeper calls moves with it. - The traffic policy collector registers through metrics.MustRegister. The lint linking check no longer counts metrics.MustRegister as creating a metric. Lint checks only what the library's constructors create, so a custom collector registered in a main package is never something it could see. The scrape test creates the service route metrics before scraping and lints them. The endpoint's series are unchanged. Refs: #1149 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
privateip
force-pushed
the
fix/issue-1149-router
branch
from
October 28, 2026 14:22
b38bbed to
48ca043
Compare
privateip
marked this pull request as ready for review
October 28, 2026 14:58
scotwells
approved these changes
Oct 28, 2026
ecv
approved these changes
Oct 28, 2026
ecv
left a comment
Contributor
There was a problem hiding this comment.
Approve.
galactic_router_bmp_station_up{router,station} and the five galactic_service_route_* series are unchanged in name, type, labels and buckets (DefBuckets kept), and still land on the registry the manager serves.
- The BMP gauge moved from
cmd/galactic-routerintointernal/runtime/gobgpand now loads in every binary linkinggobgp. It is a vector with no children outside the router, so no series appear elsewhere. - Infra only references the BMP gauge by name in alerts; nothing renamed.
- The traffic-policy collector is now
MustRegistered rather than returning an error; it was registered on the same registry before, so the failure mode is only louder.
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
galactic-router registered its service route metrics, BMP station gauge and traffic policy collector on controller-runtime's registry directly, so the instrumentation library's checks skipped them.
They now go through the library. The BMP gauge moves out of the command's main package, which the library's lint can't reach.
The router's scrape test now creates the service route metrics before scraping and lints them.
Stack
Merge in order:
Compatibility
The router 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