From 57616e42649485ad6064e94c5a17927e727eba8d Mon Sep 17 00:00:00 2001 From: Chad Patel Date: Thu, 5 Oct 2023 16:09:32 -0500 Subject: [PATCH] =?UTF-8?q?fix=20some=20aggregations,=20fix=20some=20doubl?= =?UTF-8?q?e=20counted=20stuff,=20add=20in=20some=20mis=E2=80=A6=20(#891)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../emf_and_kubernetes_config.yaml | 14 ++++++------- .../kubernetes_on_prem_config.yaml | 14 ++++++------- .../logs_and_kubernetes_config.yaml | 14 ++++++------- .../otel/exporter/awsemf/kubernetes.go | 21 +++++++------------ .../otel/exporter/awsemf/translator_test.go | 17 ++++++--------- 5 files changed, 35 insertions(+), 45 deletions(-) diff --git a/translator/tocwconfig/sampleConfig/emf_and_kubernetes_config.yaml b/translator/tocwconfig/sampleConfig/emf_and_kubernetes_config.yaml index 72e0e72ccd..a2f0bb3c7d 100644 --- a/translator/tocwconfig/sampleConfig/emf_and_kubernetes_config.yaml +++ b/translator/tocwconfig/sampleConfig/emf_and_kubernetes_config.yaml @@ -50,6 +50,8 @@ exporters: metric_name_selectors: - container_cpu_utilization - container_cpu_utilization_over_container_limit + - container_cpu_limit + - container_cpu_request - container_memory_utilization - container_memory_utilization_over_container_limit - container_memory_failures_total @@ -99,6 +101,8 @@ exporters: - pod_status_succeeded - pod_memory_request - pod_memory_limit + - pod_cpu_limit + - pod_cpu_request # node metrics - dimensions: [ [ ClusterName, InstanceId, NodeName ], [ ClusterName ] ] label_matchers: [ ] @@ -174,7 +178,6 @@ exporters: - apiserver_storage_size_bytes - apiserver_storage_db_total_size_in_bytes - etcd_db_total_size_in_bytes - - etcd_request_duration_seconds - dimensions: [ [ClusterName, resource], [ ClusterName ] ] label_matchers: [ ] metric_name_selectors: @@ -255,6 +258,9 @@ exporters: - metric_name: apiserver_request_total_5xx unit: Count overwrite: true + - metric_name: apiserver_requested_deprecated_apis + unit: Count + overwrite: true - metric_name: apiserver_storage_objects unit: Count overwrite: true @@ -264,9 +270,6 @@ exporters: - metric_name: apiserver_storage_list_duration_seconds unit: Seconds overwrite: true - - metric_name: apiserver_storage_objects - unit: Count - overwrite: true - metric_name: apiserver_storage_db_total_size_in_bytes unit: Bytes overwrite: true @@ -276,9 +279,6 @@ exporters: - metric_name: etcd_db_total_size_in_bytes unit: Bytes overwrite: true - - metric_name: etcd_request_duration_seconds - unit: Seconds - overwrite: true - metric_name: rest_client_request_duration_seconds unit: Seconds overwrite: true diff --git a/translator/tocwconfig/sampleConfig/kubernetes_on_prem_config.yaml b/translator/tocwconfig/sampleConfig/kubernetes_on_prem_config.yaml index 6c57b41bc5..9e94b187ec 100644 --- a/translator/tocwconfig/sampleConfig/kubernetes_on_prem_config.yaml +++ b/translator/tocwconfig/sampleConfig/kubernetes_on_prem_config.yaml @@ -21,6 +21,8 @@ exporters: metric_name_selectors: - container_cpu_utilization - container_cpu_utilization_over_container_limit + - container_cpu_limit + - container_cpu_request - container_memory_utilization - container_memory_utilization_over_container_limit - container_memory_failures_total @@ -70,6 +72,8 @@ exporters: - pod_status_succeeded - pod_memory_request - pod_memory_limit + - pod_cpu_limit + - pod_cpu_request # node metrics - dimensions: [ [ ClusterName, InstanceId, NodeName ], [ ClusterName ] ] label_matchers: [ ] @@ -145,7 +149,6 @@ exporters: - apiserver_storage_size_bytes - apiserver_storage_db_total_size_in_bytes - etcd_db_total_size_in_bytes - - etcd_request_duration_seconds - dimensions: [ [ ClusterName, resource ], [ ClusterName ] ] label_matchers: [ ] metric_name_selectors: @@ -226,6 +229,9 @@ exporters: - metric_name: apiserver_request_total_5xx unit: Count overwrite: true + - metric_name: apiserver_requested_deprecated_apis + unit: Count + overwrite: true - metric_name: apiserver_storage_objects unit: Count overwrite: true @@ -235,9 +241,6 @@ exporters: - metric_name: apiserver_storage_list_duration_seconds unit: Seconds overwrite: true - - metric_name: apiserver_storage_objects - unit: Count - overwrite: true - metric_name: apiserver_storage_db_total_size_in_bytes unit: Bytes overwrite: true @@ -247,9 +250,6 @@ exporters: - metric_name: etcd_db_total_size_in_bytes unit: Bytes overwrite: true - - metric_name: etcd_request_duration_seconds - unit: Seconds - overwrite: true - metric_name: rest_client_request_duration_seconds unit: Seconds overwrite: true diff --git a/translator/tocwconfig/sampleConfig/logs_and_kubernetes_config.yaml b/translator/tocwconfig/sampleConfig/logs_and_kubernetes_config.yaml index 888495f51b..ef2fa0539d 100644 --- a/translator/tocwconfig/sampleConfig/logs_and_kubernetes_config.yaml +++ b/translator/tocwconfig/sampleConfig/logs_and_kubernetes_config.yaml @@ -50,6 +50,8 @@ exporters: metric_name_selectors: - container_cpu_utilization - container_cpu_utilization_over_container_limit + - container_cpu_limit + - container_cpu_request - container_memory_utilization - container_memory_utilization_over_container_limit - container_memory_failures_total @@ -99,6 +101,8 @@ exporters: - pod_status_succeeded - pod_memory_request - pod_memory_limit + - pod_cpu_limit + - pod_cpu_request # node metrics - dimensions: [ [ ClusterName, InstanceId, NodeName ], [ ClusterName ] ] label_matchers: [ ] @@ -174,7 +178,6 @@ exporters: - apiserver_storage_size_bytes - apiserver_storage_db_total_size_in_bytes - etcd_db_total_size_in_bytes - - etcd_request_duration_seconds - dimensions: [ [ ClusterName, resource ], [ ClusterName ] ] label_matchers: [ ] metric_name_selectors: @@ -255,6 +258,9 @@ exporters: - metric_name: apiserver_request_total_5xx unit: Count overwrite: true + - metric_name: apiserver_requested_deprecated_apis + unit: Count + overwrite: true - metric_name: apiserver_storage_objects unit: Count overwrite: true @@ -264,9 +270,6 @@ exporters: - metric_name: apiserver_storage_list_duration_seconds unit: Seconds overwrite: true - - metric_name: apiserver_storage_objects - unit: Count - overwrite: true - metric_name: apiserver_storage_db_total_size_in_bytes unit: Bytes overwrite: true @@ -276,9 +279,6 @@ exporters: - metric_name: etcd_db_total_size_in_bytes unit: Bytes overwrite: true - - metric_name: etcd_request_duration_seconds - unit: Seconds - overwrite: true - metric_name: rest_client_request_duration_seconds unit: Seconds overwrite: true diff --git a/translator/translate/otel/exporter/awsemf/kubernetes.go b/translator/translate/otel/exporter/awsemf/kubernetes.go index 342cd985a4..1e28913f5b 100644 --- a/translator/translate/otel/exporter/awsemf/kubernetes.go +++ b/translator/translate/otel/exporter/awsemf/kubernetes.go @@ -60,7 +60,7 @@ func getContainerMetricDeclarations(conf *confmap.Conf) []*awsemfexporter.Metric metricDeclaration := awsemfexporter.MetricDeclaration{ Dimensions: [][]string{{"ClusterName"}, {"ContainerName", "FullPodName", "PodName", "Namespace", "ClusterName"}, {"ContainerName", "PodName", "Namespace", "ClusterName"}}, MetricNameSelectors: []string{ - "container_cpu_utilization", "container_cpu_utilization_over_container_limit", + "container_cpu_utilization", "container_cpu_utilization_over_container_limit", "container_cpu_limit", "container_cpu_request", "container_memory_utilization", "container_memory_utilization_over_container_limit", "container_memory_failures_total", "container_memory_limit", "container_memory_request", "container_filesystem_usage", "container_filesystem_available", "container_filesystem_utilization", "container_status_running", "container_status_terminated", "container_status_waiting", "container_status_waiting_reason_crash_loop_back_off", @@ -94,7 +94,8 @@ func getPodMetricDeclarations(conf *confmap.Conf) []*awsemfexporter.MetricDeclar podMetricDeclarations[0].Dimensions = append(podMetricDeclarations[0].Dimensions, []string{"FullPodName", "PodName", "Namespace", "ClusterName"}) selectors = append(selectors, []string{"pod_number_of_container_restarts", "pod_number_of_containers", "pod_number_of_running_containers", "pod_status_ready", "pod_status_scheduled", "pod_status_running", "pod_status_pending", "pod_status_failed", "pod_status_unknown", - "pod_status_succeeded", "pod_memory_request", "pod_memory_limit"}...) + "pod_status_succeeded", "pod_memory_request", "pod_memory_limit", "pod_cpu_limit", "pod_cpu_request", + }...) } @@ -272,7 +273,6 @@ func getControlPlaneMetricDeclarations(conf *confmap.Conf) []*awsemfexporter.Met "apiserver_storage_size_bytes", "apiserver_storage_db_total_size_in_bytes", "etcd_db_total_size_in_bytes", - "etcd_request_duration_seconds", }, }, { @@ -406,6 +406,11 @@ func getControlPlaneMetricDescriptors(conf *confmap.Conf) []awsemfexporter.Metri Unit: "Count", Overwrite: true, }, + { + MetricName: "apiserver_requested_deprecated_apis", + Unit: "Count", + Overwrite: true, + }, { MetricName: "apiserver_storage_objects", Unit: "Count", @@ -421,11 +426,6 @@ func getControlPlaneMetricDescriptors(conf *confmap.Conf) []awsemfexporter.Metri Unit: "Seconds", Overwrite: true, }, - { - MetricName: "apiserver_storage_objects", - Unit: "Count", - Overwrite: true, - }, { MetricName: "apiserver_storage_db_total_size_in_bytes", Unit: "Bytes", @@ -441,11 +441,6 @@ func getControlPlaneMetricDescriptors(conf *confmap.Conf) []awsemfexporter.Metri Unit: "Bytes", Overwrite: true, }, - { - MetricName: "etcd_request_duration_seconds", - Unit: "Seconds", - Overwrite: true, - }, { MetricName: "rest_client_request_duration_seconds", Unit: "Seconds", diff --git a/translator/translate/otel/exporter/awsemf/translator_test.go b/translator/translate/otel/exporter/awsemf/translator_test.go index 3029d4b03c..877b77d90b 100644 --- a/translator/translate/otel/exporter/awsemf/translator_test.go +++ b/translator/translate/otel/exporter/awsemf/translator_test.go @@ -267,7 +267,7 @@ func TestTranslator(t *testing.T) { { Dimensions: [][]string{{"ClusterName"}, {"ContainerName", "FullPodName", "PodName", "Namespace", "ClusterName"}, {"ContainerName", "PodName", "Namespace", "ClusterName"}}, MetricNameSelectors: []string{ - "container_cpu_utilization", "container_cpu_utilization_over_container_limit", + "container_cpu_utilization", "container_cpu_utilization_over_container_limit", "container_cpu_limit", "container_cpu_request", "container_memory_utilization", "container_memory_utilization_over_container_limit", "container_memory_failures_total", "container_memory_limit", "container_memory_request", "container_filesystem_usage", "container_filesystem_available", "container_filesystem_utilization", "container_status_running", "container_status_terminated", "container_status_waiting", "container_status_waiting_reason_crash_loop_back_off", @@ -294,7 +294,7 @@ func TestTranslator(t *testing.T) { Dimensions: [][]string{{"PodName", "Namespace", "ClusterName"}, {"ClusterName"}, {"FullPodName", "PodName", "Namespace", "ClusterName"}, {"Service", "Namespace", "ClusterName"}}, MetricNameSelectors: []string{"pod_cpu_reserved_capacity", "pod_memory_reserved_capacity", "pod_number_of_container_restarts", "pod_number_of_containers", "pod_number_of_running_containers", "pod_status_ready", "pod_status_scheduled", "pod_status_running", "pod_status_pending", "pod_status_failed", "pod_status_unknown", - "pod_status_succeeded", "pod_memory_request", "pod_memory_limit", + "pod_status_succeeded", "pod_memory_request", "pod_memory_limit", "pod_cpu_limit", "pod_cpu_request", }, }, { @@ -341,7 +341,7 @@ func TestTranslator(t *testing.T) { }, { Dimensions: [][]string{{"ClusterName", "endpoint"}, {"ClusterName"}}, - MetricNameSelectors: []string{"apiserver_storage_size_bytes", "apiserver_storage_db_total_size_in_bytes", "etcd_db_total_size_in_bytes", "etcd_request_duration_seconds"}, + MetricNameSelectors: []string{"apiserver_storage_size_bytes", "apiserver_storage_db_total_size_in_bytes", "etcd_db_total_size_in_bytes"}, }, { Dimensions: [][]string{{"ClusterName", "resource"}, {"ClusterName"}}, @@ -441,13 +441,13 @@ func TestTranslator(t *testing.T) { Overwrite: true, }, { - MetricName: "apiserver_storage_objects", + MetricName: "apiserver_requested_deprecated_apis", Unit: "Count", Overwrite: true, }, { - MetricName: "etcd_request_duration_seconds", - Unit: "Seconds", + MetricName: "apiserver_storage_objects", + Unit: "Count", Overwrite: true, }, { @@ -455,11 +455,6 @@ func TestTranslator(t *testing.T) { Unit: "Seconds", Overwrite: true, }, - { - MetricName: "apiserver_storage_objects", - Unit: "Count", - Overwrite: true, - }, { MetricName: "apiserver_storage_db_total_size_in_bytes", Unit: "Bytes",