Skip to content

refactor(fabric): Create fabric routing metrics with the library - #1189

Merged
privateip merged 2 commits into
fix/issue-1149-edgefrom
fix/issue-1149-fabric-routing
Oct 28, 2026
Merged

privateip merged 2 commits into
fix/issue-1149-edgefrom
fix/issue-1149-fabric-routing

Conversation

@privateip

@privateip privateip commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

fabric-config-agent served a private registry holding the next-hop guard's and activation path's metrics, and fabric-router-controller registered its fleet collector on controller-runtime's registry directly, so the instrumentation library saw neither.

Both now go through the library, and the agent serves the library's handler.

Stack

Merge in order:

  1. refactor(cni): Create datapath metrics with the instrumentation library #1184 CNI datapath, onto main
  2. refactor(router): Create router metrics with the instrumentation library #1185 router, onto refactor(cni): Create datapath metrics with the instrumentation library #1184
  3. refactor(gateway,nat): Create metrics with the instrumentation library #1186 gateway and NAT, onto refactor(router): Create router metrics with the instrumentation library #1185
  4. refactor(vrf): Create ingress sidecar metrics with the library #1187 ingress sidecar, onto refactor(gateway,nat): Create metrics with the instrumentation library #1186
  5. refactor(edge): Create edge metrics with the instrumentation library #1188 edge, onto refactor(vrf): Create ingress sidecar metrics with the library #1187
  6. refactor(fabric): Create fabric routing metrics with the library #1189 fabric routing, onto refactor(edge): Create edge metrics with the instrumentation library #1188 (this PR)
  7. refactor(fabric-api): Create metrics with the instrumentation library #1190 fabric-api, onto refactor(fabric): Create fabric routing metrics with the library #1189

Compatibility

The agent's endpoint keeps every series and adds only the build-info series. The controller's endpoint is unchanged. Rolling back restores the previous code with no other effect.

Test plan

  • Lint, build, unit and alert rule tests pass on this layer. The end-to-end and root-only suites run in CI.
  • Series inventories of both endpoints show no family removed or retyped.

Related to #1149

🤖 Generated with Claude Code

privateip and others added 2 commits October 28, 2026 10:22
fabric-config-agent served a private registry holding the next-hop
guard's and the activation path's metrics, and fabric-router-controller
registered its fleet collector on controller-runtime's registry
directly. The instrumentation library's checks saw neither.

- NewNextHopMetrics and NewAgentMetrics create their series with the
  library's constructors. The library's registry keeps a series across
  calls, so each call starts its vectors over. NextHopMetrics no longer
  carries a registry or a handler.
- fabric-config-agent serves metrics.Handler at /metrics. The endpoint
  keeps every series it had and adds instrumentation_build_info.
- The fleet collector registers through metrics.MustRegister.

The agent's scrape test creates its series first and lints them. The
controller's test registers the fleet collector, which emits nothing
until it leads, to check that its descriptors fit beside the rest.

Refs: #1149

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fleet collector can be registered once per process, as run does.
TestMetricsScrape registered 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
privateip force-pushed the fix/issue-1149-fabric-routing branch from 187fc3a to 01c4d9d Compare October 28, 2026 14:22
@privateip
privateip marked this pull request as ready for review October 28, 2026 14:58
@privateip
privateip requested a review from a team as a code owner October 28, 2026 14:58
scotwells
scotwells previously approved these changes Oct 28, 2026
ecv
ecv previously approved these changes Oct 28, 2026

@ecv ecv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approve.

Next-hop guard, agent activation and fleet metrics keep their names, labels and buckets. fabric-config-agent now serves the library's handler at /metrics, so the series the agent exposes are the same ones, on the registry the constructors now use.

  • /metrics gains Go, process and instrumentation_build_info series, which the private registry did not have. Additive.
  • The fleet collector in fabric-router-controller is MustRegistered on the manager's registry as before; only the failure mode changes (panic instead of a returned error).
  • NewNextHopMetrics and NewAgentMetrics reset their vectors on each call; each is called once in newMetrics.

@privateip
privateip dismissed stale reviews from ecv and scotwells October 28, 2026 15:06

The merge-base changed after approval.

@privateip
privateip merged commit 23de5d9 into main Oct 28, 2026
23 checks passed
@privateip
privateip deleted the fix/issue-1149-fabric-routing branch October 28, 2026 15:07
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.

3 participants