Skip to content

Commit

Permalink
[chore] add test showing what hostmetrics metrics we capture (#1422)
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme authored Aug 28, 2024
1 parent b2a318c commit 110fc46
Show file tree
Hide file tree
Showing 2 changed files with 6,663 additions and 0 deletions.
25 changes: 25 additions & 0 deletions functional_tests/functional_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1084,6 +1084,31 @@ func testAgentMetrics(t *testing.T) {
"up",
}
checkMetricsAreEmitted(t, agentMetricsConsumer, metricNames, nil)

expectedHostmetricsMetrics, err := golden.ReadMetrics(filepath.Join(testDir, expectedValuesDir, "expected_hostmetrics_metrics.yaml"))
require.NoError(t, err)
selectHostmetricsMetrics := selectMetricSet(expectedHostmetricsMetrics, "system.filesystem.usage", agentMetricsConsumer, false)
require.NotNil(t, selectHostmetricsMetrics)

err = pmetrictest.CompareMetrics(expectedHostmetricsMetrics, *selectHostmetricsMetrics,
pmetrictest.IgnoreTimestamp(),
pmetrictest.IgnoreStartTimestamp(),
pmetrictest.IgnoreResourceAttributeValue("device"),
pmetrictest.IgnoreMetricAttributeValue("k8s.pod.uid", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.pod.name", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("device", "system.network.errors", "system.network.io", "disk.utilization", "system.filesystem.usage", "system.disk.operations"),
pmetrictest.IgnoreMetricAttributeValue("mode", "system.filesystem.usage"),
pmetrictest.IgnoreMetricAttributeValue("direction", "system.network.errors", "system.network.io"),
pmetrictest.IgnoreSubsequentDataPoints("system.disk.operations", "system.network.errors", "system.network.io"),
pmetrictest.IgnoreMetricValues(),
pmetrictest.IgnoreScopeVersion(),
pmetrictest.IgnoreResourceMetricsOrder(),
pmetrictest.IgnoreMetricsOrder(),
pmetrictest.IgnoreScopeMetricsOrder(),
pmetrictest.IgnoreMetricDataPointsOrder(),
)
assert.NoError(t, err)

expectedInternalMetrics, err := golden.ReadMetrics(filepath.Join(testDir, expectedValuesDir, "expected_internal_metrics.yaml"))
require.NoError(t, err)

Expand Down
Loading

0 comments on commit 110fc46

Please sign in to comment.