From 98dbfe3a041aa96818ddb0fbdbe05ca848ed349d Mon Sep 17 00:00:00 2001 From: "frazao.jhonn" Date: Fri, 31 May 2024 14:16:07 -0300 Subject: [PATCH 1/7] feat: add apiserver_admission_webhook_request_total --- .../kube_apiserver_metrics/kube_apiserver_metrics.py | 2 ++ kube_apiserver_metrics/metadata.csv | 1 + .../tests/test_kube_apiserver_metrics_1_23.py | 1 + .../tests/test_kube_apiserver_metrics_1_24.py | 1 + .../tests/test_kube_apiserver_metrics_1_25.py | 1 + .../tests/test_kube_apiserver_metrics_1_26.py | 1 + .../tests/test_kube_apiserver_metrics_1_27.py | 1 + .../tests/test_kube_apiserver_metrics_1_28.py | 1 + 8 files changed, 9 insertions(+) diff --git a/kube_apiserver_metrics/datadog_checks/kube_apiserver_metrics/kube_apiserver_metrics.py b/kube_apiserver_metrics/datadog_checks/kube_apiserver_metrics/kube_apiserver_metrics.py index e8287b258a261..858ab16ddb524 100644 --- a/kube_apiserver_metrics/datadog_checks/kube_apiserver_metrics/kube_apiserver_metrics.py +++ b/kube_apiserver_metrics/datadog_checks/kube_apiserver_metrics/kube_apiserver_metrics.py @@ -74,6 +74,8 @@ 'apiserver_storage_list_returned_objects_total': 'storage_list_returned_objects_total', 'apiserver_flowcontrol_current_inqueue_requests': 'flowcontrol_current_inqueue_requests', 'apiserver_flowcontrol_dispatched_requests_total': 'flowcontrol_dispatched_requests_total', + # https://github.com/kubernetes/kubernetes/pull/103162 + 'apiserver_admission_webhook_request_total': 'admission_webhook_request_total', # For Kubernetes >= 1.26 # https://github.com/kubernetes/kubernetes/pull/112690 'kubernetes_feature_enabled': 'kubernetes_feature_enabled', diff --git a/kube_apiserver_metrics/metadata.csv b/kube_apiserver_metrics/metadata.csv index c83454a9e5287..f101f117cf851 100644 --- a/kube_apiserver_metrics/metadata.csv +++ b/kube_apiserver_metrics/metadata.csv @@ -12,6 +12,7 @@ kube_apiserver.admission_webhook_admission_latencies_seconds.sum,gauge,,second,, kube_apiserver.aggregator_unavailable_apiservice,gauge,,,,Gauge of APIServices which are marked as unavailable broken down by APIService name (alpha; Kubernetes 1.14+),0,kubernetes_api_server_metrics,unavailable apiservice, kube_apiserver.apiserver_admission_webhook_fail_open_count,gauge,,,,"Admission webhook fail open count, identified by name and broken out for each admission type (validating or mutating).",0,kubernetes_api_server_metrics,webhook fail open count, kube_apiserver.apiserver_admission_webhook_fail_open_count.count,count,,,,"Admission webhook fail open count, identified by name and broken out for each admission type (validating or mutating).",0,kubernetes_api_server_metrics,webhook fail open count, +kube_apiserver.apiserver_admission_webhook_request_total,count,,,,"Admission webhook request total, identified by name and broken out for each admission type.",0,kubernetes_api_server_metrics,webhook request total, kube_apiserver.apiserver_dropped_requests_total,gauge,,request,,The accumulated number of requests dropped with 'Try again later' response,1,kubernetes_api_server_metrics,accumulated number of dropped requests, kube_apiserver.apiserver_dropped_requests_total.count,count,,request,,The monotonic count of requests dropped with 'Try again later' response,0,kubernetes_api_server_metrics,count of dropped requests, kube_apiserver.apiserver_request_count,gauge,,request,,The accumulated number of apiserver requests broken out for each verb API resource client and HTTP response contentType and code (deprecated in Kubernetes 1.15),1,kubernetes_api_server_metrics,accumulated number of requests, diff --git a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_23.py b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_23.py index 9e67f6228da68..8b4c58b5080e6 100644 --- a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_23.py +++ b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_23.py @@ -74,6 +74,7 @@ class TestKubeAPIServerMetrics: 'audit_event.count', 'rest_client_requests_total.count', 'authenticated_user_requests.count', + 'apiserver_admission_webhook_request_total', 'apiserver_request_total.count', 'apiserver_request_terminations_total.count', ] diff --git a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_24.py b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_24.py index e57c7ebb9e5ff..8ea3b841e8e82 100644 --- a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_24.py +++ b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_24.py @@ -79,6 +79,7 @@ class TestKubeAPIServerMetrics: 'apiserver_request_total.count', 'apiserver_request_terminations_total.count', 'apiserver_admission_webhook_fail_open_count.count', + 'apiserver_admission_webhook_request_total', ] def test_check(self, dd_run_check, aggregator, mock_http_response): diff --git a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_25.py b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_25.py index c935071a38abf..6e6a02924c679 100644 --- a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_25.py +++ b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_25.py @@ -100,6 +100,7 @@ class TestKubeAPIServerMetrics: NAMESPACE + '.apiserver_request_total.count', NAMESPACE + '.apiserver_request_terminations_total.count', NAMESPACE + '.apiserver_admission_webhook_fail_open_count.count', + NAMESPACE + '.apiserver_admission_webhook_request_total', ] def test_check(self, dd_run_check, aggregator, mock_get): diff --git a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_26.py b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_26.py index b808ec865d4b3..a3e2498648d7b 100644 --- a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_26.py +++ b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_26.py @@ -74,6 +74,7 @@ class TestKubeAPIServerMetrics: 'audit_event.count', 'rest_client_requests_total.count', 'authenticated_user_requests.count', + 'apiserver_admission_webhook_fail_open_count.count', 'apiserver_request_total.count', 'apiserver_request_terminations_total.count', ] diff --git a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_27.py b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_27.py index acd14af9b34d4..4bbc0c9d3319b 100644 --- a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_27.py +++ b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_27.py @@ -74,6 +74,7 @@ class TestKubeAPIServerMetrics: 'audit_event.count', 'rest_client_requests_total.count', 'authenticated_user_requests.count', + 'apiserver_admission_webhook_fail_open_count.count', 'apiserver_request_total.count', 'apiserver_request_terminations_total.count', ] diff --git a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_28.py b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_28.py index e7816e28c3b66..93631aab0fde9 100644 --- a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_28.py +++ b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_28.py @@ -76,6 +76,7 @@ class TestKubeAPIServerMetrics: 'audit_event.count', 'rest_client_requests_total.count', 'authenticated_user_requests.count', + 'apiserver_admission_webhook_fail_open_count.count', 'apiserver_request_total.count', 'apiserver_request_terminations_total.count', ] From 7dc8a04df006a43e0000c229846979d1ea304f35 Mon Sep 17 00:00:00 2001 From: "frazao.jhonn" Date: Fri, 31 May 2024 14:21:47 -0300 Subject: [PATCH 2/7] feat: changelog --- kube_apiserver_metrics/changelog.d/17689.added | 1 + 1 file changed, 1 insertion(+) create mode 100644 kube_apiserver_metrics/changelog.d/17689.added diff --git a/kube_apiserver_metrics/changelog.d/17689.added b/kube_apiserver_metrics/changelog.d/17689.added new file mode 100644 index 0000000000000..13c7f4559fcea --- /dev/null +++ b/kube_apiserver_metrics/changelog.d/17689.added @@ -0,0 +1 @@ +feat: add apiserver_admission_webhook_request_total From b09b0007aa5638a461d987f895fb8e9499d10b99 Mon Sep 17 00:00:00 2001 From: "frazao.jhonn" Date: Fri, 31 May 2024 14:31:07 -0300 Subject: [PATCH 3/7] fix: changelog --- kube_apiserver_metrics/changelog.d/{17689.added => 17690.added} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename kube_apiserver_metrics/changelog.d/{17689.added => 17690.added} (100%) diff --git a/kube_apiserver_metrics/changelog.d/17689.added b/kube_apiserver_metrics/changelog.d/17690.added similarity index 100% rename from kube_apiserver_metrics/changelog.d/17689.added rename to kube_apiserver_metrics/changelog.d/17690.added From 5d16a39e7e679f6e9d338f28715079820f3a7b66 Mon Sep 17 00:00:00 2001 From: "frazao.jhonn" Date: Fri, 31 May 2024 18:10:55 -0300 Subject: [PATCH 4/7] fix: tests --- kube_apiserver_metrics/changelog.d/17690.added | 2 +- .../kube_apiserver_metrics/kube_apiserver_metrics.py | 5 +++++ kube_apiserver_metrics/metadata.csv | 3 ++- kube_apiserver_metrics/tests/fixtures/metrics_1.23.0.txt | 7 ++++++- .../tests/test_kube_apiserver_metrics_1_23.py | 3 ++- .../tests/test_kube_apiserver_metrics_1_24.py | 3 ++- .../tests/test_kube_apiserver_metrics_1_25.py | 3 ++- .../tests/test_kube_apiserver_metrics_1_26.py | 3 ++- .../tests/test_kube_apiserver_metrics_1_27.py | 3 ++- .../tests/test_kube_apiserver_metrics_1_28.py | 3 ++- 10 files changed, 26 insertions(+), 9 deletions(-) diff --git a/kube_apiserver_metrics/changelog.d/17690.added b/kube_apiserver_metrics/changelog.d/17690.added index 13c7f4559fcea..8db50c4db624f 100644 --- a/kube_apiserver_metrics/changelog.d/17690.added +++ b/kube_apiserver_metrics/changelog.d/17690.added @@ -1 +1 @@ -feat: add apiserver_admission_webhook_request_total +Add the apiserver_admission_webhook_request_total diff --git a/kube_apiserver_metrics/datadog_checks/kube_apiserver_metrics/kube_apiserver_metrics.py b/kube_apiserver_metrics/datadog_checks/kube_apiserver_metrics/kube_apiserver_metrics.py index 858ab16ddb524..bdf5d0694c5c1 100644 --- a/kube_apiserver_metrics/datadog_checks/kube_apiserver_metrics/kube_apiserver_metrics.py +++ b/kube_apiserver_metrics/datadog_checks/kube_apiserver_metrics/kube_apiserver_metrics.py @@ -121,6 +121,8 @@ def __init__(self, name, init_config, instances=None): # For Kubernetes >= 1.24 # https://github.com/kubernetes/kubernetes/pull/107171 'apiserver_admission_webhook_fail_open_count': self.apiserver_admission_webhook_fail_open_count, + # https://github.com/kubernetes/kubernetes/pull/103162 + 'apiserver_admission_webhook_request_total': self.apiserver_admission_webhook_request_total, } self.kube_apiserver_config = None @@ -246,3 +248,6 @@ def apiserver_request_terminations_total(self, metric, scraper_config): def apiserver_admission_webhook_fail_open_count(self, metric, scraper_config): self.submit_metric('.apiserver_admission_webhook_fail_open_count', metric, scraper_config) + + def apiserver_admission_webhook_request_total(self, metric, scraper_config): + self.submit_metric('.apiserver_admission_webhook_request_total', metric, scraper_config) diff --git a/kube_apiserver_metrics/metadata.csv b/kube_apiserver_metrics/metadata.csv index f101f117cf851..dfec0e592bf13 100644 --- a/kube_apiserver_metrics/metadata.csv +++ b/kube_apiserver_metrics/metadata.csv @@ -12,7 +12,8 @@ kube_apiserver.admission_webhook_admission_latencies_seconds.sum,gauge,,second,, kube_apiserver.aggregator_unavailable_apiservice,gauge,,,,Gauge of APIServices which are marked as unavailable broken down by APIService name (alpha; Kubernetes 1.14+),0,kubernetes_api_server_metrics,unavailable apiservice, kube_apiserver.apiserver_admission_webhook_fail_open_count,gauge,,,,"Admission webhook fail open count, identified by name and broken out for each admission type (validating or mutating).",0,kubernetes_api_server_metrics,webhook fail open count, kube_apiserver.apiserver_admission_webhook_fail_open_count.count,count,,,,"Admission webhook fail open count, identified by name and broken out for each admission type (validating or mutating).",0,kubernetes_api_server_metrics,webhook fail open count, -kube_apiserver.apiserver_admission_webhook_request_total,count,,,,"Admission webhook request total, identified by name and broken out for each admission type.",0,kubernetes_api_server_metrics,webhook request total, +kube_apiserver.apiserver_admission_webhook_request_total,gauge,,,,"Admission webhook request total, identified by name and broken out for each admission type.",0,kubernetes_api_server_metrics,webhook request total, +kube_apiserver.apiserver_admission_webhook_request_total.count,count,,,,"Admission webhook request total, identified by name and broken out for each admission type.",0,kubernetes_api_server_metrics,webhook request total, kube_apiserver.apiserver_dropped_requests_total,gauge,,request,,The accumulated number of requests dropped with 'Try again later' response,1,kubernetes_api_server_metrics,accumulated number of dropped requests, kube_apiserver.apiserver_dropped_requests_total.count,count,,request,,The monotonic count of requests dropped with 'Try again later' response,0,kubernetes_api_server_metrics,count of dropped requests, kube_apiserver.apiserver_request_count,gauge,,request,,The accumulated number of apiserver requests broken out for each verb API resource client and HTTP response contentType and code (deprecated in Kubernetes 1.15),1,kubernetes_api_server_metrics,accumulated number of requests, diff --git a/kube_apiserver_metrics/tests/fixtures/metrics_1.23.0.txt b/kube_apiserver_metrics/tests/fixtures/metrics_1.23.0.txt index 13f2f787e56f3..1687605fc4787 100644 --- a/kube_apiserver_metrics/tests/fixtures/metrics_1.23.0.txt +++ b/kube_apiserver_metrics/tests/fixtures/metrics_1.23.0.txt @@ -554,6 +554,11 @@ apiserver_admission_step_admission_duration_seconds_summary{operation="UPDATE",r apiserver_admission_step_admission_duration_seconds_summary{operation="UPDATE",rejected="false",type="validate",quantile="0.99"} 0.0005589 apiserver_admission_step_admission_duration_seconds_summary_sum{operation="UPDATE",rejected="false",type="validate"} 1.734694500000006 apiserver_admission_step_admission_duration_seconds_summary_count{operation="UPDATE",rejected="false",type="validate"} 7427 +# HELP apiserver_admission_webhook_request_total [ALPHA] Admission webhook request total, identified by name and broken out for each admission type (validating or mutating) and operation. Additional labels specify whether the request was rejected or not and an HTTP status code. Codes greater than 600 are truncated to 600, to keep the metrics cardinality bounded. +# TYPE apiserver_admission_webhook_request_total counter +apiserver_admission_webhook_request_total{code="200",name="datadog.webhook.auto.instrumentation",operation="CREATE",rejected="false",type="admit"} 17 +apiserver_admission_webhook_request_total{code="200",name="datadog.webhook.config",operation="CREATE",rejected="false",type="admit"} 18 +apiserver_admission_webhook_request_total{code="200",name="datadog.webhook.tags",operation="CREATE",rejected="false",type="admit"} 17 # HELP apiserver_audit_event_total [ALPHA] Counter of audit events generated and sent to the audit backend. # TYPE apiserver_audit_event_total counter apiserver_audit_event_total 0 @@ -19216,4 +19221,4 @@ workqueue_work_duration_seconds_bucket{name="priority_and_fairness_config_queue" workqueue_work_duration_seconds_bucket{name="priority_and_fairness_config_queue",le="10"} 33 workqueue_work_duration_seconds_bucket{name="priority_and_fairness_config_queue",le="+Inf"} 33 workqueue_work_duration_seconds_sum{name="priority_and_fairness_config_queue"} 0.1424415 -workqueue_work_duration_seconds_count{name="priority_and_fairness_config_queue"} 33 \ No newline at end of file +workqueue_work_duration_seconds_count{name="priority_and_fairness_config_queue"} 33 diff --git a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_23.py b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_23.py index 8b4c58b5080e6..04ffa9147c515 100644 --- a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_23.py +++ b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_23.py @@ -38,6 +38,7 @@ class TestKubeAPIServerMetrics: 'grpc_client_started_total', 'rest_client_request_latency_seconds.sum', 'rest_client_request_latency_seconds.count', + 'apiserver_admission_webhook_request_total', 'admission_step_admission_latencies_seconds.sum', 'admission_step_admission_latencies_seconds.count', 'admission_step_admission_latencies_seconds_summary.sum', @@ -74,7 +75,7 @@ class TestKubeAPIServerMetrics: 'audit_event.count', 'rest_client_requests_total.count', 'authenticated_user_requests.count', - 'apiserver_admission_webhook_request_total', + 'apiserver_admission_webhook_request_total.count', 'apiserver_request_total.count', 'apiserver_request_terminations_total.count', ] diff --git a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_24.py b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_24.py index 8ea3b841e8e82..e08ee1346ee7d 100644 --- a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_24.py +++ b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_24.py @@ -63,6 +63,7 @@ class TestKubeAPIServerMetrics: 'storage_list_returned_objects_total', 'requested_deprecated_apis', 'apiserver_admission_webhook_fail_open_count', + 'apiserver_admission_webhook_request_total', 'admission_webhook_admission_latencies_seconds.sum', 'admission_webhook_admission_latencies_seconds.count', 'aggregator_unavailable_apiservice', @@ -79,7 +80,7 @@ class TestKubeAPIServerMetrics: 'apiserver_request_total.count', 'apiserver_request_terminations_total.count', 'apiserver_admission_webhook_fail_open_count.count', - 'apiserver_admission_webhook_request_total', + 'apiserver_admission_webhook_request_total.count', ] def test_check(self, dd_run_check, aggregator, mock_http_response): diff --git a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_25.py b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_25.py index 6e6a02924c679..86882b5c64fc7 100644 --- a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_25.py +++ b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_25.py @@ -82,6 +82,7 @@ class TestKubeAPIServerMetrics: NAMESPACE + '.storage_list_returned_objects_total', NAMESPACE + '.requested_deprecated_apis', NAMESPACE + '.apiserver_admission_webhook_fail_open_count', + NAMESPACE + '.apiserver_admission_webhook_request_total', NAMESPACE + '.admission_webhook_admission_latencies_seconds.sum', NAMESPACE + '.admission_webhook_admission_latencies_seconds.count', NAMESPACE + '.kubernetes_feature_enabled', @@ -100,7 +101,7 @@ class TestKubeAPIServerMetrics: NAMESPACE + '.apiserver_request_total.count', NAMESPACE + '.apiserver_request_terminations_total.count', NAMESPACE + '.apiserver_admission_webhook_fail_open_count.count', - NAMESPACE + '.apiserver_admission_webhook_request_total', + NAMESPACE + '.apiserver_admission_webhook_request_total.count', ] def test_check(self, dd_run_check, aggregator, mock_get): diff --git a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_26.py b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_26.py index a3e2498648d7b..24e6bcdaf4908 100644 --- a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_26.py +++ b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_26.py @@ -29,6 +29,7 @@ class TestKubeAPIServerMetrics: 'go_goroutines', 'rest_client_requests_total', 'authenticated_user_requests', + 'apiserver_admission_webhook_request_total', 'apiserver_request_total', 'apiserver_request_terminations_total', 'grpc_client_handled_total', @@ -74,9 +75,9 @@ class TestKubeAPIServerMetrics: 'audit_event.count', 'rest_client_requests_total.count', 'authenticated_user_requests.count', - 'apiserver_admission_webhook_fail_open_count.count', 'apiserver_request_total.count', 'apiserver_request_terminations_total.count', + 'apiserver_admission_webhook_request_total.count', ] def test_check(self, dd_run_check, aggregator, mock_http_response): diff --git a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_27.py b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_27.py index 4bbc0c9d3319b..b9bb828921c51 100644 --- a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_27.py +++ b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_27.py @@ -37,6 +37,7 @@ class TestKubeAPIServerMetrics: 'grpc_client_started_total', 'rest_client_request_latency_seconds.sum', 'rest_client_request_latency_seconds.count', + 'apiserver_admission_webhook_request_total', 'admission_step_admission_latencies_seconds.sum', 'admission_step_admission_latencies_seconds.count', 'admission_step_admission_latencies_seconds_summary.sum', @@ -74,7 +75,7 @@ class TestKubeAPIServerMetrics: 'audit_event.count', 'rest_client_requests_total.count', 'authenticated_user_requests.count', - 'apiserver_admission_webhook_fail_open_count.count', + 'apiserver_admission_webhook_request_total.count', 'apiserver_request_total.count', 'apiserver_request_terminations_total.count', ] diff --git a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_28.py b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_28.py index 93631aab0fde9..1a7cb1c518411 100644 --- a/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_28.py +++ b/kube_apiserver_metrics/tests/test_kube_apiserver_metrics_1_28.py @@ -37,6 +37,7 @@ class TestKubeAPIServerMetrics: 'grpc_client_started_total', 'rest_client_request_latency_seconds.sum', 'rest_client_request_latency_seconds.count', + 'apiserver_admission_webhook_request_total', 'admission_step_admission_latencies_seconds.sum', 'admission_step_admission_latencies_seconds.count', 'admission_step_admission_latencies_seconds_summary.sum', @@ -76,7 +77,7 @@ class TestKubeAPIServerMetrics: 'audit_event.count', 'rest_client_requests_total.count', 'authenticated_user_requests.count', - 'apiserver_admission_webhook_fail_open_count.count', + 'apiserver_admission_webhook_request_total.count', 'apiserver_request_total.count', 'apiserver_request_terminations_total.count', ] From 2827f9cfad586a7732ad5f1a7bd3e9c7afd36613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jhonn=20W=2E=20Fraz=C3=A3o?= Date: Mon, 16 Sep 2024 13:29:09 -0300 Subject: [PATCH 5/7] Update kube_apiserver_metrics/metadata.csv Co-authored-by: Steven Blumenthal --- kube_apiserver_metrics/metadata.csv | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kube_apiserver_metrics/metadata.csv b/kube_apiserver_metrics/metadata.csv index dfec0e592bf13..e76c1eefff2b2 100644 --- a/kube_apiserver_metrics/metadata.csv +++ b/kube_apiserver_metrics/metadata.csv @@ -12,8 +12,8 @@ kube_apiserver.admission_webhook_admission_latencies_seconds.sum,gauge,,second,, kube_apiserver.aggregator_unavailable_apiservice,gauge,,,,Gauge of APIServices which are marked as unavailable broken down by APIService name (alpha; Kubernetes 1.14+),0,kubernetes_api_server_metrics,unavailable apiservice, kube_apiserver.apiserver_admission_webhook_fail_open_count,gauge,,,,"Admission webhook fail open count, identified by name and broken out for each admission type (validating or mutating).",0,kubernetes_api_server_metrics,webhook fail open count, kube_apiserver.apiserver_admission_webhook_fail_open_count.count,count,,,,"Admission webhook fail open count, identified by name and broken out for each admission type (validating or mutating).",0,kubernetes_api_server_metrics,webhook fail open count, -kube_apiserver.apiserver_admission_webhook_request_total,gauge,,,,"Admission webhook request total, identified by name and broken out for each admission type.",0,kubernetes_api_server_metrics,webhook request total, -kube_apiserver.apiserver_admission_webhook_request_total.count,count,,,,"Admission webhook request total, identified by name and broken out for each admission type.",0,kubernetes_api_server_metrics,webhook request total, +kube_apiserver.apiserver_admission_webhook_request_total,gauge,,,,"Admission webhook request total, identified by name and broken out for each admission type (alpha; Kubernetes 1.23+)",0,kubernetes_api_server_metrics,webhook request total, +kube_apiserver.apiserver_admission_webhook_request_total.count,count,,,,"Admission webhook request total, identified by name and broken out for each admission type (alpha; Kubernetes 1.23+)",0,kubernetes_api_server_metrics,webhook request total, kube_apiserver.apiserver_dropped_requests_total,gauge,,request,,The accumulated number of requests dropped with 'Try again later' response,1,kubernetes_api_server_metrics,accumulated number of dropped requests, kube_apiserver.apiserver_dropped_requests_total.count,count,,request,,The monotonic count of requests dropped with 'Try again later' response,0,kubernetes_api_server_metrics,count of dropped requests, kube_apiserver.apiserver_request_count,gauge,,request,,The accumulated number of apiserver requests broken out for each verb API resource client and HTTP response contentType and code (deprecated in Kubernetes 1.15),1,kubernetes_api_server_metrics,accumulated number of requests, From 03908e87ad39619923bd0339224268adb42aea6c Mon Sep 17 00:00:00 2001 From: "frazao.jhonn" Date: Mon, 16 Sep 2024 13:46:40 -0300 Subject: [PATCH 6/7] fix: remove duplicated declaration --- .../kube_apiserver_metrics/kube_apiserver_metrics.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/kube_apiserver_metrics/datadog_checks/kube_apiserver_metrics/kube_apiserver_metrics.py b/kube_apiserver_metrics/datadog_checks/kube_apiserver_metrics/kube_apiserver_metrics.py index bdf5d0694c5c1..2c07838807f3f 100644 --- a/kube_apiserver_metrics/datadog_checks/kube_apiserver_metrics/kube_apiserver_metrics.py +++ b/kube_apiserver_metrics/datadog_checks/kube_apiserver_metrics/kube_apiserver_metrics.py @@ -74,8 +74,6 @@ 'apiserver_storage_list_returned_objects_total': 'storage_list_returned_objects_total', 'apiserver_flowcontrol_current_inqueue_requests': 'flowcontrol_current_inqueue_requests', 'apiserver_flowcontrol_dispatched_requests_total': 'flowcontrol_dispatched_requests_total', - # https://github.com/kubernetes/kubernetes/pull/103162 - 'apiserver_admission_webhook_request_total': 'admission_webhook_request_total', # For Kubernetes >= 1.26 # https://github.com/kubernetes/kubernetes/pull/112690 'kubernetes_feature_enabled': 'kubernetes_feature_enabled', From 2985228ddf10952393526cde866aa72f76515c28 Mon Sep 17 00:00:00 2001 From: "frazao.jhonn" Date: Fri, 20 Sep 2024 14:17:33 -0300 Subject: [PATCH 7/7] feat: add missing fixtures --- kube_apiserver_metrics/tests/fixtures/metrics_1.26.0.txt | 5 +++++ kube_apiserver_metrics/tests/fixtures/metrics_1.27.0.txt | 5 +++++ kube_apiserver_metrics/tests/fixtures/metrics_1.28.0.txt | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/kube_apiserver_metrics/tests/fixtures/metrics_1.26.0.txt b/kube_apiserver_metrics/tests/fixtures/metrics_1.26.0.txt index e3f44490a4a63..2fe3c01f508b1 100644 --- a/kube_apiserver_metrics/tests/fixtures/metrics_1.26.0.txt +++ b/kube_apiserver_metrics/tests/fixtures/metrics_1.26.0.txt @@ -583,6 +583,11 @@ apiserver_admission_step_admission_duration_seconds_summary{operation="UPDATE",r apiserver_admission_step_admission_duration_seconds_summary{operation="UPDATE",rejected="false",type="validate",quantile="0.99"} 0.000180532 apiserver_admission_step_admission_duration_seconds_summary_sum{operation="UPDATE",rejected="false",type="validate"} 0.03223122800000003 apiserver_admission_step_admission_duration_seconds_summary_count{operation="UPDATE",rejected="false",type="validate"} 686 +# HELP apiserver_admission_webhook_request_total [ALPHA] Admission webhook request total, identified by name and broken out for each admission type (validating or mutating) and operation. Additional labels specify whether the request was rejected or not and an HTTP status code. Codes greater than 600 are truncated to 600, to keep the metrics cardinality bounded. +# TYPE apiserver_admission_webhook_request_total counter +apiserver_admission_webhook_request_total{code="200",name="datadog.webhook.auto.instrumentation",operation="CREATE",rejected="false",type="admit"} 17 +apiserver_admission_webhook_request_total{code="200",name="datadog.webhook.config",operation="CREATE",rejected="false",type="admit"} 18 +apiserver_admission_webhook_request_total{code="200",name="datadog.webhook.tags",operation="CREATE",rejected="false",type="admit"} 17 # HELP apiserver_audit_event_total [ALPHA] Counter of audit events generated and sent to the audit backend. # TYPE apiserver_audit_event_total counter apiserver_audit_event_total 0 diff --git a/kube_apiserver_metrics/tests/fixtures/metrics_1.27.0.txt b/kube_apiserver_metrics/tests/fixtures/metrics_1.27.0.txt index 56da2969b8ee6..86be1c0206fd5 100644 --- a/kube_apiserver_metrics/tests/fixtures/metrics_1.27.0.txt +++ b/kube_apiserver_metrics/tests/fixtures/metrics_1.27.0.txt @@ -635,6 +635,11 @@ apiserver_admission_step_admission_duration_seconds_summary{operation="UPDATE",r apiserver_admission_step_admission_duration_seconds_summary{operation="UPDATE",rejected="false",type="validate",quantile="0.99"} 0.000158667 apiserver_admission_step_admission_duration_seconds_summary_sum{operation="UPDATE",rejected="false",type="validate"} 0.38836563199999974 apiserver_admission_step_admission_duration_seconds_summary_count{operation="UPDATE",rejected="false",type="validate"} 19075 +# HELP apiserver_admission_webhook_request_total [ALPHA] Admission webhook request total, identified by name and broken out for each admission type (validating or mutating) and operation. Additional labels specify whether the request was rejected or not and an HTTP status code. Codes greater than 600 are truncated to 600, to keep the metrics cardinality bounded. +# TYPE apiserver_admission_webhook_request_total counter +apiserver_admission_webhook_request_total{code="200",name="datadog.webhook.auto.instrumentation",operation="CREATE",rejected="false",type="admit"} 17 +apiserver_admission_webhook_request_total{code="200",name="datadog.webhook.config",operation="CREATE",rejected="false",type="admit"} 18 +apiserver_admission_webhook_request_total{code="200",name="datadog.webhook.tags",operation="CREATE",rejected="false",type="admit"} 17 # HELP apiserver_audit_event_total [ALPHA] Counter of audit events generated and sent to the audit backend. # TYPE apiserver_audit_event_total counter apiserver_audit_event_total 0 diff --git a/kube_apiserver_metrics/tests/fixtures/metrics_1.28.0.txt b/kube_apiserver_metrics/tests/fixtures/metrics_1.28.0.txt index cfda122f0bca6..0a9a6e045e33e 100644 --- a/kube_apiserver_metrics/tests/fixtures/metrics_1.28.0.txt +++ b/kube_apiserver_metrics/tests/fixtures/metrics_1.28.0.txt @@ -616,6 +616,11 @@ apiserver_admission_step_admission_duration_seconds_summary{operation="UPDATE",r apiserver_admission_step_admission_duration_seconds_summary{operation="UPDATE",rejected="false",type="validate",quantile="0.99"} 0.000148958 apiserver_admission_step_admission_duration_seconds_summary_sum{operation="UPDATE",rejected="false",type="validate"} 0.43113972400000006 apiserver_admission_step_admission_duration_seconds_summary_count{operation="UPDATE",rejected="false",type="validate"} 19367 +# HELP apiserver_admission_webhook_request_total [ALPHA] Admission webhook request total, identified by name and broken out for each admission type (validating or mutating) and operation. Additional labels specify whether the request was rejected or not and an HTTP status code. Codes greater than 600 are truncated to 600, to keep the metrics cardinality bounded. +# TYPE apiserver_admission_webhook_request_total counter +apiserver_admission_webhook_request_total{code="200",name="datadog.webhook.auto.instrumentation",operation="CREATE",rejected="false",type="admit"} 17 +apiserver_admission_webhook_request_total{code="200",name="datadog.webhook.config",operation="CREATE",rejected="false",type="admit"} 18 +apiserver_admission_webhook_request_total{code="200",name="datadog.webhook.tags",operation="CREATE",rejected="false",type="admit"} 17 # HELP apiserver_audit_event_total [ALPHA] Counter of audit events generated and sent to the audit backend. # TYPE apiserver_audit_event_total counter apiserver_audit_event_total 0