Skip to content

Commit

Permalink
Implementing apiserver flowcontrol metrics (aws#829)
Browse files Browse the repository at this point in the history
  • Loading branch information
mitali-salvi authored Aug 29, 2023
1 parent 773bb41 commit 02ac7fb
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 26 deletions.
11 changes: 11 additions & 0 deletions translator/tocwconfig/sampleConfig/emf_and_kubernetes_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ exporters:
label_matchers: [ ]
metric_name_selectors:
- apiserver_storage_list_duration_seconds
- dimensions: [ [ClusterName, priority_level], [ ClusterName ] ]
label_matchers: [ ]
metric_name_selectors:
- apiserver_flowcontrol_request_concurrency_limit
- dimensions: [ [ ClusterName ] ]
label_matchers: [ ]
metric_name_selectors:
Expand All @@ -180,6 +184,7 @@ exporters:
- rest_client_request_duration_seconds
- rest_client_requests_total
- etcd_request_duration_seconds
- apiserver_flowcontrol_rejected_requests_total
metric_descriptors:
- metric_name: apiserver_storage_objects
unit: Count
Expand All @@ -205,6 +210,12 @@ exporters:
- metric_name: etcd_request_duration_seconds
unit: Seconds
overwrite: true
- metric_name: apiserver_flowcontrol_rejected_requests_total
unit: Count
overwrite: true
- metric_name: apiserver_flowcontrol_request_concurrency_limit
unit: Count
overwrite: true
namespace: ContainerInsights
no_verify_ssl: false
num_workers: 8
Expand Down
11 changes: 11 additions & 0 deletions translator/tocwconfig/sampleConfig/kubernetes_on_prem_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ exporters:
label_matchers: [ ]
metric_name_selectors:
- apiserver_storage_list_duration_seconds
- dimensions: [ [ClusterName, priority_level], [ ClusterName ] ]
label_matchers: [ ]
metric_name_selectors:
- apiserver_flowcontrol_request_concurrency_limit
- dimensions: [ [ ClusterName ] ]
label_matchers: [ ]
metric_name_selectors:
Expand All @@ -151,6 +155,7 @@ exporters:
- rest_client_request_duration_seconds
- rest_client_requests_total
- etcd_request_duration_seconds
- apiserver_flowcontrol_rejected_requests_total
metric_descriptors:
- metric_name: apiserver_storage_objects
unit: Count
Expand All @@ -176,6 +181,12 @@ exporters:
- metric_name: etcd_request_duration_seconds
unit: Seconds
overwrite: true
- metric_name: apiserver_flowcontrol_rejected_requests_total
unit: Count
overwrite: true
- metric_name: apiserver_flowcontrol_request_concurrency_limit
unit: Count
overwrite: true
namespace: ContainerInsights
no_verify_ssl: false
num_workers: 8
Expand Down
11 changes: 11 additions & 0 deletions translator/tocwconfig/sampleConfig/logs_and_kubernetes_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ exporters:
label_matchers: [ ]
metric_name_selectors:
- apiserver_storage_list_duration_seconds
- dimensions: [ [ClusterName, priority_level], [ ClusterName ] ]
label_matchers: [ ]
metric_name_selectors:
- apiserver_flowcontrol_request_concurrency_limit
- dimensions: [ [ ClusterName ] ]
label_matchers: [ ]
metric_name_selectors:
Expand All @@ -180,6 +184,7 @@ exporters:
- rest_client_request_duration_seconds
- rest_client_requests_total
- etcd_request_duration_seconds
- apiserver_flowcontrol_rejected_requests_total
metric_descriptors:
- metric_name: apiserver_storage_objects
unit: Count
Expand All @@ -205,6 +210,12 @@ exporters:
- metric_name: etcd_request_duration_seconds
unit: Seconds
overwrite: true
- metric_name: apiserver_flowcontrol_rejected_requests_total
unit: Count
overwrite: true
- metric_name: apiserver_flowcontrol_request_concurrency_limit
unit: Count
overwrite: true
namespace: ContainerInsights
no_verify_ssl: false
num_workers: 8
Expand Down
43 changes: 30 additions & 13 deletions translator/translate/otel/exporter/awsemf/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,17 +275,24 @@ func getControlPlaneMetricDeclarations(conf *confmap.Conf) []*awsemfexporter.Met
"apiserver_storage_list_duration_seconds",
},
},
{
Dimensions: [][]string{{"ClusterName", "priority_level"}, {"ClusterName"}},
MetricNameSelectors: []string{
"apiserver_flowcontrol_request_concurrency_limit",
},
},
{
Dimensions: [][]string{{"ClusterName"}},
MetricNameSelectors: []string{
"apiserver_storage_objects",
"apiserver_admission_controller_admission_duration_seconds",
"apiserver_flowcontrol_rejected_requests_total",
"apiserver_request_duration_seconds",
"apiserver_request_total",
"apiserver_request_total_5xx",
"apiserver_request_duration_seconds",
"apiserver_admission_controller_admission_duration_seconds",
"apiserver_storage_objects",
"etcd_request_duration_seconds",
"rest_client_request_duration_seconds",
"rest_client_requests_total",
"etcd_request_duration_seconds",
},
},
}...)
Expand All @@ -299,17 +306,17 @@ func getControlPlaneMetricDescriptors(conf *confmap.Conf) []awsemfexporter.Metri
// the control plane metrics do not have units so we need to add them manually
return []awsemfexporter.MetricDescriptor{
{
MetricName: "apiserver_storage_objects",
Unit: "Count",
MetricName: "apiserver_admission_controller_admission_duration_seconds",
Unit: "Seconds",
Overwrite: true,
},
{
MetricName: "apiserver_request_total",
MetricName: "apiserver_flowcontrol_rejected_requests_total",
Unit: "Count",
Overwrite: true,
},
{
MetricName: "apiserver_request_total_5xx",
MetricName: "apiserver_flowcontrol_request_concurrency_limit",
Unit: "Count",
Overwrite: true,
},
Expand All @@ -319,17 +326,17 @@ func getControlPlaneMetricDescriptors(conf *confmap.Conf) []awsemfexporter.Metri
Overwrite: true,
},
{
MetricName: "apiserver_admission_controller_admission_duration_seconds",
Unit: "Seconds",
MetricName: "apiserver_request_total",
Unit: "Count",
Overwrite: true,
},
{
MetricName: "rest_client_request_duration_seconds",
Unit: "Seconds",
MetricName: "apiserver_request_total_5xx",
Unit: "Count",
Overwrite: true,
},
{
MetricName: "rest_client_requests_total",
MetricName: "apiserver_storage_objects",
Unit: "Count",
Overwrite: true,
},
Expand All @@ -338,6 +345,16 @@ func getControlPlaneMetricDescriptors(conf *confmap.Conf) []awsemfexporter.Metri
Unit: "Seconds",
Overwrite: true,
},
{
MetricName: "rest_client_request_duration_seconds",
Unit: "Seconds",
Overwrite: true,
},
{
MetricName: "rest_client_requests_total",
Unit: "Count",
Overwrite: true,
},
}
}
return []awsemfexporter.MetricDescriptor{}
Expand Down
43 changes: 30 additions & 13 deletions translator/translate/otel/exporter/awsemf/translator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,31 +346,38 @@ func TestTranslator(t *testing.T) {
Dimensions: [][]string{{"ClusterName", "resource"}, {"ClusterName"}},
MetricNameSelectors: []string{"apiserver_storage_list_duration_seconds"},
},
{
Dimensions: [][]string{{"ClusterName", "priority_level"}, {"ClusterName"}},
MetricNameSelectors: []string{"apiserver_flowcontrol_request_concurrency_limit"},
},
{
Dimensions: [][]string{{"ClusterName"}},
MetricNameSelectors: []string{"apiserver_storage_objects",
MetricNameSelectors: []string{
"apiserver_admission_controller_admission_duration_seconds",
"apiserver_flowcontrol_rejected_requests_total",
"apiserver_request_duration_seconds",
"apiserver_request_total",
"apiserver_request_total_5xx",
"apiserver_request_duration_seconds",
"apiserver_admission_controller_admission_duration_seconds",
"apiserver_storage_objects",
"etcd_request_duration_seconds",
"rest_client_request_duration_seconds",
"rest_client_requests_total",
"etcd_request_duration_seconds"},
},
},
},
"metric_descriptors": []awsemfexporter.MetricDescriptor{
{
MetricName: "apiserver_storage_objects",
Unit: "Count",
MetricName: "apiserver_admission_controller_admission_duration_seconds",
Unit: "Seconds",
Overwrite: true,
},
{
MetricName: "apiserver_request_total",
MetricName: "apiserver_flowcontrol_request_concurrency_limit",
Unit: "Count",
Overwrite: true,
},
{
MetricName: "apiserver_request_total_5xx",
MetricName: "apiserver_flowcontrol_rejected_requests_total",
Unit: "Count",
Overwrite: true,
},
Expand All @@ -380,17 +387,17 @@ func TestTranslator(t *testing.T) {
Overwrite: true,
},
{
MetricName: "apiserver_admission_controller_admission_duration_seconds",
Unit: "Seconds",
MetricName: "apiserver_request_total",
Unit: "Count",
Overwrite: true,
},
{
MetricName: "rest_client_request_duration_seconds",
Unit: "Seconds",
MetricName: "apiserver_request_total_5xx",
Unit: "Count",
Overwrite: true,
},
{
MetricName: "rest_client_requests_total",
MetricName: "apiserver_storage_objects",
Unit: "Count",
Overwrite: true,
},
Expand All @@ -399,6 +406,16 @@ func TestTranslator(t *testing.T) {
Unit: "Seconds",
Overwrite: true,
},
{
MetricName: "rest_client_request_duration_seconds",
Unit: "Seconds",
Overwrite: true,
},
{
MetricName: "rest_client_requests_total",
Unit: "Count",
Overwrite: true,
},
},
},
},
Expand Down

0 comments on commit 02ac7fb

Please sign in to comment.