Skip to content

Commit

Permalink
fix some aggregations, fix some double counted stuff, add in some mis… (
Browse files Browse the repository at this point in the history
  • Loading branch information
chadpatel authored Oct 5, 2023
1 parent f6bc8c0 commit 57616e4
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: [ ]
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: [ ]
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: [ ]
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
21 changes: 8 additions & 13 deletions translator/translate/otel/exporter/awsemf/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
}...)

}

Expand Down Expand Up @@ -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",
},
},
{
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
17 changes: 6 additions & 11 deletions translator/translate/otel/exporter/awsemf/translator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
},
},
{
Expand Down Expand Up @@ -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"}},
Expand Down Expand Up @@ -441,25 +441,20 @@ 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,
},
{
MetricName: "apiserver_storage_list_duration_seconds",
Unit: "Seconds",
Overwrite: true,
},
{
MetricName: "apiserver_storage_objects",
Unit: "Count",
Overwrite: true,
},
{
MetricName: "apiserver_storage_db_total_size_in_bytes",
Unit: "Bytes",
Expand Down

0 comments on commit 57616e4

Please sign in to comment.