Skip to content

feat(monitoring): stamp EC2-compat labels on ServiceMonitor#123

Merged
bdchatham merged 1 commit intomainfrom
feat/ec2-compat-labels-servicemonitor
Apr 22, 2026
Merged

feat(monitoring): stamp EC2-compat labels on ServiceMonitor#123
bdchatham merged 1 commit intomainfrom
feat/ec2-compat-labels-servicemonitor

Conversation

@bdchatham
Copy link
Copy Markdown
Collaborator

What

Copy the k8s-scraped pod label into legacy EC2 labels instance_name and public_dns via metricRelabelings on the controller-emitted ServiceMonitor.

Why

During the EC2 → k8s migration for sei-chain nodes, our Grafana dashboards filter on EC2-only labels (instance_name, public_dns) that Prometheus's EC2 service discovery stamps onto scraped samples. K8s-scraped pods don't have these labels, so panels like Block Size, Blocks Behind, IAVL Tree Size, and Chain State Growth show nothing for k8s-managed nodes (e.g. the v6-5 soak chain).

Stamping the k8s pod name into these labels (semantically dishonest but pragmatically effective) lets every existing dashboard query work across both scrape paths without any dashboard changes.

Migration path

This is a compatibility shim with a clear end state, tracked in #122:

  1. Now: controller stamps both labels; EC2 + k8s views unify.
  2. When EC2 scraping is decommissioned: migrate dashboards from instance_name/public_dnspod in one sweep.
  3. Afterwards: delete the two compat rules (clearly marked with TODO(#122) in endpointSpec).

Tests

  • New: TestGenerateServiceMonitor_EC2CompatLabels — asserts both rules are always emitted.
  • Renamed: TestGenerateServiceMonitor_NoRelabelingsWhenNothingDerivable..._OnlyEC2CompatWhenNothingDerivable — asserts compat rules are present even when component/chain_id can't be derived.
  • New helper: findSourceRelabeling for rules that use sourceLabels instead of replacement.

Test plan

  • go test ./internal/controller/nodedeployment/ passes
  • After merge + image bump: verify on prod v6-5-run-3 that scraped samples carry instance_name/public_dns labels matching pod names, and that Block Size / Blocks Behind panels populate

🤖 Generated with Claude Code

Copies the k8s-scraped `pod` label into legacy EC2 labels `instance_name`
and `public_dns` via metricRelabelings, so dashboards filtering on those
labels (block size, blocks behind, IAVL/chain-state-growth, etc.) show
a unified picture across EC2 and k8s during the migration.

This is a temporary shim; removal tracked in #122 for when EC2 scrapes
for sei-chain nodes are decommissioned.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bdchatham bdchatham merged commit 2b2aed1 into main Apr 22, 2026
2 checks passed
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.

1 participant