Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 28561cb

Browse files
committed
Added a comment to explain '.*?'
Signed-off-by: Marco Pracucci <[email protected]>
1 parent 65ac104 commit 28561cb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

cortex-mixin/recording_rules.libsonnet

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ local utils = import 'mixin-utils/utils.libsonnet';
7575
sum by (cluster, namespace, deployment) (
7676
label_replace(
7777
kube_deployment_spec_replicas,
78+
# The question mark in "(.*?)" is used to make it non-greedy, otherwise it
79+
# always matches everything and the (optional) zone is not removed.
7880
"deployment", "$1", "deployment", "(.*?)(?:-zone-[a-z])?"
7981
)
8082
)
@@ -214,6 +216,8 @@ local utils = import 'mixin-utils/utils.libsonnet';
214216
node_namespace_pod_container:container_cpu_usage_seconds_total:sum_rate,
215217
"deployment", "$1", "pod", "(.*)-(?:([0-9]+)|([a-z0-9]+)-([a-z0-9]+))"
216218
),
219+
# The question mark in "(.*?)" is used to make it non-greedy, otherwise it
220+
# always matches everything and the (optional) zone is not removed.
217221
"deployment", "$1", "deployment", "(.*?)(?:-zone-[a-z])?"
218222
)
219223
)
@@ -238,6 +242,8 @@ local utils = import 'mixin-utils/utils.libsonnet';
238242
kube_pod_container_resource_requests_cpu_cores,
239243
"deployment", "$1", "pod", "(.*)-(?:([0-9]+)|([a-z0-9]+)-([a-z0-9]+))"
240244
),
245+
# The question mark in "(.*?)" is used to make it non-greedy, otherwise it
246+
# always matches everything and the (optional) zone is not removed.
241247
"deployment", "$1", "deployment", "(.*?)(?:-zone-[a-z])?"
242248
)
243249
)
@@ -252,6 +258,8 @@ local utils = import 'mixin-utils/utils.libsonnet';
252258
kube_pod_container_resource_requests{resource="cpu"},
253259
"deployment", "$1", "pod", "(.*)-(?:([0-9]+)|([a-z0-9]+)-([a-z0-9]+))"
254260
),
261+
# The question mark in "(.*?)" is used to make it non-greedy, otherwise it
262+
# always matches everything and the (optional) zone is not removed.
255263
"deployment", "$1", "deployment", "(.*?)(?:-zone-[a-z])?"
256264
)
257265
)
@@ -287,6 +295,8 @@ local utils = import 'mixin-utils/utils.libsonnet';
287295
container_memory_usage_bytes,
288296
"deployment", "$1", "pod", "(.*)-(?:([0-9]+)|([a-z0-9]+)-([a-z0-9]+))"
289297
),
298+
# The question mark in "(.*?)" is used to make it non-greedy, otherwise it
299+
# always matches everything and the (optional) zone is not removed.
290300
"deployment", "$1", "deployment", "(.*?)(?:-zone-[a-z])?"
291301
)
292302
)
@@ -311,6 +321,8 @@ local utils = import 'mixin-utils/utils.libsonnet';
311321
kube_pod_container_resource_requests_memory_bytes,
312322
"deployment", "$1", "pod", "(.*)-(?:([0-9]+)|([a-z0-9]+)-([a-z0-9]+))"
313323
),
324+
# The question mark in "(.*?)" is used to make it non-greedy, otherwise it
325+
# always matches everything and the (optional) zone is not removed.
314326
"deployment", "$1", "deployment", "(.*?)(?:-zone-[a-z])?"
315327
)
316328
)
@@ -325,6 +337,8 @@ local utils = import 'mixin-utils/utils.libsonnet';
325337
kube_pod_container_resource_requests{resource="memory"},
326338
"deployment", "$1", "pod", "(.*)-(?:([0-9]+)|([a-z0-9]+)-([a-z0-9]+))"
327339
),
340+
# The question mark in "(.*?)" is used to make it non-greedy, otherwise it
341+
# always matches everything and the (optional) zone is not removed.
328342
"deployment", "$1", "deployment", "(.*?)(?:-zone-[a-z])?"
329343
)
330344
)

0 commit comments

Comments
 (0)