From 94b80183216d1bfb15a801f879c3444ed85f38cc Mon Sep 17 00:00:00 2001 From: Pete Wall Date: Fri, 8 Nov 2024 17:58:57 -0600 Subject: [PATCH] Be consistent with setting cluster and k8s.cluster.name Signed-off-by: Pete Wall --- .../docs/examples/auth/bearer-token/alloy-receiver.alloy | 3 +++ .../docs/examples/auth/bearer-token/output.yaml | 3 +++ .../docs/examples/auth/embedded-secrets/alloy-receiver.alloy | 3 +++ .../docs/examples/auth/embedded-secrets/output.yaml | 3 +++ .../docs/examples/auth/external-secrets/alloy-receiver.alloy | 3 +++ .../docs/examples/auth/external-secrets/output.yaml | 3 +++ .../applicaiton-observability/default/alloy-receiver.alloy | 3 +++ .../features/applicaiton-observability/default/output.yaml | 3 +++ .../examples/features/profiling/default/alloy-profiles.alloy | 1 + .../docs/examples/features/profiling/default/output.yaml | 1 + .../k8s-monitoring/docs/examples/proxies/alloy-profiles.alloy | 1 + .../k8s-monitoring/docs/examples/proxies/alloy-receiver.alloy | 3 +++ charts/k8s-monitoring/docs/examples/proxies/output.yaml | 4 ++++ .../templates/destinations/_destination_otlp.tpl | 3 +++ .../templates/destinations/_destination_pyroscope.tpl | 1 + 15 files changed, 38 insertions(+) diff --git a/charts/k8s-monitoring/docs/examples/auth/bearer-token/alloy-receiver.alloy b/charts/k8s-monitoring/docs/examples/auth/bearer-token/alloy-receiver.alloy index e132e6291..a28814541 100644 --- a/charts/k8s-monitoring/docs/examples/auth/bearer-token/alloy-receiver.alloy +++ b/charts/k8s-monitoring/docs/examples/auth/bearer-token/alloy-receiver.alloy @@ -68,14 +68,17 @@ otelcol.processor.transform "tempo" { error_mode = "ignore" metric_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"bearer-token-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"bearer-token-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } log_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"bearer-token-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"bearer-token-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } trace_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"bearer-token-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"bearer-token-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } diff --git a/charts/k8s-monitoring/docs/examples/auth/bearer-token/output.yaml b/charts/k8s-monitoring/docs/examples/auth/bearer-token/output.yaml index afa45a39c..58c5da0ef 100644 --- a/charts/k8s-monitoring/docs/examples/auth/bearer-token/output.yaml +++ b/charts/k8s-monitoring/docs/examples/auth/bearer-token/output.yaml @@ -430,14 +430,17 @@ data: error_mode = "ignore" metric_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"bearer-token-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"bearer-token-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } log_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"bearer-token-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"bearer-token-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } trace_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"bearer-token-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"bearer-token-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } diff --git a/charts/k8s-monitoring/docs/examples/auth/embedded-secrets/alloy-receiver.alloy b/charts/k8s-monitoring/docs/examples/auth/embedded-secrets/alloy-receiver.alloy index c2c417ea5..d739e6f23 100644 --- a/charts/k8s-monitoring/docs/examples/auth/embedded-secrets/alloy-receiver.alloy +++ b/charts/k8s-monitoring/docs/examples/auth/embedded-secrets/alloy-receiver.alloy @@ -67,14 +67,17 @@ otelcol.processor.transform "tempo" { error_mode = "ignore" metric_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"embedded-secrets-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"embedded-secrets-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } log_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"embedded-secrets-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"embedded-secrets-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } trace_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"embedded-secrets-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"embedded-secrets-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } diff --git a/charts/k8s-monitoring/docs/examples/auth/embedded-secrets/output.yaml b/charts/k8s-monitoring/docs/examples/auth/embedded-secrets/output.yaml index dc4a30cd1..b03bbba83 100644 --- a/charts/k8s-monitoring/docs/examples/auth/embedded-secrets/output.yaml +++ b/charts/k8s-monitoring/docs/examples/auth/embedded-secrets/output.yaml @@ -418,14 +418,17 @@ data: error_mode = "ignore" metric_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"embedded-secrets-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"embedded-secrets-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } log_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"embedded-secrets-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"embedded-secrets-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } trace_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"embedded-secrets-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"embedded-secrets-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } diff --git a/charts/k8s-monitoring/docs/examples/auth/external-secrets/alloy-receiver.alloy b/charts/k8s-monitoring/docs/examples/auth/external-secrets/alloy-receiver.alloy index a69fe0fd7..fd4f488ee 100644 --- a/charts/k8s-monitoring/docs/examples/auth/external-secrets/alloy-receiver.alloy +++ b/charts/k8s-monitoring/docs/examples/auth/external-secrets/alloy-receiver.alloy @@ -85,14 +85,17 @@ otelcol.processor.transform "tempo" { error_mode = "ignore" metric_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"external-secrets-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"external-secrets-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } log_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"external-secrets-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"external-secrets-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } trace_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"external-secrets-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"external-secrets-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } diff --git a/charts/k8s-monitoring/docs/examples/auth/external-secrets/output.yaml b/charts/k8s-monitoring/docs/examples/auth/external-secrets/output.yaml index 989b409fa..ab73f92ff 100644 --- a/charts/k8s-monitoring/docs/examples/auth/external-secrets/output.yaml +++ b/charts/k8s-monitoring/docs/examples/auth/external-secrets/output.yaml @@ -453,14 +453,17 @@ data: error_mode = "ignore" metric_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"external-secrets-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"external-secrets-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } log_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"external-secrets-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"external-secrets-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } trace_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"external-secrets-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"external-secrets-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } diff --git a/charts/k8s-monitoring/docs/examples/features/applicaiton-observability/default/alloy-receiver.alloy b/charts/k8s-monitoring/docs/examples/features/applicaiton-observability/default/alloy-receiver.alloy index 315b37591..f1061c3d8 100644 --- a/charts/k8s-monitoring/docs/examples/features/applicaiton-observability/default/alloy-receiver.alloy +++ b/charts/k8s-monitoring/docs/examples/features/applicaiton-observability/default/alloy-receiver.alloy @@ -14,14 +14,17 @@ otelcol.processor.transform "otlp_gateway" { error_mode = "ignore" metric_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"applications-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"applications-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } log_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"applications-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"applications-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } trace_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"applications-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"applications-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } diff --git a/charts/k8s-monitoring/docs/examples/features/applicaiton-observability/default/output.yaml b/charts/k8s-monitoring/docs/examples/features/applicaiton-observability/default/output.yaml index cbe8b4c00..0b9fff6bb 100644 --- a/charts/k8s-monitoring/docs/examples/features/applicaiton-observability/default/output.yaml +++ b/charts/k8s-monitoring/docs/examples/features/applicaiton-observability/default/output.yaml @@ -39,14 +39,17 @@ data: error_mode = "ignore" metric_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"applications-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"applications-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } log_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"applications-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"applications-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } trace_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"applications-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"applications-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } diff --git a/charts/k8s-monitoring/docs/examples/features/profiling/default/alloy-profiles.alloy b/charts/k8s-monitoring/docs/examples/features/profiling/default/alloy-profiles.alloy index daeba61c6..8e6aed245 100644 --- a/charts/k8s-monitoring/docs/examples/features/profiling/default/alloy-profiles.alloy +++ b/charts/k8s-monitoring/docs/examples/features/profiling/default/alloy-profiles.alloy @@ -11,6 +11,7 @@ pyroscope.write "pyroscope" { external_labels = { cluster = "profiling-cluster", + k8s.cluster.name = "profiling-cluster", } } diff --git a/charts/k8s-monitoring/docs/examples/features/profiling/default/output.yaml b/charts/k8s-monitoring/docs/examples/features/profiling/default/output.yaml index d94a17eee..fe60e7612 100644 --- a/charts/k8s-monitoring/docs/examples/features/profiling/default/output.yaml +++ b/charts/k8s-monitoring/docs/examples/features/profiling/default/output.yaml @@ -36,6 +36,7 @@ data: external_labels = { cluster = "profiling-cluster", + k8s.cluster.name = "profiling-cluster", } } diff --git a/charts/k8s-monitoring/docs/examples/proxies/alloy-profiles.alloy b/charts/k8s-monitoring/docs/examples/proxies/alloy-profiles.alloy index daf69acaa..3a3ad5d19 100644 --- a/charts/k8s-monitoring/docs/examples/proxies/alloy-profiles.alloy +++ b/charts/k8s-monitoring/docs/examples/proxies/alloy-profiles.alloy @@ -11,6 +11,7 @@ pyroscope.write "pyroscope" { external_labels = { cluster = "proxies-example-cluster", + k8s.cluster.name = "proxies-example-cluster", } } diff --git a/charts/k8s-monitoring/docs/examples/proxies/alloy-receiver.alloy b/charts/k8s-monitoring/docs/examples/proxies/alloy-receiver.alloy index 7d031c5ad..acc0ad353 100644 --- a/charts/k8s-monitoring/docs/examples/proxies/alloy-receiver.alloy +++ b/charts/k8s-monitoring/docs/examples/proxies/alloy-receiver.alloy @@ -58,14 +58,17 @@ otelcol.processor.transform "tempo" { error_mode = "ignore" metric_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"proxies-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"proxies-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } log_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"proxies-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"proxies-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } trace_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"proxies-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"proxies-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } diff --git a/charts/k8s-monitoring/docs/examples/proxies/output.yaml b/charts/k8s-monitoring/docs/examples/proxies/output.yaml index d0f0289be..dfe555e61 100644 --- a/charts/k8s-monitoring/docs/examples/proxies/output.yaml +++ b/charts/k8s-monitoring/docs/examples/proxies/output.yaml @@ -766,14 +766,17 @@ data: error_mode = "ignore" metric_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"proxies-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"proxies-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } log_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"proxies-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"proxies-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } trace_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"proxies-example-cluster\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"proxies-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil"] } @@ -927,6 +930,7 @@ data: external_labels = { cluster = "proxies-example-cluster", + k8s.cluster.name = "proxies-example-cluster", } } diff --git a/charts/k8s-monitoring/templates/destinations/_destination_otlp.tpl b/charts/k8s-monitoring/templates/destinations/_destination_otlp.tpl index 6da902a12..e8d2b8784 100644 --- a/charts/k8s-monitoring/templates/destinations/_destination_otlp.tpl +++ b/charts/k8s-monitoring/templates/destinations/_destination_otlp.tpl @@ -30,14 +30,17 @@ otelcol.processor.transform {{ include "helper.alloy_name" .name | quote }} { error_mode = "ignore" metric_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"{{ $.Values.cluster.name }}\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"{{ $.Values.cluster.name }}\") where attributes[\"k8s.cluster.name\"] == nil"] } log_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"{{ $.Values.cluster.name }}\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"{{ $.Values.cluster.name }}\") where attributes[\"k8s.cluster.name\"] == nil"] } trace_statements { context = "resource" + statements = ["set(attributes[\"cluster\"], \"{{ $.Values.cluster.name }}\") where attributes[\"cluster\"] == nil"] statements = ["set(attributes[\"k8s.cluster.name\"], \"{{ $.Values.cluster.name }}\") where attributes[\"k8s.cluster.name\"] == nil"] } diff --git a/charts/k8s-monitoring/templates/destinations/_destination_pyroscope.tpl b/charts/k8s-monitoring/templates/destinations/_destination_pyroscope.tpl index 77cdcba85..066ba5598 100644 --- a/charts/k8s-monitoring/templates/destinations/_destination_pyroscope.tpl +++ b/charts/k8s-monitoring/templates/destinations/_destination_pyroscope.tpl @@ -47,6 +47,7 @@ pyroscope.write {{ include "helper.alloy_name" .name | quote }} { external_labels = { cluster = {{ $.Values.cluster.name | quote }}, + k8s.cluster.name = {{ $.Values.cluster.name | quote }}, } } {{- end }}