Skip to content

Commit 704e16f

Browse files
committed
Set the job label for annotation discovererd metric sources
order: * k8s.grafana.com/job (annotation) * app.kubernetes.io/name (label) * app (label) * container or service name Signed-off-by: Pete Wall <[email protected]>
1 parent 589adfd commit 704e16f

File tree

24 files changed

+635
-7
lines changed

24 files changed

+635
-7
lines changed

charts/k8s-monitoring/charts/feature-annotation-autodiscovery/templates/_pods.alloy.tpl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,21 @@ discovery.relabel "annotation_autodiscovery_pods" {
7171
source_labels = ["{{ include "pod_annotation" .Values.annotations.job }}"]
7272
target_label = "job"
7373
}
74+
rule {
75+
source_labels = ["job", "{{ include "pod_label" "app.kubernetes.io/name" }}"]
76+
regex = ";(.+)"
77+
target_label = "job"
78+
}
79+
rule {
80+
source_labels = ["job", "{{ include "pod_label" "app" }}"]
81+
regex = ";(.+)"
82+
target_label = "job"
83+
}
84+
rule {
85+
source_labels = ["job", "container"]
86+
regex = ";(.+)"
87+
target_label = "job"
88+
}
7489
rule {
7590
source_labels = ["{{ include "pod_annotation" .Values.annotations.instance }}"]
7691
target_label = "instance"

charts/k8s-monitoring/charts/feature-annotation-autodiscovery/templates/_services.alloy.tpl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,21 @@ discovery.relabel "annotation_autodiscovery_services" {
5656
source_labels = ["{{ include "service_annotation" .Values.annotations.job }}"]
5757
target_label = "job"
5858
}
59+
rule {
60+
source_labels = ["job", "{{ include "service_label" "app.kubernetes.io/name" }}"]
61+
regex = ";(.+)"
62+
target_label = "job"
63+
}
64+
rule {
65+
source_labels = ["job", "{{ include "service_label" "app" }}"]
66+
regex = ";(.+)"
67+
target_label = "job"
68+
}
69+
rule {
70+
source_labels = ["job", "service"]
71+
regex = ";(.+)"
72+
target_label = "job"
73+
}
5974
rule {
6075
source_labels = ["{{ include "service_annotation" .Values.annotations.instance }}"]
6176
target_label = "instance"

charts/k8s-monitoring/docs/examples/auth/oauth2/alloy-metrics.alloy

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/k8s-monitoring/docs/examples/auth/oauth2/output.yaml

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/k8s-monitoring/docs/examples/exclude-by-namespace/alloy-metrics.alloy

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/k8s-monitoring/docs/examples/exclude-by-namespace/output.yaml

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/k8s-monitoring/docs/examples/features/annotation-autodiscovery/default/alloy-metrics.alloy

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/k8s-monitoring/docs/examples/features/annotation-autodiscovery/default/output.yaml

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/k8s-monitoring/docs/examples/features/annotation-autodiscovery/prom-annotations/alloy-metrics.alloy

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

charts/k8s-monitoring/docs/examples/features/annotation-autodiscovery/prom-annotations/output.yaml

Lines changed: 30 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)