Skip to content

Commit

Permalink
Set service.instance.id to k8s.pod.uid if it is not already set (#…
Browse files Browse the repository at this point in the history
…772)

Signed-off-by: Pete Wall <[email protected]>
Co-authored-by: Cyrille Le Clerc <[email protected]>
  • Loading branch information
petewall and cyrille-leclerc authored Oct 8, 2024
1 parent 388ee8e commit 7fa9b8f
Show file tree
Hide file tree
Showing 66 changed files with 196 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ otelcol.processor.transform "default" {
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"alloy-autoscaling-and-storage-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
log_statements {
Expand All @@ -93,6 +94,7 @@ otelcol.processor.transform "default" {
"set(attributes[\"namespace\"], attributes[\"k8s.namespace.name\"])",
"set(attributes[\"loki.resource.labels\"], \"cluster, namespace, job, pod\")",
"set(attributes[\"k8s.cluster.name\"], \"alloy-autoscaling-and-storage-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
output {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ data:
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"alloy-autoscaling-and-storage-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
log_statements {
Expand All @@ -225,6 +226,7 @@ data:
"set(attributes[\"namespace\"], attributes[\"k8s.namespace.name\"])",
"set(attributes[\"loki.resource.labels\"], \"cluster, namespace, job, pod\")",
"set(attributes[\"k8s.cluster.name\"], \"alloy-autoscaling-and-storage-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
output {
Expand Down Expand Up @@ -68617,6 +68619,7 @@ data:
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"alloy-autoscaling-and-storage-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
log_statements {
Expand All @@ -68626,6 +68629,7 @@ data:
"set(attributes[\"namespace\"], attributes[\"k8s.namespace.name\"])",
"set(attributes[\"loki.resource.labels\"], \"cluster, namespace, job, pod\")",
"set(attributes[\"k8s.cluster.name\"], \"alloy-autoscaling-and-storage-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
output {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ otelcol.processor.transform "default" {
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"application-observability-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
log_statements {
Expand All @@ -116,12 +117,14 @@ otelcol.processor.transform "default" {
"set(attributes[\"namespace\"], attributes[\"k8s.namespace.name\"])",
"set(attributes[\"loki.resource.labels\"], \"cluster, namespace, job, pod\")",
"set(attributes[\"k8s.cluster.name\"], \"application-observability-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
trace_statements {
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"application-observability-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
output {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ data:
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"application-observability-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
log_statements {
Expand All @@ -290,12 +291,14 @@ data:
"set(attributes[\"namespace\"], attributes[\"k8s.namespace.name\"])",
"set(attributes[\"loki.resource.labels\"], \"cluster, namespace, job, pod\")",
"set(attributes[\"k8s.cluster.name\"], \"application-observability-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
trace_statements {
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"application-observability-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
output {
Expand Down Expand Up @@ -69848,6 +69851,7 @@ data:
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"application-observability-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
log_statements {
Expand All @@ -69857,12 +69861,14 @@ data:
"set(attributes[\"namespace\"], attributes[\"k8s.namespace.name\"])",
"set(attributes[\"loki.resource.labels\"], \"cluster, namespace, job, pod\")",
"set(attributes[\"k8s.cluster.name\"], \"application-observability-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
trace_statements {
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"application-observability-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
output {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ otelcol.processor.transform "default" {
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"aks-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
log_statements {
Expand All @@ -93,6 +94,7 @@ otelcol.processor.transform "default" {
"set(attributes[\"namespace\"], attributes[\"k8s.namespace.name\"])",
"set(attributes[\"loki.resource.labels\"], \"cluster, namespace, job, pod\")",
"set(attributes[\"k8s.cluster.name\"], \"aks-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
output {
Expand Down
4 changes: 4 additions & 0 deletions charts/k8s-monitoring-v1/docs/examples/azure-aks/output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ data:
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"aks-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
log_statements {
Expand All @@ -225,6 +226,7 @@ data:
"set(attributes[\"namespace\"], attributes[\"k8s.namespace.name\"])",
"set(attributes[\"loki.resource.labels\"], \"cluster, namespace, job, pod\")",
"set(attributes[\"k8s.cluster.name\"], \"aks-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
output {
Expand Down Expand Up @@ -68561,6 +68563,7 @@ data:
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"aks-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
log_statements {
Expand All @@ -68570,6 +68573,7 @@ data:
"set(attributes[\"namespace\"], attributes[\"k8s.namespace.name\"])",
"set(attributes[\"loki.resource.labels\"], \"cluster, namespace, job, pod\")",
"set(attributes[\"k8s.cluster.name\"], \"aks-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
output {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ otelcol.processor.transform "default" {
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"default-values-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
log_statements {
Expand All @@ -93,6 +94,7 @@ otelcol.processor.transform "default" {
"set(attributes[\"namespace\"], attributes[\"k8s.namespace.name\"])",
"set(attributes[\"loki.resource.labels\"], \"cluster, namespace, job, pod\")",
"set(attributes[\"k8s.cluster.name\"], \"default-values-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
output {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ data:
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"default-values-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
log_statements {
Expand All @@ -224,6 +225,7 @@ data:
"set(attributes[\"namespace\"], attributes[\"k8s.namespace.name\"])",
"set(attributes[\"loki.resource.labels\"], \"cluster, namespace, job, pod\")",
"set(attributes[\"k8s.cluster.name\"], \"default-values-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
output {
Expand Down Expand Up @@ -68549,6 +68551,7 @@ data:
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"default-values-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
log_statements {
Expand All @@ -68558,6 +68561,7 @@ data:
"set(attributes[\"namespace\"], attributes[\"k8s.namespace.name\"])",
"set(attributes[\"loki.resource.labels\"], \"cluster, namespace, job, pod\")",
"set(attributes[\"k8s.cluster.name\"], \"default-values-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
output {
Expand Down
3 changes: 3 additions & 0 deletions charts/k8s-monitoring-v1/docs/examples/beyla/metrics.alloy
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ otelcol.processor.transform "default" {
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"beyla-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
log_statements {
Expand All @@ -116,12 +117,14 @@ otelcol.processor.transform "default" {
"set(attributes[\"namespace\"], attributes[\"k8s.namespace.name\"])",
"set(attributes[\"loki.resource.labels\"], \"cluster, namespace, job, pod\")",
"set(attributes[\"k8s.cluster.name\"], \"beyla-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
trace_statements {
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"beyla-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
output {
Expand Down
6 changes: 6 additions & 0 deletions charts/k8s-monitoring-v1/docs/examples/beyla/output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ data:
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"beyla-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
log_statements {
Expand All @@ -277,12 +278,14 @@ data:
"set(attributes[\"namespace\"], attributes[\"k8s.namespace.name\"])",
"set(attributes[\"loki.resource.labels\"], \"cluster, namespace, job, pod\")",
"set(attributes[\"k8s.cluster.name\"], \"beyla-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
trace_statements {
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"beyla-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
output {
Expand Down Expand Up @@ -68859,6 +68862,7 @@ data:
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"beyla-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
log_statements {
Expand All @@ -68868,12 +68872,14 @@ data:
"set(attributes[\"namespace\"], attributes[\"k8s.namespace.name\"])",
"set(attributes[\"loki.resource.labels\"], \"cluster, namespace, job, pod\")",
"set(attributes[\"k8s.cluster.name\"], \"beyla-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
trace_statements {
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"beyla-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
output {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ otelcol.processor.transform "default" {
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"control-plane-metrics-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
log_statements {
Expand All @@ -93,6 +94,7 @@ otelcol.processor.transform "default" {
"set(attributes[\"namespace\"], attributes[\"k8s.namespace.name\"])",
"set(attributes[\"loki.resource.labels\"], \"cluster, namespace, job, pod\")",
"set(attributes[\"k8s.cluster.name\"], \"control-plane-metrics-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
output {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ data:
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"control-plane-metrics-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
log_statements {
Expand All @@ -226,6 +227,7 @@ data:
"set(attributes[\"namespace\"], attributes[\"k8s.namespace.name\"])",
"set(attributes[\"loki.resource.labels\"], \"cluster, namespace, job, pod\")",
"set(attributes[\"k8s.cluster.name\"], \"control-plane-metrics-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
output {
Expand Down Expand Up @@ -68710,6 +68712,7 @@ data:
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"control-plane-metrics-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
log_statements {
Expand All @@ -68719,6 +68722,7 @@ data:
"set(attributes[\"namespace\"], attributes[\"k8s.namespace.name\"])",
"set(attributes[\"loki.resource.labels\"], \"cluster, namespace, job, pod\")",
"set(attributes[\"k8s.cluster.name\"], \"control-plane-metrics-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
output {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ otelcol.processor.transform "default" {
context = "resource"
statements = [
"set(attributes[\"k8s.cluster.name\"], \"custom-config-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
log_statements {
Expand All @@ -93,6 +94,7 @@ otelcol.processor.transform "default" {
"set(attributes[\"namespace\"], attributes[\"k8s.namespace.name\"])",
"set(attributes[\"loki.resource.labels\"], \"cluster, namespace, job, pod\")",
"set(attributes[\"k8s.cluster.name\"], \"custom-config-test\") where attributes[\"k8s.cluster.name\"] == nil",
"set(attributes[\"service.instance.id\"], attributes[\"k8s.pod.uid\"]) where attributes[\"service.instance.id\"] == nil",
]
}
output {
Expand Down
Loading

0 comments on commit 7fa9b8f

Please sign in to comment.