feat(monitoring): stamp EC2-compat labels on ServiceMonitor#123
Merged
feat(monitoring): stamp EC2-compat labels on ServiceMonitor#123
Conversation
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>
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.
What
Copy the k8s-scraped
podlabel into legacy EC2 labelsinstance_nameandpublic_dnsviametricRelabelingson 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:
instance_name/public_dns→podin one sweep.TODO(#122)inendpointSpec).Tests
TestGenerateServiceMonitor_EC2CompatLabels— asserts both rules are always emitted.TestGenerateServiceMonitor_NoRelabelingsWhenNothingDerivable→..._OnlyEC2CompatWhenNothingDerivable— asserts compat rules are present even when component/chain_id can't be derived.findSourceRelabelingfor rules that usesourceLabelsinstead ofreplacement.Test plan
go test ./internal/controller/nodedeployment/passesv6-5-run-3that scraped samples carryinstance_name/public_dnslabels matching pod names, and that Block Size / Blocks Behind panels populate🤖 Generated with Claude Code