Skip to content

refactor(edge): Create edge metrics with the instrumentation library - #1188

Merged
privateip merged 2 commits into
fix/issue-1149-ingressfrom
fix/issue-1149-edge
Oct 28, 2026
Merged

privateip merged 2 commits into
fix/issue-1149-ingressfrom
fix/issue-1149-edge

Conversation

@privateip

@privateip privateip commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Edge foundation's failure counters and its core and node collectors were registered on controller-runtime's registry directly, so the instrumentation library's checks skipped them.

One label on the failure counters has a name the collection pipeline sets on every series itself, so the library refuses it at startup. It is renamed with the same values, and the counters and collectors now go through the library.

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 (this PR)
  6. refactor(fabric): Create fabric routing metrics with the library #1189 fabric routing, onto refactor(edge): Create edge metrics with the instrumentation library #1188
  7. refactor(fabric-api): Create metrics with the instrumentation library #1190 fabric-api, onto refactor(fabric): Create fabric routing metrics with the library #1189

Breaking changes

galactic_edge_foundation_failures_total, galactic_edge_foundation_gate_closures_total and galactic_edge_foundation_cleanup_failures_total carry edge_role in place of component. No shipped alert rule, rule test or downstream copy of the rules reads it. The release notes need the rename.

Rolling back restores the old label name.

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 the edge and controller endpoints are identical before and after, apart from the renamed label.

Related to #1149, #1150

🤖 Generated with Claude Code

privateip and others added 2 commits October 28, 2026 10:22
The Edge foundation's failure counters and the core and node
collectors were registered on controller-runtime's registry directly,
so the instrumentation library's checks skipped them.

The failure counters carried a component constant label naming the
emitting role. The collection pipeline sets component on every series
from the pod's labels, so the library refuses it. The label is now
edge_role, with the same values: core from galactic-controller and
node from galactic-edge. No shipped alert rule or rule test reads it.

- diag.NewMetrics takes only the role and creates the counters with
  the library's constructors. The library's registry keeps a series
  across calls, so each call starts the role's counters over.
- The state and node collectors register through
  metrics.MustRegister.
- diagtest.New returns a Gatherer reading back only that role's
  counters from the library's registry, in place of a private
  registry.

The scrape tests create the series run creates and lint them, and the
controller's test includes the state collector over an empty cluster.

Refs: #1149

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Edge state 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-edge branch from 46ad063 to 99f7136 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.

One exported series changes shape: the three galactic_edge_foundation_* counters (failures_total, gate_closures_total, cleanup_failures_total) swap their constant label component for edge_role, because component is reserved by the collection pipeline and the library panics on it. The names, other labels and values are unchanged.

  • Infra impact: the only consumer is the staging GalacticEdgeCleanupFailing rule, which filters on job and never mentions component, so it keeps working. A firing instance would carry a new label set and go pending again for its 15m for; staging only.
  • No infra dashboard, recording rule or other alert references galactic_edge_foundation_failures_total or _gate_closures_total; out-of-repo consumers of the component label on these three would break.
  • NewMetrics(role) resets the role's series on each call and is called once per process; StateCollector and agent.Collector register via MustRegister on the manager's registry.

Follow-ups:

  • Note the component to edge_role rename in the release notes so anyone with an out-of-repo query can update it.

@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-edge 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