Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme committed Oct 6, 2023
1 parent d742c46 commit adc1af3
Show file tree
Hide file tree
Showing 2 changed files with 549 additions and 738 deletions.
37 changes: 35 additions & 2 deletions e2e_tests/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func Test_NodeJSTraces(t *testing.T) {
func Test_KubernetesClusterReceiverMetrics(t *testing.T) {
metricsConsumer := setupOnce(t).k8sclusterReceiverMetricsConsumer

waitForMetrics(t, 10, metricsConsumer)
waitForMetrics(t, 5, metricsConsumer)

expectedMetricsFile := filepath.Join("testdata", "expected_cluster_receiver.yaml")
expectedMetrics, err := readMetrics(expectedMetricsFile)
Expand All @@ -231,11 +231,32 @@ OUTER:
}
require.True(t, metricToCompare.MetricCount() > 0)

metricNames := []string{
"k8s.node.condition_ready",
"k8s.namespace.phase",
"k8s.daemonset.desired_scheduled_nodes",
"k8s.replicaset.desired",
"k8s.replicaset.available",
"k8s.pod.phase",
"k8s.daemonset.ready_nodes",
"k8s.daemonset.misscheduled_nodes",
"k8s.daemonset.current_scheduled_nodes",
"k8s.container.restarts",
"k8s.container.ready",
"k8s.container.cpu_limit",
"k8s.deployment.desired",
"k8s.deployment.available",
"k8s.container.restarts",
"k8s.container.cpu_request",
"k8s.container.memory_request",
"k8s.container.memory_limit",
}

require.NoError(t,
pmetrictest.CompareMetrics(expectedMetrics, metricToCompare,
pmetrictest.IgnoreTimestamp(),
pmetrictest.IgnoreStartTimestamp(),
pmetrictest.IgnoreMetricValues("k8s.deployment.desired", "k8s.deployment.available", "k8s.container.restarts", "k8s.container.cpu_request", "k8s.container.memory_request", "k8s.container.memory_limit"),
pmetrictest.IgnoreMetricValues(metricNames...),
pmetrictest.ChangeResourceAttributeValue("k8s.deployment.name", shortenNames),
pmetrictest.ChangeResourceAttributeValue("k8s.pod.name", shortenNames),
pmetrictest.ChangeResourceAttributeValue("k8s.replicaset.name", shortenNames),
Expand All @@ -246,13 +267,25 @@ OUTER:
pmetrictest.ChangeResourceAttributeValue("container.image.tag", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("k8s.node.uid", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("k8s.namespace.uid", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("k8s.node.uid", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("k8s.daemonset.uid", replaceWithStar),
pmetrictest.ChangeResourceAttributeValue("container.image.name", containerImageShorten),
pmetrictest.ChangeResourceAttributeValue("container.id", replaceWithStar),
pmetrictest.IgnoreScopeVersion(),
pmetrictest.IgnoreResourceMetricsOrder(),
pmetrictest.IgnoreMetricsOrder(),
pmetrictest.IgnoreScopeMetricsOrder(),
pmetrictest.IgnoreMetricAttributeValue("container.id", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("container.image.name", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("container.image.tag", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.pod.name", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.pod.uid", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.deployment.uid", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.replicaset.uid", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.replicaset.name", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.daemonset.uid", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.namespace.uid", metricNames...),
pmetrictest.IgnoreMetricAttributeValue("k8s.node.uid", metricNames...),
pmetrictest.IgnoreMetricDataPointsOrder(),
),
)
Expand Down
Loading

0 comments on commit adc1af3

Please sign in to comment.