From 2873857dc7bf638db6aeac24c35875a23b7fbb8e Mon Sep 17 00:00:00 2001
From: paulfantom <pawel@krupa.net.pl>
Date: Wed, 26 May 2021 12:33:00 +0200
Subject: [PATCH] jsonnet: convert string of deprecated metrics into array

---
 ...g-deprecated-metrics-relabelings.libsonnet | 91 ++++++++++++++++++-
 1 file changed, 90 insertions(+), 1 deletion(-)

diff --git a/jsonnet/kube-prometheus/addons/dropping-deprecated-metrics-relabelings.libsonnet b/jsonnet/kube-prometheus/addons/dropping-deprecated-metrics-relabelings.libsonnet
index e3e7565b..58bee14c 100644
--- a/jsonnet/kube-prometheus/addons/dropping-deprecated-metrics-relabelings.libsonnet
+++ b/jsonnet/kube-prometheus/addons/dropping-deprecated-metrics-relabelings.libsonnet
@@ -44,7 +44,96 @@
   // Drop all other metrics which are deprecated in kubernetes.
   {
     sourceLabels: ['__name__'],
-    regex: '(admission_quota_controller_adds|crd_autoregistration_controller_work_duration|APIServiceOpenAPIAggregationControllerQueue1_adds|AvailableConditionController_retries|crd_openapi_controller_unfinished_work_seconds|APIServiceRegistrationController_retries|admission_quota_controller_longest_running_processor_microseconds|crdEstablishing_longest_running_processor_microseconds|crdEstablishing_unfinished_work_seconds|crd_openapi_controller_adds|crd_autoregistration_controller_retries|crd_finalizer_queue_latency|AvailableConditionController_work_duration|non_structural_schema_condition_controller_depth|crd_autoregistration_controller_unfinished_work_seconds|AvailableConditionController_adds|DiscoveryController_longest_running_processor_microseconds|autoregister_queue_latency|crd_autoregistration_controller_adds|non_structural_schema_condition_controller_work_duration|APIServiceRegistrationController_adds|crd_finalizer_work_duration|crd_naming_condition_controller_unfinished_work_seconds|crd_openapi_controller_longest_running_processor_microseconds|DiscoveryController_adds|crd_autoregistration_controller_longest_running_processor_microseconds|autoregister_unfinished_work_seconds|crd_naming_condition_controller_queue_latency|crd_naming_condition_controller_retries|non_structural_schema_condition_controller_queue_latency|crd_naming_condition_controller_depth|AvailableConditionController_longest_running_processor_microseconds|crdEstablishing_depth|crd_finalizer_longest_running_processor_microseconds|crd_naming_condition_controller_adds|APIServiceOpenAPIAggregationControllerQueue1_longest_running_processor_microseconds|DiscoveryController_queue_latency|DiscoveryController_unfinished_work_seconds|crd_openapi_controller_depth|APIServiceOpenAPIAggregationControllerQueue1_queue_latency|APIServiceOpenAPIAggregationControllerQueue1_unfinished_work_seconds|DiscoveryController_work_duration|autoregister_adds|crd_autoregistration_controller_queue_latency|crd_finalizer_retries|AvailableConditionController_unfinished_work_seconds|autoregister_longest_running_processor_microseconds|non_structural_schema_condition_controller_unfinished_work_seconds|APIServiceOpenAPIAggregationControllerQueue1_depth|AvailableConditionController_depth|DiscoveryController_retries|admission_quota_controller_depth|crdEstablishing_adds|APIServiceOpenAPIAggregationControllerQueue1_retries|crdEstablishing_queue_latency|non_structural_schema_condition_controller_longest_running_processor_microseconds|autoregister_work_duration|crd_openapi_controller_retries|APIServiceRegistrationController_work_duration|crdEstablishing_work_duration|crd_finalizer_adds|crd_finalizer_depth|crd_openapi_controller_queue_latency|APIServiceOpenAPIAggregationControllerQueue1_work_duration|APIServiceRegistrationController_queue_latency|crd_autoregistration_controller_depth|AvailableConditionController_queue_latency|admission_quota_controller_queue_latency|crd_naming_condition_controller_work_duration|crd_openapi_controller_work_duration|DiscoveryController_depth|crd_naming_condition_controller_longest_running_processor_microseconds|APIServiceRegistrationController_depth|APIServiceRegistrationController_longest_running_processor_microseconds|crd_finalizer_unfinished_work_seconds|crdEstablishing_retries|admission_quota_controller_unfinished_work_seconds|non_structural_schema_condition_controller_adds|APIServiceRegistrationController_unfinished_work_seconds|admission_quota_controller_work_duration|autoregister_depth|autoregister_retries|kubeproxy_sync_proxy_rules_latency_microseconds|rest_client_request_latency_seconds|non_structural_schema_condition_controller_retries|storage_operation_errors_total|storage_operation_status_count)',
+    regex: '(' + std.join('|',
+      [
+        'admission_quota_controller_adds',
+        'crd_autoregistration_controller_work_duration',
+        'APIServiceOpenAPIAggregationControllerQueue1_adds',
+        'AvailableConditionController_retries',
+        'crd_openapi_controller_unfinished_work_seconds',
+        'APIServiceRegistrationController_retries',
+        'admission_quota_controller_longest_running_processor_microseconds',
+        'crdEstablishing_longest_running_processor_microseconds',
+        'crdEstablishing_unfinished_work_seconds',
+        'crd_openapi_controller_adds',
+        'crd_autoregistration_controller_retries',
+        'crd_finalizer_queue_latency',
+        'AvailableConditionController_work_duration',
+        'non_structural_schema_condition_controller_depth',
+        'crd_autoregistration_controller_unfinished_work_seconds',
+        'AvailableConditionController_adds',
+        'DiscoveryController_longest_running_processor_microseconds',
+        'autoregister_queue_latency',
+        'crd_autoregistration_controller_adds',
+        'non_structural_schema_condition_controller_work_duration',
+        'APIServiceRegistrationController_adds',
+        'crd_finalizer_work_duration',
+        'crd_naming_condition_controller_unfinished_work_seconds',
+        'crd_openapi_controller_longest_running_processor_microseconds',
+        'DiscoveryController_adds',
+        'crd_autoregistration_controller_longest_running_processor_microseconds',
+        'autoregister_unfinished_work_seconds',
+        'crd_naming_condition_controller_queue_latency',
+        'crd_naming_condition_controller_retries',
+        'non_structural_schema_condition_controller_queue_latency',
+        'crd_naming_condition_controller_depth',
+        'AvailableConditionController_longest_running_processor_microseconds',
+        'crdEstablishing_depth',
+        'crd_finalizer_longest_running_processor_microseconds',
+        'crd_naming_condition_controller_adds',
+        'APIServiceOpenAPIAggregationControllerQueue1_longest_running_processor_microseconds',
+        'DiscoveryController_queue_latency',
+        'DiscoveryController_unfinished_work_seconds',
+        'crd_openapi_controller_depth',
+        'APIServiceOpenAPIAggregationControllerQueue1_queue_latency',
+        'APIServiceOpenAPIAggregationControllerQueue1_unfinished_work_seconds',
+        'DiscoveryController_work_duration',
+        'autoregister_adds',
+        'crd_autoregistration_controller_queue_latency',
+        'crd_finalizer_retries',
+        'AvailableConditionController_unfinished_work_seconds',
+        'autoregister_longest_running_processor_microseconds',
+        'non_structural_schema_condition_controller_unfinished_work_seconds',
+        'APIServiceOpenAPIAggregationControllerQueue1_depth',
+        'AvailableConditionController_depth',
+        'DiscoveryController_retries',
+        'admission_quota_controller_depth',
+        'crdEstablishing_adds',
+        'APIServiceOpenAPIAggregationControllerQueue1_retries',
+        'crdEstablishing_queue_latency',
+        'non_structural_schema_condition_controller_longest_running_processor_microseconds',
+        'autoregister_work_duration',
+        'crd_openapi_controller_retries',
+        'APIServiceRegistrationController_work_duration',
+        'crdEstablishing_work_duration',
+        'crd_finalizer_adds',
+        'crd_finalizer_depth',
+        'crd_openapi_controller_queue_latency',
+        'APIServiceOpenAPIAggregationControllerQueue1_work_duration',
+        'APIServiceRegistrationController_queue_latency',
+        'crd_autoregistration_controller_depth',
+        'AvailableConditionController_queue_latency',
+        'admission_quota_controller_queue_latency',
+        'crd_naming_condition_controller_work_duration',
+        'crd_openapi_controller_work_duration',
+        'DiscoveryController_depth',
+        'crd_naming_condition_controller_longest_running_processor_microseconds',
+        'APIServiceRegistrationController_depth',
+        'APIServiceRegistrationController_longest_running_processor_microseconds',
+        'crd_finalizer_unfinished_work_seconds',
+        'crdEstablishing_retries',
+        'admission_quota_controller_unfinished_work_seconds',
+        'non_structural_schema_condition_controller_adds',
+        'APIServiceRegistrationController_unfinished_work_seconds',
+        'admission_quota_controller_work_duration',
+        'autoregister_depth',
+        'autoregister_retries',
+        'kubeproxy_sync_proxy_rules_latency_microseconds',
+        'rest_client_request_latency_seconds',
+        'non_structural_schema_condition_controller_retries',
+        'storage_operation_errors_total',
+        'storage_operation_status_count'
+      ]) + ')',
     action: 'drop',
   },
 ]
-- 
GitLab