Repository navigation
test(otel): check node and pod labels, the attribute schema and KSM zones against the cluster - #793
Open
petruanica wants to merge 1 commit into
Open
petruanica wants to merge 1 commit into
petruanica wants to merge 1 commit into
Conversation
This was referenced Oct 29, 2026
Closed
petruanica
force-pushed
the
otel-ci-label-schema-zone-checks
branch
from
November 5, 2026 18:09
469d0d3 to
05058b2
Compare
This was referenced Nov 9, 2026
…ones against the cluster
petruanica
force-pushed
the
otel-ci-label-schema-zone-checks
branch
from
November 9, 2026 18:28
05058b2 to
a3f5cea
Compare
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.
Description of the issue
The OTel suites test that some attributes exist on some series. Three gaps remain.
Description of changes
Reverse label reconciliation (
util/otelmetrics/label_reconcile.go,test/otel/standard/labels_reverse_test.go).TestNodeLabelsReachMetricsandTestPodLabelsReachMetricsstart from the Kubernetes API. They list the nodes and pods, and they read theawsattributelimitdenylist from each agent's ConfigMap. Each test has two subtests, one per label path:kube_node_infoandkube_pod_info.k8s.node.cpu.usageandk8s.pod.cpu.usage.Every label that the denylist does not match must arrive with the same value. Every label that it matches must not arrive. Every object that a path reports must have a series. On the cluster scraper path, that is every node and pod. On the node agent path, it is every node with a ready agent pod, and the running pods on those nodes. If an object fails two passes 90 seconds apart, the test reports it. One failed pass is not enough, because a label change reaches the API before the next collection. The test skips a series at the attribute cap, because the cap can explain a missing label.
If a denylist entry removes an attribute in
NeverDeniedKeysor underNeverDeniedPrefixes,TestDenylistSparesNeverDeniedAttributesfails. When the processor trims a series to the cap, it keeps these attributes. Its unconditional removal runs before that step, so a denylist entry removes them anyway.Closed attribute schema (
util/otelmetrics/attribute_schema.go,util/otelmetrics/schema_keys.go, andTestAttributeSchemain the standard, gpu, neuron and efa suites). Each metric group declares its required, expected and optional keys. It also declares open prefixes, such ask8s.node.label., and implications, such as "k8s.node.uidrequirescloud.availability_zone".TestAttributeSchematests every series of every metric in the group. It fails for an undeclared key, a missing required key or a broken implication. A chart change that adds or removes an attribute turns these tests red until someone edits the matching schema row. That is the intent.KSM zones (
test/otel/standard/ksm_availability_zone_test.go). On every kube-state-metrics series,cloud.availability_zonemust be the zone of the node that the series names. The zone comes from the node metadata enricher or the node's zone label, and a pod's own zone label replaces it. A series of a known node with a zone label must carry a zone. A series that names no node, such as a Deployment series, must carry none. This covers aws-observability/helm-charts#405.This is PR 2 of 4. It builds on PR 1.
License
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Tests
The unit tests in
util/otelmetricsrun without a cluster and pass with-race.attribute_schema_test.gocovers key schemas, implications and tallies.label_reconcile_test.gocovers denylist parsing, label reconciliation, the attribute cap, never-denied violations, object reconciliation and objects without a series.go vet -tags integrationpasses onutil/otelmetricsand on every package undertest/otel.gofmtreports nothing, andmake compilepasses.These tests ran against an EKS test cluster at the top of this stack (PR 4), with the chart from aws-observability/helm-charts main:
TestDenylistSparesNeverDeniedAttributespasses for both agents.TestAttributeSchemapasses in the standard and gpu suites. The neuron and efa schema tests were not part of this run.PR Checklist
makepasses locally (build, unit tests, lint):make compileandmake simple-lint, the targets that the build-check workflow runs, pass on this commit, and so do theutil/otelmetricsunit tests with-race.NeverDeniedKeys), and links back here.