diff --git a/charts/feature-application-observability/templates/_processor_batch.tpl b/charts/feature-application-observability/templates/_processor_batch.tpl index c9815d368d..ae2296c944 100644 --- a/charts/feature-application-observability/templates/_processor_batch.tpl +++ b/charts/feature-application-observability/templates/_processor_batch.tpl @@ -1,7 +1,7 @@ {{/* Inputs: Values (values) metricsOutput, logsOutput, tracesOutput, name */}} {{- define "feature.applicationObservability.processor.batch.alloy.target" }}otelcol.processor.batch.{{ .name | default "default" }}.input{{ end }} {{- define "feature.applicationObservability.processor.batch.alloy" }} -otelcol.processor.batch "{{ .name | default "default" }}" { +otelcol.processor.batch {{ .name | default "default" | quote }} { output { {{- if and .metricsOutput .Values.metrics.enabled }} metrics = {{ .metricsOutput }} diff --git a/charts/k8s-monitoring/charts/k8s-monitoring-feature-annotation-autodiscovery-1.0.0.tgz b/charts/k8s-monitoring/charts/k8s-monitoring-feature-annotation-autodiscovery-1.0.0.tgz index 23456547d5..1727226a86 100644 Binary files a/charts/k8s-monitoring/charts/k8s-monitoring-feature-annotation-autodiscovery-1.0.0.tgz and b/charts/k8s-monitoring/charts/k8s-monitoring-feature-annotation-autodiscovery-1.0.0.tgz differ diff --git a/charts/k8s-monitoring/charts/k8s-monitoring-feature-application-observability-1.0.0.tgz b/charts/k8s-monitoring/charts/k8s-monitoring-feature-application-observability-1.0.0.tgz index dfa63d0f34..fc5d77929b 100644 Binary files a/charts/k8s-monitoring/charts/k8s-monitoring-feature-application-observability-1.0.0.tgz and b/charts/k8s-monitoring/charts/k8s-monitoring-feature-application-observability-1.0.0.tgz differ diff --git a/charts/k8s-monitoring/charts/k8s-monitoring-feature-auto-instrumentation-1.0.0.tgz b/charts/k8s-monitoring/charts/k8s-monitoring-feature-auto-instrumentation-1.0.0.tgz index af0091cc09..ba11bb416c 100644 Binary files a/charts/k8s-monitoring/charts/k8s-monitoring-feature-auto-instrumentation-1.0.0.tgz and b/charts/k8s-monitoring/charts/k8s-monitoring-feature-auto-instrumentation-1.0.0.tgz differ diff --git a/charts/k8s-monitoring/charts/k8s-monitoring-feature-cluster-events-1.0.0.tgz b/charts/k8s-monitoring/charts/k8s-monitoring-feature-cluster-events-1.0.0.tgz index 29034bac4e..4c74f52161 100644 Binary files a/charts/k8s-monitoring/charts/k8s-monitoring-feature-cluster-events-1.0.0.tgz and b/charts/k8s-monitoring/charts/k8s-monitoring-feature-cluster-events-1.0.0.tgz differ diff --git a/charts/k8s-monitoring/charts/k8s-monitoring-feature-cluster-metrics-1.0.0.tgz b/charts/k8s-monitoring/charts/k8s-monitoring-feature-cluster-metrics-1.0.0.tgz index 40be30d8d5..f14011287a 100644 Binary files a/charts/k8s-monitoring/charts/k8s-monitoring-feature-cluster-metrics-1.0.0.tgz and b/charts/k8s-monitoring/charts/k8s-monitoring-feature-cluster-metrics-1.0.0.tgz differ diff --git a/charts/k8s-monitoring/charts/k8s-monitoring-feature-integrations-1.0.0.tgz b/charts/k8s-monitoring/charts/k8s-monitoring-feature-integrations-1.0.0.tgz index 40dca547a4..b4ce7d7216 100644 Binary files a/charts/k8s-monitoring/charts/k8s-monitoring-feature-integrations-1.0.0.tgz and b/charts/k8s-monitoring/charts/k8s-monitoring-feature-integrations-1.0.0.tgz differ diff --git a/charts/k8s-monitoring/charts/k8s-monitoring-feature-pod-logs-1.0.0.tgz b/charts/k8s-monitoring/charts/k8s-monitoring-feature-pod-logs-1.0.0.tgz index 0fcc685539..613030615a 100644 Binary files a/charts/k8s-monitoring/charts/k8s-monitoring-feature-pod-logs-1.0.0.tgz and b/charts/k8s-monitoring/charts/k8s-monitoring-feature-pod-logs-1.0.0.tgz differ diff --git a/charts/k8s-monitoring/charts/k8s-monitoring-feature-profiling-1.0.0.tgz b/charts/k8s-monitoring/charts/k8s-monitoring-feature-profiling-1.0.0.tgz index edc95f34b5..3f68b58c30 100644 Binary files a/charts/k8s-monitoring/charts/k8s-monitoring-feature-profiling-1.0.0.tgz and b/charts/k8s-monitoring/charts/k8s-monitoring-feature-profiling-1.0.0.tgz differ diff --git a/charts/k8s-monitoring/charts/k8s-monitoring-feature-prometheus-operator-objects-1.0.0.tgz b/charts/k8s-monitoring/charts/k8s-monitoring-feature-prometheus-operator-objects-1.0.0.tgz index 85d9019f21..8ec88c85dc 100644 Binary files a/charts/k8s-monitoring/charts/k8s-monitoring-feature-prometheus-operator-objects-1.0.0.tgz and b/charts/k8s-monitoring/charts/k8s-monitoring-feature-prometheus-operator-objects-1.0.0.tgz differ diff --git a/charts/k8s-monitoring/destinations/otlp-values.yaml b/charts/k8s-monitoring/destinations/otlp-values.yaml index 812af1332d..6a4aa79e72 100644 --- a/charts/k8s-monitoring/destinations/otlp-values.yaml +++ b/charts/k8s-monitoring/destinations/otlp-values.yaml @@ -8,20 +8,23 @@ name: "" # @section -- General protocol: "grpc" -traces: - # -- Whether to send traces to the OTLP destination. - # @section -- Telemetry - enabled: true - metrics: # -- Whether to send metrics to the OTLP destination. + # @default -- `true` # @section -- Telemetry - enabled: false + enabled: logs: # -- Whether to send logs to the OTLP destination. + # @default -- `true` + # @section -- Telemetry + enabled: + +traces: + # -- Whether to send traces to the OTLP destination. + # @default -- `true` # @section -- Telemetry - enabled: false + enabled: # -- The URL for the OTLP destination. # @section -- General @@ -196,6 +199,32 @@ writeBufferSize: "" # -- Processors to apply to the data before sending it. processors: + attributes: + # -- Attribute processor actions + # Format: { key: "", value: "", action: "", pattern: "", fromAttribute: "", fromContext: "", convertedType: "" } + # @section -- Attributes Processor + actions: [] + + transform: + # -- Metric transforms + # @section -- Transform Processor + metrics: + resource: [] + metric: [] + datapoint: [] + + # -- Log transforms + # @section -- Transform Processor + logs: + resource: [] + log: [] + + # -- Trace transforms + # @section -- Transform Processor + traces: + resource: [] + span: [] + spanevent: [] batch: # -- Whether to use a batch processor. # @section -- Batch Processor @@ -212,35 +241,10 @@ processors: memoryLimiter: # -- Whether to use a memory limiter. # @section -- Memory Limiter - enabled: true + enabled: false # -- How often to check memory usage. # @section -- Memory Limiter checkInterval: 1s # -- Maximum amount of memory targeted to be allocated by the process heap. # @section -- Memory Limiter limit: 0MiB - transform: - # -- Whether to use a transform processor. - # @section -- Transform Processor - enabled: false - - # -- Metric transforms - # @section -- Transform Processor - metrics: - resource: [] - metric: [] - datapoint: [] - - # -- Log transforms - # @section -- Transform Processor - log: - resource: [] - log: [] - labels: [] - - # -- Trace transforms - # @section -- Transform Processor - traces: - resource: [] - span: [] - spanevent: [] diff --git a/charts/k8s-monitoring/docs/destinations/otlp.md b/charts/k8s-monitoring/docs/destinations/otlp.md index cce36177df..19e611c2b4 100644 --- a/charts/k8s-monitoring/docs/destinations/otlp.md +++ b/charts/k8s-monitoring/docs/destinations/otlp.md @@ -68,9 +68,15 @@ This defines the options for defining a destination for OpenTelemetry data that | Key | Type | Default | Description | |-----|------|---------|-------------| -| logs.enabled | bool | `false` | Whether to send logs to the OTLP destination. | -| metrics.enabled | bool | `false` | Whether to send metrics to the OTLP destination. | -| traces.enabled | bool | `true` | Whether to send traces to the OTLP destination. | +| logs.enabled | string | `true` | Whether to send logs to the OTLP destination. | +| metrics.enabled | string | `true` | Whether to send metrics to the OTLP destination. | +| traces.enabled | string | `true` | Whether to send traces to the OTLP destination. | + +### Attributes Processor + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| processors.attributes.actions | list | `[]` | Attribute processor actions Format: { key: "", value: "", action: "", pattern: "", fromAttribute: "", fromContext: "", convertedType: "" } | ### Batch Processor @@ -86,15 +92,14 @@ This defines the options for defining a destination for OpenTelemetry data that | Key | Type | Default | Description | |-----|------|---------|-------------| | processors.memoryLimiter.checkInterval | string | `"1s"` | How often to check memory usage. | -| processors.memoryLimiter.enabled | bool | `true` | Whether to use a memory limiter. | +| processors.memoryLimiter.enabled | bool | `false` | Whether to use a memory limiter. | | processors.memoryLimiter.limit | string | `"0MiB"` | Maximum amount of memory targeted to be allocated by the process heap. | ### Transform Processor | Key | Type | Default | Description | |-----|------|---------|-------------| -| processors.transform.enabled | bool | `false` | Whether to use a transform processor. | -| processors.transform.log | object | `{"labels":[],"log":[],"resource":[]}` | Log transforms | +| processors.transform.logs | object | `{"log":[],"resource":[]}` | Log transforms | | processors.transform.metrics | object | `{"datapoint":[],"metric":[],"resource":[]}` | Metric transforms | | processors.transform.traces | object | `{"resource":[],"span":[],"spanevent":[]}` | Trace transforms | @@ -127,4 +132,4 @@ This defines the options for defining a destination for OpenTelemetry data that | Key | Type | Default | Description | |-----|------|---------|-------------| -| processors | object | `{"batch":{"enabled":true,"maxSize":0,"size":8192,"timeout":"2s"},"memoryLimiter":{"checkInterval":"1s","enabled":true,"limit":"0MiB"},"transform":{"enabled":false,"log":{"labels":[],"log":[],"resource":[]},"metrics":{"datapoint":[],"metric":[],"resource":[]},"traces":{"resource":[],"span":[],"spanevent":[]}}}` | Processors to apply to the data before sending it. | +| processors | object | `{"attributes":{"actions":[]},"batch":{"enabled":true,"maxSize":0,"size":8192,"timeout":"2s"},"memoryLimiter":{"checkInterval":"1s","enabled":false,"limit":"0MiB"},"transform":{"logs":{"log":[],"resource":[]},"metrics":{"datapoint":[],"metric":[],"resource":[]},"traces":{"resource":[],"span":[],"spanevent":[]}}}` | Processors to apply to the data before sending it. | 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 1099616cc4..d07390aeae 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,29 +68,38 @@ otelcol.auth.bearer "tempo" { token = remote.kubernetes.secret.tempo.data["tempoBearerToken"] } +otelcol.processor.attributes "tempo" { + action { + key = "cluster" + action = "upsert" + value = "bearer-token-example-cluster" + } + action { + key = "k8s.cluster.name" + action = "upsert" + value = "bearer-token-example-cluster" + } + output { + metrics = [otelcol.processor.transform.tempo.input] + logs = [otelcol.processor.transform.tempo.input] + traces = [otelcol.processor.transform.tempo.input] + } +} + otelcol.processor.transform "tempo" { error_mode = "ignore" - metric_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"bearer-token-example-cluster\") where attributes[\"cluster\"] == nil", - "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", - "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", - "set(attributes[\"k8s.cluster.name\"], \"bearer-token-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] + + output { + metrics = [otelcol.processor.batch.tempo.input] + logs = [otelcol.processor.batch.tempo.input] + traces = [otelcol.processor.batch.tempo.input] } +} + +otelcol.processor.batch "tempo" { + timeout = "2s" + send_batch_size = 8192 + send_batch_max_size = 0 output { metrics = [otelcol.exporter.otlp.tempo.input] @@ -227,6 +236,6 @@ application_observability "feature" { otelcol.exporter.loki.loki.input, ] traces_destinations = [ - otelcol.processor.transform.tempo.input, + otelcol.processor.attributes.tempo.input, ] } 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 e0730aad59..339efe8158 100644 --- a/charts/k8s-monitoring/docs/examples/auth/bearer-token/output.yaml +++ b/charts/k8s-monitoring/docs/examples/auth/bearer-token/output.yaml @@ -444,29 +444,38 @@ data: token = remote.kubernetes.secret.tempo.data["tempoBearerToken"] } - otelcol.processor.transform "tempo" { - error_mode = "ignore" - metric_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"bearer-token-example-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"bearer-token-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] + otelcol.processor.attributes "tempo" { + action { + key = "cluster" + action = "upsert" + value = "bearer-token-example-cluster" + } + action { + key = "k8s.cluster.name" + action = "upsert" + value = "bearer-token-example-cluster" } - log_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"bearer-token-example-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"bearer-token-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] + output { + metrics = [otelcol.processor.transform.tempo.input] + logs = [otelcol.processor.transform.tempo.input] + traces = [otelcol.processor.transform.tempo.input] } - trace_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"bearer-token-example-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"bearer-token-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] + } + + otelcol.processor.transform "tempo" { + error_mode = "ignore" + + output { + metrics = [otelcol.processor.batch.tempo.input] + logs = [otelcol.processor.batch.tempo.input] + traces = [otelcol.processor.batch.tempo.input] } + } + + otelcol.processor.batch "tempo" { + timeout = "2s" + send_batch_size = 8192 + send_batch_max_size = 0 output { metrics = [otelcol.exporter.otlp.tempo.input] @@ -603,7 +612,7 @@ data: otelcol.exporter.loki.loki.input, ] traces_destinations = [ - otelcol.processor.transform.tempo.input, + otelcol.processor.attributes.tempo.input, ] } --- 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 fa183c0ff1..883398973a 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,29 +67,38 @@ otelcol.auth.basic "tempo" { password = "my-password" } +otelcol.processor.attributes "tempo" { + action { + key = "cluster" + action = "upsert" + value = "embedded-secrets-example-cluster" + } + action { + key = "k8s.cluster.name" + action = "upsert" + value = "embedded-secrets-example-cluster" + } + output { + metrics = [otelcol.processor.transform.tempo.input] + logs = [otelcol.processor.transform.tempo.input] + traces = [otelcol.processor.transform.tempo.input] + } +} + otelcol.processor.transform "tempo" { error_mode = "ignore" - metric_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"embedded-secrets-example-cluster\") where attributes[\"cluster\"] == nil", - "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", - "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", - "set(attributes[\"k8s.cluster.name\"], \"embedded-secrets-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] + + output { + metrics = [otelcol.processor.batch.tempo.input] + logs = [otelcol.processor.batch.tempo.input] + traces = [otelcol.processor.batch.tempo.input] } +} + +otelcol.processor.batch "tempo" { + timeout = "2s" + send_batch_size = 8192 + send_batch_max_size = 0 output { metrics = [otelcol.exporter.otlp.tempo.input] @@ -101,8 +110,6 @@ otelcol.exporter.otlp "tempo" { client { endpoint = "http://tempo.tempo.svc:4317" auth = otelcol.auth.basic.tempo.handler - headers = { - } tls { insecure = false insecure_skip_verify = false @@ -217,6 +224,6 @@ application_observability "feature" { otelcol.exporter.loki.loki.input, ] traces_destinations = [ - otelcol.processor.transform.tempo.input, + otelcol.processor.attributes.tempo.input, ] } 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 b7403c212c..b3625b2663 100644 --- a/charts/k8s-monitoring/docs/examples/auth/embedded-secrets/output.yaml +++ b/charts/k8s-monitoring/docs/examples/auth/embedded-secrets/output.yaml @@ -432,29 +432,38 @@ data: password = "my-password" } - otelcol.processor.transform "tempo" { - error_mode = "ignore" - metric_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"embedded-secrets-example-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"embedded-secrets-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] + otelcol.processor.attributes "tempo" { + action { + key = "cluster" + action = "upsert" + value = "embedded-secrets-example-cluster" } - log_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"embedded-secrets-example-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"embedded-secrets-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] + action { + key = "k8s.cluster.name" + action = "upsert" + value = "embedded-secrets-example-cluster" + } + output { + metrics = [otelcol.processor.transform.tempo.input] + logs = [otelcol.processor.transform.tempo.input] + traces = [otelcol.processor.transform.tempo.input] } - trace_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"embedded-secrets-example-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"embedded-secrets-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] + } + + otelcol.processor.transform "tempo" { + error_mode = "ignore" + + output { + metrics = [otelcol.processor.batch.tempo.input] + logs = [otelcol.processor.batch.tempo.input] + traces = [otelcol.processor.batch.tempo.input] } + } + + otelcol.processor.batch "tempo" { + timeout = "2s" + send_batch_size = 8192 + send_batch_max_size = 0 output { metrics = [otelcol.exporter.otlp.tempo.input] @@ -466,8 +475,6 @@ data: client { endpoint = "http://tempo.tempo.svc:4317" auth = otelcol.auth.basic.tempo.handler - headers = { - } tls { insecure = false insecure_skip_verify = false @@ -582,7 +589,7 @@ data: otelcol.exporter.loki.loki.input, ] traces_destinations = [ - otelcol.processor.transform.tempo.input, + otelcol.processor.attributes.tempo.input, ] } --- 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 dbdee3abde..5639c5d7cb 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 @@ -88,29 +88,38 @@ otelcol.auth.bearer "tempo" { token = remote.kubernetes.secret.tempo.data["tempoBearerToken"] } +otelcol.processor.attributes "tempo" { + action { + key = "cluster" + action = "upsert" + value = "external-secrets-example-cluster" + } + action { + key = "k8s.cluster.name" + action = "upsert" + value = "external-secrets-example-cluster" + } + output { + metrics = [otelcol.processor.transform.tempo.input] + logs = [otelcol.processor.transform.tempo.input] + traces = [otelcol.processor.transform.tempo.input] + } +} + otelcol.processor.transform "tempo" { error_mode = "ignore" - metric_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"external-secrets-example-cluster\") where attributes[\"cluster\"] == nil", - "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", - "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", - "set(attributes[\"k8s.cluster.name\"], \"external-secrets-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] + + output { + metrics = [otelcol.processor.batch.tempo.input] + logs = [otelcol.processor.batch.tempo.input] + traces = [otelcol.processor.batch.tempo.input] } +} + +otelcol.processor.batch "tempo" { + timeout = "2s" + send_batch_size = 8192 + send_batch_max_size = 0 output { metrics = [otelcol.exporter.otlp.tempo.input] @@ -247,6 +256,6 @@ application_observability "feature" { otelcol.exporter.loki.loki.input, ] traces_destinations = [ - otelcol.processor.transform.tempo.input, + otelcol.processor.attributes.tempo.input, ] } 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 d50b7ca775..fba12780d1 100644 --- a/charts/k8s-monitoring/docs/examples/auth/external-secrets/output.yaml +++ b/charts/k8s-monitoring/docs/examples/auth/external-secrets/output.yaml @@ -473,29 +473,38 @@ data: token = remote.kubernetes.secret.tempo.data["tempoBearerToken"] } - otelcol.processor.transform "tempo" { - error_mode = "ignore" - metric_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"external-secrets-example-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"external-secrets-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] + otelcol.processor.attributes "tempo" { + action { + key = "cluster" + action = "upsert" + value = "external-secrets-example-cluster" + } + action { + key = "k8s.cluster.name" + action = "upsert" + value = "external-secrets-example-cluster" } - log_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"external-secrets-example-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"external-secrets-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] + output { + metrics = [otelcol.processor.transform.tempo.input] + logs = [otelcol.processor.transform.tempo.input] + traces = [otelcol.processor.transform.tempo.input] } - trace_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"external-secrets-example-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"external-secrets-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] + } + + otelcol.processor.transform "tempo" { + error_mode = "ignore" + + output { + metrics = [otelcol.processor.batch.tempo.input] + logs = [otelcol.processor.batch.tempo.input] + traces = [otelcol.processor.batch.tempo.input] } + } + + otelcol.processor.batch "tempo" { + timeout = "2s" + send_batch_size = 8192 + send_batch_max_size = 0 output { metrics = [otelcol.exporter.otlp.tempo.input] @@ -632,7 +641,7 @@ data: otelcol.exporter.loki.loki.input, ] traces_destinations = [ - otelcol.processor.transform.tempo.input, + otelcol.processor.attributes.tempo.input, ] } --- 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 9168a0dbdb..8c317f8706 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 @@ -1,38 +1,47 @@ // Destination: otlp-gateway (otlp) otelcol.receiver.prometheus "otlp_gateway" { output { - metrics = [otelcol.processor.transform.otlp_gateway.input] + metrics = [otelcol.processor.attributes.otlp_gateway.input] } } otelcol.receiver.loki "otlp_gateway" { output { + logs = [otelcol.processor.attributes.otlp_gateway.input] + } +} + +otelcol.processor.attributes "otlp_gateway" { + action { + key = "cluster" + action = "upsert" + value = "applications-cluster" + } + action { + key = "k8s.cluster.name" + action = "upsert" + value = "applications-cluster" + } + output { + metrics = [otelcol.processor.transform.otlp_gateway.input] logs = [otelcol.processor.transform.otlp_gateway.input] + traces = [otelcol.processor.transform.otlp_gateway.input] } } otelcol.processor.transform "otlp_gateway" { error_mode = "ignore" - metric_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"applications-cluster\") where attributes[\"cluster\"] == nil", - "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", - "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", - "set(attributes[\"k8s.cluster.name\"], \"applications-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] + + output { + metrics = [otelcol.processor.batch.otlp_gateway.input] + logs = [otelcol.processor.batch.otlp_gateway.input] + traces = [otelcol.processor.batch.otlp_gateway.input] } +} + +otelcol.processor.batch "otlp_gateway" { + timeout = "2s" + send_batch_size = 8192 + send_batch_max_size = 0 output { metrics = [otelcol.exporter.otlp.otlp_gateway.input] @@ -43,8 +52,6 @@ otelcol.processor.transform "otlp_gateway" { otelcol.exporter.otlp "otlp_gateway" { client { endpoint = "http://otlp-gateway.example.com" - headers = { - } tls { insecure = false insecure_skip_verify = false @@ -153,13 +160,13 @@ declare "application_observability" { } application_observability "feature" { metrics_destinations = [ - otelcol.processor.transform.otlp_gateway.input, + otelcol.processor.attributes.otlp_gateway.input, ] logs_destinations = [ - otelcol.processor.transform.otlp_gateway.input, + otelcol.processor.attributes.otlp_gateway.input, ] traces_destinations = [ - otelcol.processor.transform.otlp_gateway.input, + otelcol.processor.attributes.otlp_gateway.input, ] } 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 01d20e78e0..87670de207 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 @@ -26,38 +26,47 @@ data: // Destination: otlp-gateway (otlp) otelcol.receiver.prometheus "otlp_gateway" { output { - metrics = [otelcol.processor.transform.otlp_gateway.input] + metrics = [otelcol.processor.attributes.otlp_gateway.input] } } otelcol.receiver.loki "otlp_gateway" { output { + logs = [otelcol.processor.attributes.otlp_gateway.input] + } + } + + otelcol.processor.attributes "otlp_gateway" { + action { + key = "cluster" + action = "upsert" + value = "applications-cluster" + } + action { + key = "k8s.cluster.name" + action = "upsert" + value = "applications-cluster" + } + output { + metrics = [otelcol.processor.transform.otlp_gateway.input] logs = [otelcol.processor.transform.otlp_gateway.input] + traces = [otelcol.processor.transform.otlp_gateway.input] } } otelcol.processor.transform "otlp_gateway" { error_mode = "ignore" - metric_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"applications-cluster\") where attributes[\"cluster\"] == nil", - "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", - "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", - "set(attributes[\"k8s.cluster.name\"], \"applications-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] + + output { + metrics = [otelcol.processor.batch.otlp_gateway.input] + logs = [otelcol.processor.batch.otlp_gateway.input] + traces = [otelcol.processor.batch.otlp_gateway.input] } + } + + otelcol.processor.batch "otlp_gateway" { + timeout = "2s" + send_batch_size = 8192 + send_batch_max_size = 0 output { metrics = [otelcol.exporter.otlp.otlp_gateway.input] @@ -68,8 +77,6 @@ data: otelcol.exporter.otlp "otlp_gateway" { client { endpoint = "http://otlp-gateway.example.com" - headers = { - } tls { insecure = false insecure_skip_verify = false @@ -178,13 +185,13 @@ data: } application_observability "feature" { metrics_destinations = [ - otelcol.processor.transform.otlp_gateway.input, + otelcol.processor.attributes.otlp_gateway.input, ] logs_destinations = [ - otelcol.processor.transform.otlp_gateway.input, + otelcol.processor.attributes.otlp_gateway.input, ] traces_destinations = [ - otelcol.processor.transform.otlp_gateway.input, + otelcol.processor.attributes.otlp_gateway.input, ] } diff --git a/charts/k8s-monitoring/docs/examples/features/auto-instrumentation/beyla-metrics-and-traces/alloy-metrics.alloy b/charts/k8s-monitoring/docs/examples/features/auto-instrumentation/beyla-metrics-and-traces/alloy-metrics.alloy index aa1e8e03f6..7ea85070d2 100644 --- a/charts/k8s-monitoring/docs/examples/features/auto-instrumentation/beyla-metrics-and-traces/alloy-metrics.alloy +++ b/charts/k8s-monitoring/docs/examples/features/auto-instrumentation/beyla-metrics-and-traces/alloy-metrics.alloy @@ -1,38 +1,47 @@ // Destination: otlp-gateway (otlp) otelcol.receiver.prometheus "otlp_gateway" { output { - metrics = [otelcol.processor.transform.otlp_gateway.input] + metrics = [otelcol.processor.attributes.otlp_gateway.input] } } otelcol.receiver.loki "otlp_gateway" { output { + logs = [otelcol.processor.attributes.otlp_gateway.input] + } +} + +otelcol.processor.attributes "otlp_gateway" { + action { + key = "cluster" + action = "upsert" + value = "annotation-autodiscovery-with-traces-cluster" + } + action { + key = "k8s.cluster.name" + action = "upsert" + value = "annotation-autodiscovery-with-traces-cluster" + } + output { + metrics = [otelcol.processor.transform.otlp_gateway.input] logs = [otelcol.processor.transform.otlp_gateway.input] + traces = [otelcol.processor.transform.otlp_gateway.input] } } otelcol.processor.transform "otlp_gateway" { error_mode = "ignore" - metric_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] - } - log_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] - } - trace_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] + + output { + metrics = [otelcol.processor.batch.otlp_gateway.input] + logs = [otelcol.processor.batch.otlp_gateway.input] + traces = [otelcol.processor.batch.otlp_gateway.input] } +} + +otelcol.processor.batch "otlp_gateway" { + timeout = "2s" + send_batch_size = 8192 + send_batch_max_size = 0 output { metrics = [otelcol.exporter.otlp.otlp_gateway.input] @@ -43,8 +52,6 @@ otelcol.processor.transform "otlp_gateway" { otelcol.exporter.otlp "otlp_gateway" { client { endpoint = "http://otlp-gateway.example.com" - headers = { - } tls { insecure = false insecure_skip_verify = false diff --git a/charts/k8s-monitoring/docs/examples/features/auto-instrumentation/beyla-metrics-and-traces/alloy-receiver.alloy b/charts/k8s-monitoring/docs/examples/features/auto-instrumentation/beyla-metrics-and-traces/alloy-receiver.alloy index b02894951a..1ee25ba723 100644 --- a/charts/k8s-monitoring/docs/examples/features/auto-instrumentation/beyla-metrics-and-traces/alloy-receiver.alloy +++ b/charts/k8s-monitoring/docs/examples/features/auto-instrumentation/beyla-metrics-and-traces/alloy-receiver.alloy @@ -1,38 +1,47 @@ // Destination: otlp-gateway (otlp) otelcol.receiver.prometheus "otlp_gateway" { output { - metrics = [otelcol.processor.transform.otlp_gateway.input] + metrics = [otelcol.processor.attributes.otlp_gateway.input] } } otelcol.receiver.loki "otlp_gateway" { output { + logs = [otelcol.processor.attributes.otlp_gateway.input] + } +} + +otelcol.processor.attributes "otlp_gateway" { + action { + key = "cluster" + action = "upsert" + value = "annotation-autodiscovery-with-traces-cluster" + } + action { + key = "k8s.cluster.name" + action = "upsert" + value = "annotation-autodiscovery-with-traces-cluster" + } + output { + metrics = [otelcol.processor.transform.otlp_gateway.input] logs = [otelcol.processor.transform.otlp_gateway.input] + traces = [otelcol.processor.transform.otlp_gateway.input] } } otelcol.processor.transform "otlp_gateway" { error_mode = "ignore" - metric_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] - } - log_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] - } - trace_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] + + output { + metrics = [otelcol.processor.batch.otlp_gateway.input] + logs = [otelcol.processor.batch.otlp_gateway.input] + traces = [otelcol.processor.batch.otlp_gateway.input] } +} + +otelcol.processor.batch "otlp_gateway" { + timeout = "2s" + send_batch_size = 8192 + send_batch_max_size = 0 output { metrics = [otelcol.exporter.otlp.otlp_gateway.input] @@ -43,8 +52,6 @@ otelcol.processor.transform "otlp_gateway" { otelcol.exporter.otlp "otlp_gateway" { client { endpoint = "http://otlp-gateway.example.com" - headers = { - } tls { insecure = false insecure_skip_verify = false @@ -153,12 +160,12 @@ declare "application_observability" { } application_observability "feature" { metrics_destinations = [ - otelcol.processor.transform.otlp_gateway.input, + otelcol.processor.attributes.otlp_gateway.input, ] logs_destinations = [ - otelcol.processor.transform.otlp_gateway.input, + otelcol.processor.attributes.otlp_gateway.input, ] traces_destinations = [ - otelcol.processor.transform.otlp_gateway.input, + otelcol.processor.attributes.otlp_gateway.input, ] } diff --git a/charts/k8s-monitoring/docs/examples/features/auto-instrumentation/beyla-metrics-and-traces/output.yaml b/charts/k8s-monitoring/docs/examples/features/auto-instrumentation/beyla-metrics-and-traces/output.yaml index 64bc3a4362..20f98caee9 100644 --- a/charts/k8s-monitoring/docs/examples/features/auto-instrumentation/beyla-metrics-and-traces/output.yaml +++ b/charts/k8s-monitoring/docs/examples/features/auto-instrumentation/beyla-metrics-and-traces/output.yaml @@ -58,38 +58,47 @@ data: // Destination: otlp-gateway (otlp) otelcol.receiver.prometheus "otlp_gateway" { output { - metrics = [otelcol.processor.transform.otlp_gateway.input] + metrics = [otelcol.processor.attributes.otlp_gateway.input] } } otelcol.receiver.loki "otlp_gateway" { output { + logs = [otelcol.processor.attributes.otlp_gateway.input] + } + } + + otelcol.processor.attributes "otlp_gateway" { + action { + key = "cluster" + action = "upsert" + value = "annotation-autodiscovery-with-traces-cluster" + } + action { + key = "k8s.cluster.name" + action = "upsert" + value = "annotation-autodiscovery-with-traces-cluster" + } + output { + metrics = [otelcol.processor.transform.otlp_gateway.input] logs = [otelcol.processor.transform.otlp_gateway.input] + traces = [otelcol.processor.transform.otlp_gateway.input] } } otelcol.processor.transform "otlp_gateway" { error_mode = "ignore" - metric_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] - } - log_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] - } - trace_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] + + output { + metrics = [otelcol.processor.batch.otlp_gateway.input] + logs = [otelcol.processor.batch.otlp_gateway.input] + traces = [otelcol.processor.batch.otlp_gateway.input] } + } + + otelcol.processor.batch "otlp_gateway" { + timeout = "2s" + send_batch_size = 8192 + send_batch_max_size = 0 output { metrics = [otelcol.exporter.otlp.otlp_gateway.input] @@ -100,8 +109,6 @@ data: otelcol.exporter.otlp "otlp_gateway" { client { endpoint = "http://otlp-gateway.example.com" - headers = { - } tls { insecure = false insecure_skip_verify = false @@ -229,38 +236,47 @@ data: // Destination: otlp-gateway (otlp) otelcol.receiver.prometheus "otlp_gateway" { output { - metrics = [otelcol.processor.transform.otlp_gateway.input] + metrics = [otelcol.processor.attributes.otlp_gateway.input] } } otelcol.receiver.loki "otlp_gateway" { output { + logs = [otelcol.processor.attributes.otlp_gateway.input] + } + } + + otelcol.processor.attributes "otlp_gateway" { + action { + key = "cluster" + action = "upsert" + value = "annotation-autodiscovery-with-traces-cluster" + } + action { + key = "k8s.cluster.name" + action = "upsert" + value = "annotation-autodiscovery-with-traces-cluster" + } + output { + metrics = [otelcol.processor.transform.otlp_gateway.input] logs = [otelcol.processor.transform.otlp_gateway.input] + traces = [otelcol.processor.transform.otlp_gateway.input] } } otelcol.processor.transform "otlp_gateway" { error_mode = "ignore" - metric_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] - } - log_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] - } - trace_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"annotation-autodiscovery-with-traces-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] + + output { + metrics = [otelcol.processor.batch.otlp_gateway.input] + logs = [otelcol.processor.batch.otlp_gateway.input] + traces = [otelcol.processor.batch.otlp_gateway.input] } + } + + otelcol.processor.batch "otlp_gateway" { + timeout = "2s" + send_batch_size = 8192 + send_batch_max_size = 0 output { metrics = [otelcol.exporter.otlp.otlp_gateway.input] @@ -271,8 +287,6 @@ data: otelcol.exporter.otlp "otlp_gateway" { client { endpoint = "http://otlp-gateway.example.com" - headers = { - } tls { insecure = false insecure_skip_verify = false @@ -381,13 +395,13 @@ data: } application_observability "feature" { metrics_destinations = [ - otelcol.processor.transform.otlp_gateway.input, + otelcol.processor.attributes.otlp_gateway.input, ] logs_destinations = [ - otelcol.processor.transform.otlp_gateway.input, + otelcol.processor.attributes.otlp_gateway.input, ] traces_destinations = [ - otelcol.processor.transform.otlp_gateway.input, + otelcol.processor.attributes.otlp_gateway.input, ] } --- diff --git a/charts/k8s-monitoring/docs/examples/proxies/alloy-receiver.alloy b/charts/k8s-monitoring/docs/examples/proxies/alloy-receiver.alloy index 1fa157b626..ab8f2d55a6 100644 --- a/charts/k8s-monitoring/docs/examples/proxies/alloy-receiver.alloy +++ b/charts/k8s-monitoring/docs/examples/proxies/alloy-receiver.alloy @@ -58,29 +58,38 @@ loki.write "loki" { } // Destination: tempo (otlp) +otelcol.processor.attributes "tempo" { + action { + key = "cluster" + action = "upsert" + value = "proxies-example-cluster" + } + action { + key = "k8s.cluster.name" + action = "upsert" + value = "proxies-example-cluster" + } + output { + metrics = [otelcol.processor.transform.tempo.input] + logs = [otelcol.processor.transform.tempo.input] + traces = [otelcol.processor.transform.tempo.input] + } +} + otelcol.processor.transform "tempo" { error_mode = "ignore" - metric_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"proxies-example-cluster\") where attributes[\"cluster\"] == nil", - "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", - "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", - "set(attributes[\"k8s.cluster.name\"], \"proxies-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] + + output { + metrics = [otelcol.processor.batch.tempo.input] + logs = [otelcol.processor.batch.tempo.input] + traces = [otelcol.processor.batch.tempo.input] } +} + +otelcol.processor.batch "tempo" { + timeout = "2s" + send_batch_size = 8192 + send_batch_max_size = 0 output { metrics = [otelcol.exporter.otlp.tempo.input] @@ -91,8 +100,6 @@ otelcol.processor.transform "tempo" { otelcol.exporter.otlp "tempo" { client { endpoint = "http://tempo.tempo.svc:4317" - headers = { - } tls { insecure = false insecure_skip_verify = false @@ -207,6 +214,6 @@ application_observability "feature" { otelcol.exporter.loki.loki.input, ] traces_destinations = [ - otelcol.processor.transform.tempo.input, + otelcol.processor.attributes.tempo.input, ] } diff --git a/charts/k8s-monitoring/docs/examples/proxies/output.yaml b/charts/k8s-monitoring/docs/examples/proxies/output.yaml index 0df052c427..795e169da1 100644 --- a/charts/k8s-monitoring/docs/examples/proxies/output.yaml +++ b/charts/k8s-monitoring/docs/examples/proxies/output.yaml @@ -784,29 +784,38 @@ data: } // Destination: tempo (otlp) - otelcol.processor.transform "tempo" { - error_mode = "ignore" - metric_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"proxies-example-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"proxies-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] + otelcol.processor.attributes "tempo" { + action { + key = "cluster" + action = "upsert" + value = "proxies-example-cluster" } - log_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"proxies-example-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"proxies-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] + action { + key = "k8s.cluster.name" + action = "upsert" + value = "proxies-example-cluster" } - trace_statements { - context = "resource" - statements = [ - "set(attributes[\"cluster\"], \"proxies-example-cluster\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"proxies-example-cluster\") where attributes[\"k8s.cluster.name\"] == nil", - ] + output { + metrics = [otelcol.processor.transform.tempo.input] + logs = [otelcol.processor.transform.tempo.input] + traces = [otelcol.processor.transform.tempo.input] } + } + + otelcol.processor.transform "tempo" { + error_mode = "ignore" + + output { + metrics = [otelcol.processor.batch.tempo.input] + logs = [otelcol.processor.batch.tempo.input] + traces = [otelcol.processor.batch.tempo.input] + } + } + + otelcol.processor.batch "tempo" { + timeout = "2s" + send_batch_size = 8192 + send_batch_max_size = 0 output { metrics = [otelcol.exporter.otlp.tempo.input] @@ -817,8 +826,6 @@ data: otelcol.exporter.otlp "tempo" { client { endpoint = "http://tempo.tempo.svc:4317" - headers = { - } tls { insecure = false insecure_skip_verify = false @@ -933,7 +940,7 @@ data: otelcol.exporter.loki.loki.input, ] traces_destinations = [ - otelcol.processor.transform.tempo.input, + otelcol.processor.attributes.tempo.input, ] } --- diff --git a/charts/k8s-monitoring/schema-mods/definitions/otlp-destination.schema.json b/charts/k8s-monitoring/schema-mods/definitions/otlp-destination.schema.json index db7d91a5c1..72fd321ac5 100644 --- a/charts/k8s-monitoring/schema-mods/definitions/otlp-destination.schema.json +++ b/charts/k8s-monitoring/schema-mods/definitions/otlp-destination.schema.json @@ -93,7 +93,7 @@ "type": "object", "properties": { "enabled": { - "type": "boolean" + "type": "null" } } }, @@ -101,7 +101,7 @@ "type": "object", "properties": { "enabled": { - "type": "boolean" + "type": "null" } } }, @@ -111,6 +111,14 @@ "processors": { "type": "object", "properties": { + "attributes": { + "type": "object", + "properties": { + "actions": { + "type": "array" + } + } + }, "batch": { "type": "object", "properties": { @@ -145,15 +153,9 @@ "transform": { "type": "object", "properties": { - "enabled": { - "type": "boolean" - }, - "log": { + "logs": { "type": "object", "properties": { - "labels": { - "type": "array" - }, "log": { "type": "array" }, @@ -268,7 +270,7 @@ "type": "object", "properties": { "enabled": { - "type": "boolean" + "type": "null" } } }, diff --git a/charts/k8s-monitoring/schema-mods/types-and-enums.json b/charts/k8s-monitoring/schema-mods/types-and-enums.json index bd51290c1b..0efdfb1e17 100644 --- a/charts/k8s-monitoring/schema-mods/types-and-enums.json +++ b/charts/k8s-monitoring/schema-mods/types-and-enums.json @@ -12,22 +12,40 @@ }, "definitions": { "loki-destination": {"properties": { - "auth": {"properties": {"type": {"enum": ["none", "basic", "bearerToken"]}}}, + "auth": {"properties": {"type": {"enum": ["none", "basic", "bearerToken", "oauth2"]}}}, "secret": {"properties": {"create": {"type": ["null", "boolean"]}}}, "tenantId": {"type": ["string", "number"]} }}, "otlp-destination": {"properties": { - "auth": {"properties": {"type": {"enum": ["none", "basic", "bearerToken"]}}}, + "auth": {"properties": {"type": {"enum": ["none", "basic", "bearerToken", "oauth2"]}}}, "secret": {"properties": {"create": {"type": ["null", "boolean"]}}}, - "tenantId": {"type": ["string", "number"]} + "tenantId": {"type": ["string", "number"]}, + "metrics": {"properties": {"enabled": {"type": ["null", "boolean"]}}}, + "logs": {"properties": {"enabled": {"type": ["null", "boolean"]}}}, + "traces": {"properties": {"enabled": {"type": ["null", "boolean"]}}}, + "processors": {"properties": { + "attributes": {"properties": { + "actions": {"type": "array", "items": { + "type": "object", "properties": { + "key": {"type": "string"}, + "action": {"type": "string"}, + "value": {}, + "pattern": {"type": ["null", "string"]}, + "fromAttribute": {"type": ["null", "string"]}, + "fromContext": {"type": ["null", "string"]}, + "convertedType": {"type": ["null", "string"]} + }, "required": ["key", "action"] + }} + }} + }} }}, "prometheus-destination": {"properties": { - "auth": {"properties": {"type": {"enum": ["none", "basic", "bearerToken", "sigv4"]}}}, + "auth": {"properties": {"type": {"enum": ["none", "basic", "bearerToken", "oauth2", "sigv4"]}}}, "secret": {"properties": {"create": {"type": ["null", "boolean"]}}}, "tenantId": {"type": ["string", "number"]} }}, "pyroscope-destination": {"properties": { - "auth": {"properties": {"type": {"enum": ["none", "basic", "bearerToken"]}}}, + "auth": {"properties": {"type": {"enum": ["none", "basic", "bearerToken", "oauth2"]}}}, "secret": {"properties": {"create": {"type": ["null", "boolean"]}}}, "tenantId": {"type": ["string", "number"]} }} diff --git a/charts/k8s-monitoring/templates/destinations/_destination_otlp.tpl b/charts/k8s-monitoring/templates/destinations/_destination_otlp.tpl index b96073ccba..91a3c1cfdc 100644 --- a/charts/k8s-monitoring/templates/destinations/_destination_otlp.tpl +++ b/charts/k8s-monitoring/templates/destinations/_destination_otlp.tpl @@ -24,31 +24,208 @@ otelcol.auth.basic {{ include "helper.alloy_name" .name | quote }} { otelcol.auth.bearer {{ include "helper.alloy_name" .name | quote }} { token = {{ include "secrets.read" (dict "object" . "key" "auth.bearerToken") }} } +{{- else if eq (include "secrets.authType" .) "oauth2" }} +otelcol.auth.oauth2 {{ include "helper.alloy_name" .name | quote }} { + {{- if eq (include "secrets.usesSecret" (dict "object" . "key" "auth.oauth2.clientId")) "true" }} + client_id = {{ include "secrets.read" (dict "object" . "key" "auth.oauth2.clientId" "nonsensitive" true) }} + {{- end }} + {{- if .auth.oauth2.clientSecretFile }} + client_secret_file = {{ .auth.oauth2.clientSecretFile | quote }} + {{- else if eq (include "secrets.usesSecret" (dict "object" . "key" "auth.oauth2.clientSecret")) "true" }} + client_secret = {{ include "secrets.read" (dict "object" . "key" "auth.oauth2.clientSecret") }} + {{- end }} + {{- if .auth.oauth2.endpointParams }} + endpoint_params = { + {{- range $k, $v := .auth.oauth2.endpointParams }} + {{ $k }} = {{ $v | quote }}, + {{- end }} + } + {{- end }} + {{- if .auth.oauth2.scopes }} + scopes = {{ .auth.oauth2.scopes | toJson }} + {{- end }} + {{- if .auth.oauth2.tokenURL }} + token_url = {{ .auth.oauth2.tokenURL | quote }} + {{- end }} +} +{{- end }} + +otelcol.processor.attributes {{ include "helper.alloy_name" .name | quote }} { + action { + key = "cluster" + action = "upsert" + value = {{ $.Values.cluster.name | quote }} + } + action { + key = "k8s.cluster.name" + action = "upsert" + value = {{ $.Values.cluster.name | quote }} + } +{{- range $action := .processors.attributes.actions }} + action { + key = {{ $action.key | quote }} + action = {{ $action.action | quote }} + {{- if $action.value }} + value = {{ $action.value | quote }} + {{- end }} + {{- if $action.pattern }} + pattern = {{ $action.pattern | quote }} + {{- end }} + {{- if $action.fromAttribute }} + from_attribute = {{ $action.fromAttribute | quote }} + {{- end }} + {{- if $action.fromContext }} + from_context = {{ $action.fromContext | quote }} + {{- end }} + {{- if $action.convertedType }} + converted_type = {{ $action.convertedType | quote }} + {{- end }} + } {{- end }} + output { + metrics = [otelcol.processor.transform.{{ include "helper.alloy_name" .name }}.input] + logs = [otelcol.processor.transform.{{ include "helper.alloy_name" .name }}.input] + traces = [otelcol.processor.transform.{{ include "helper.alloy_name" .name }}.input] + } +} otelcol.processor.transform {{ include "helper.alloy_name" .name | quote }} { error_mode = "ignore" +{{- if ne .metrics.enabled false }} +{{- if .processors.transform.metrics.resource }} metric_statements { context = "resource" statements = [ - "set(attributes[\"cluster\"], \"{{ $.Values.cluster.name }}\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"{{ $.Values.cluster.name }}\") where attributes[\"k8s.cluster.name\"] == nil", +{{- range $transform := .processors.transform.metrics.resource }} +{{ $transform | quote | indent 6 }}, +{{- end }} + ] + } +{{- end }} +{{- if .processors.transform.metrics.metric }} + metric_statements { + context = "metric" + statements = [ +{{- range $transform := .processors.transform.metrics.metric }} +{{ $transform | quote | indent 6 }}, +{{- end }} ] } +{{- end }} +{{- if .processors.transform.metrics.datapoint }} + metric_statements { + context = "datapoint" + statements = [ +{{- range $transform := .processors.transform.metrics.datapoint }} +{{ $transform | quote | indent 6 }}, +{{- end }} + ] + } +{{- end }} +{{- end }} +{{- if ne .logs.enabled false }} +{{- if .processors.transform.logs.resource }} log_statements { context = "resource" statements = [ - "set(attributes[\"cluster\"], \"{{ $.Values.cluster.name }}\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"{{ $.Values.cluster.name }}\") where attributes[\"k8s.cluster.name\"] == nil", +{{- range $transform := .processors.transform.logs.resource }} +{{ $transform | quote | indent 6 }}, +{{- end }} ] } +{{- end }} +{{- if .processors.transform.logs.log }} + log_statements { + context = "log" + statements = [ +{{- range $transform := .processors.transform.logs.log }} +{{ $transform | quote | indent 6 }}, +{{- end }} + ] + } +{{- end }} +{{- if .processors.transform.logs.scope }} + log_statements { + context = "scope" + statements = [ +{{- range $transform := .processors.transform.logs.scope }} +{{ $transform | quote | indent 6 }}, +{{- end }} + ] + } +{{- end }} +{{- end }} +{{- if ne .traces.enabled false }} +{{- if .processors.transform.traces.resource }} trace_statements { context = "resource" statements = [ - "set(attributes[\"cluster\"], \"{{ $.Values.cluster.name }}\") where attributes[\"cluster\"] == nil", - "set(attributes[\"k8s.cluster.name\"], \"{{ $.Values.cluster.name }}\") where attributes[\"k8s.cluster.name\"] == nil", +{{- range $transform := .processors.transform.traces.resource }} +{{ $transform | quote | indent 6 }}, +{{- end }} + ] + } +{{- end }} +{{- if .processors.transform.traces.span }} + trace_statements { + context = "span" + statements = [ +{{- range $transform := .processors.transform.traces.span }} +{{ $transform | quote | indent 6 }}, +{{- end }} ] } +{{- end }} +{{- if .processors.transform.traces.spanevent }} + trace_statements { + context = "spanevent" + statements = [ +{{- range $transform := .processors.transform.traces.spanevent }} +{{ $transform | quote | indent 6 }}, +{{- end }} + ] + } +{{- end }} +{{- end }} +{{- if .processors.batch.enabled }} + + output { +{{- if ne .metrics.enabled false }} + metrics = [otelcol.processor.batch.{{ include "helper.alloy_name" .name }}.input] +{{- end }} +{{- if ne .logs.enabled false }} + logs = [otelcol.processor.batch.{{ include "helper.alloy_name" .name }}.input] +{{- end }} +{{- if ne .traces.enabled false }} + traces = [otelcol.processor.batch.{{ include "helper.alloy_name" .name }}.input] +{{- end }} + } +} + +otelcol.processor.batch {{ include "helper.alloy_name" .name | quote }} { + timeout = {{ .processors.batch.timeout | quote }} + send_batch_size = {{ .processors.batch.size | int }} + send_batch_max_size = {{ .processors.batch.maxSize | int }} +{{- end }} +{{- if .processors.memoryLimiter.enabled }} + + output { +{{- if ne .metrics.enabled false }} + metrics = [otelcol.processor.memory_limiter.{{ include "helper.alloy_name" .name }}.input] +{{- end }} +{{- if ne .logs.enabled false }} + logs = [otelcol.processor.memory_limiter.{{ include "helper.alloy_name" .name }}.input] +{{- end }} +{{- if ne .traces.enabled false }} + traces = [otelcol.processor.memory_limiter.{{ include "helper.alloy_name" .name }}.input] +{{- end }} + } +} + +otelcol.processor.memory_limiter {{ include "helper.alloy_name" .name | quote }} { + check_interval = {{ .processors.memoryLimiter.checkInterval | quote }} + limit = {{ .processors.memoryLimiter.limit | quote }} +{{- end }} output { {{- $target := "" }} @@ -57,9 +234,15 @@ otelcol.processor.transform {{ include "helper.alloy_name" .name | quote }} { {{- else if eq .protocol "http" }} {{- $target = printf "otelcol.exporter.otlphttp.%s.input" (include "helper.alloy_name" .name) }} {{- end }} +{{- if ne .metrics.enabled false }} metrics = [{{ $target }}] +{{- end }} +{{- if ne .logs.enabled false }} logs = [{{ $target }}] +{{- end }} +{{- if ne .traces.enabled false }} traces = [{{ $target }}] +{{- end }} } } @@ -78,7 +261,10 @@ otelcol.exporter.otlphttp {{ include "helper.alloy_name" .name | quote }} { auth = otelcol.auth.basic.{{ include "helper.alloy_name" .name }}.handler {{- else if eq .auth.type "bearerToken" }} auth = otelcol.auth.bearer.{{ include "helper.alloy_name" .name }}.handler +{{- else if eq .auth.type "oauth2" }} + auth = otelcol.auth.oauth2.{{ include "helper.alloy_name" .name }}.handler {{- end }} +{{- if or (eq (include "secrets.usesSecret" (dict "object" . "key" "tenantId")) "true") .extraHeaders .extraHeadersFrom }} headers = { {{- if eq (include "secrets.usesSecret" (dict "object" . "key" "tenantId")) "true" }} "X-Scope-OrgID" = {{ include "secrets.read" (dict "object" . "key" "tenantId" "nonsensitive" true) }}, @@ -90,6 +276,7 @@ otelcol.exporter.otlphttp {{ include "helper.alloy_name" .name | quote }} { {{ $key | quote }} = {{ $value }}, {{- end }} } +{{- end }} {{- if .readBufferSize }} read_buffer_size = {{ .readBufferSize | quote }} {{- end }} @@ -131,7 +318,7 @@ otelcol.exporter.otlphttp {{ include "helper.alloy_name" .name | quote }} { {{- define "destinations.otlp.alloy.prometheus.metrics.target" }}otelcol.receiver.prometheus.{{ include "helper.alloy_name" .name }}.receiver{{ end }} {{- define "destinations.otlp.alloy.loki.logs.target" }}otelcol.receiver.loki.{{ include "helper.alloy_name" .name }}.receiver{{ end }} -{{- define "destinations.otlp.alloy.otlp.target" }}otelcol.processor.transform.{{ include "helper.alloy_name" .name }}.input{{ end }} +{{- define "destinations.otlp.alloy.otlp.target" }}otelcol.processor.attributes.{{ include "helper.alloy_name" .name }}.input{{ end }} {{- define "destinations.otlp.alloy.otlp.metrics.target" }}{{ include "destinations.otlp.alloy.otlp.target" . }}{{- end }} {{- define "destinations.otlp.alloy.otlp.logs.target" }}{{ include "destinations.otlp.alloy.otlp.target" . }}{{- end }} {{- define "destinations.otlp.alloy.otlp.traces.target" }}{{ include "destinations.otlp.alloy.otlp.target" . }}{{- end }} diff --git a/charts/k8s-monitoring/templates/destinations/_destination_prometheus.tpl b/charts/k8s-monitoring/templates/destinations/_destination_prometheus.tpl index c110166076..d6bc318c20 100644 --- a/charts/k8s-monitoring/templates/destinations/_destination_prometheus.tpl +++ b/charts/k8s-monitoring/templates/destinations/_destination_prometheus.tpl @@ -36,6 +36,40 @@ prometheus.remote_write {{ include "helper.alloy_name" .name | quote }} { } {{- else if eq (include "secrets.authType" .) "bearerToken" }} bearer_token = {{ include "secrets.read" (dict "object" . "key" "auth.bearerToken") }} +{{- else if eq (include "secrets.authType" .) "oauth2" }} + oauth2 { + client_id = {{ include "secrets.read" (dict "object" . "key" "auth.oauth2.clientId" "nonsensitive" true) }} + {{- if eq .auth.oauth2.clientSecretFile "" }} + client_secret = {{ include "secrets.read" (dict "object" . "key" "auth.oauth2.clientSecret") }} + {{- else }} + client_secret_file = {{ .auth.oauth2.clientSecretFile | quote }} + {{- end }} + {{- if .auth.oauth2.endpointParams }} + endpoint_params = { + {{- range $k, $v := .auth.oauth2.endpointParams }} + {{ $k }} = {{ $v | quote }}, + {{- end }} + } + {{- end }} + {{- if .auth.oauth2.proxyURL }} + proxy_url = {{ .auth.oauth2.proxyURL | quote }} + {{- end }} + {{- if .auth.oauth2.noProxy }} + no_proxy = {{ .auth.oauth2.noProxy | quote }} + {{- end }} + {{- if .auth.oauth2.proxyFromEnvironment }} + proxyFromEnvironment = {{ .auth.oauth2.proxyFromEnvironment }} + {{- end }} + {{- if .auth.oauth2.proxyConnectHeader }} + proxy_connect_header = {{ .auth.oauth2.proxyConnectHeader | toJson }} + {{- end }} + {{- if .auth.oauth2.scopes }} + scopes = {{ .auth.oauth2.scopes | toJson }} + {{- end }} + {{- if .auth.oauth2.tokenURL }} + token_url = {{ .auth.oauth2.tokenURL | quote }} + {{- end }} + } {{- else if eq (include "secrets.authType" .) "sigv4" }} sigv4 { access_key = {{ include "secrets.read" (dict "object" . "key" "auth.sigv4.accessKey" "nonsensitive" true) }} diff --git a/charts/k8s-monitoring/templates/destinations/_destination_pyroscope.tpl b/charts/k8s-monitoring/templates/destinations/_destination_pyroscope.tpl index fe0e9393cf..e1f878e073 100644 --- a/charts/k8s-monitoring/templates/destinations/_destination_pyroscope.tpl +++ b/charts/k8s-monitoring/templates/destinations/_destination_pyroscope.tpl @@ -27,6 +27,40 @@ pyroscope.write {{ include "helper.alloy_name" .name | quote }} { } {{- else if eq (include "secrets.authType" .) "bearerToken" }} bearer_token = {{ include "secrets.read" (dict "object" . "key" "auth.bearerToken") }} +{{- else if eq (include "secrets.authType" .) "oauth2" }} + oauth2 { + client_id = {{ include "secrets.read" (dict "object" . "key" "auth.oauth2.clientId" "nonsensitive" true) }} + {{- if eq .auth.oauth2.clientSecretFile "" }} + client_secret = {{ include "secrets.read" (dict "object" . "key" "auth.oauth2.clientSecret") }} + {{- else }} + client_secret_file = {{ .auth.oauth2.clientSecretFile | quote }} + {{- end }} + {{- if .auth.oauth2.endpointParams }} + endpoint_params = { + {{- range $k, $v := .auth.oauth2.endpointParams }} + {{ $k }} = {{ $v | quote }}, + {{- end }} + } + {{- end }} + {{- if .auth.oauth2.proxyURL }} + proxy_url = {{ .auth.oauth2.proxyURL | quote }} + {{- end }} + {{- if .auth.oauth2.noProxy }} + no_proxy = {{ .auth.oauth2.noProxy | quote }} + {{- end }} + {{- if .auth.oauth2.proxyFromEnvironment }} + proxyFromEnvironment = {{ .auth.oauth2.proxyFromEnvironment }} + {{- end }} + {{- if .auth.oauth2.proxyConnectHeader }} + proxy_connect_header = {{ .auth.oauth2.proxyConnectHeader | toJson }} + {{- end }} + {{- if .auth.oauth2.scopes }} + scopes = {{ .auth.oauth2.scopes | toJson }} + {{- end }} + {{- if .auth.oauth2.tokenURL }} + token_url = {{ .auth.oauth2.tokenURL | quote }} + {{- end }} + } {{- end }} {{- if .tls }} diff --git a/charts/k8s-monitoring/tests/integration/auth/configs/grafana.yaml b/charts/k8s-monitoring/tests/integration/auth/configs/grafana.yaml new file mode 100644 index 0000000000..0c9fb4c986 --- /dev/null +++ b/charts/k8s-monitoring/tests/integration/auth/configs/grafana.yaml @@ -0,0 +1,9 @@ +--- +datasources: + datasources.yaml: + apiVersion: 1 + datasources: + - name: Prometheus + type: prometheus + url: http://prometheus-server.prometheus.svc:9090 + isDefault: true diff --git a/charts/k8s-monitoring/tests/integration/auth/configs/nginx-basic-auth.yaml b/charts/k8s-monitoring/tests/integration/auth/configs/nginx-basic-auth.yaml new file mode 100644 index 0000000000..06d906dff7 --- /dev/null +++ b/charts/k8s-monitoring/tests/integration/auth/configs/nginx-basic-auth.yaml @@ -0,0 +1,20 @@ +service: + type: ClusterIP +serverBlock: |- + server { + listen 0.0.0.0:8080; + location /auth-gateway/ { + auth_basic "Remote Write"; + auth_basic_user_file /etc/nginx/conf/htpasswd; + + proxy_pass http://prometheus-server.prometheus.svc:9090/; + } + } +extraVolumes: + - name: passwords-file + secret: + secretName: passwords +extraVolumeMounts: + - name: passwords-file + mountPath: /etc/nginx/conf/htpasswd + subPath: htpasswd diff --git a/charts/k8s-monitoring/tests/integration/auth/configs/nginx.yaml b/charts/k8s-monitoring/tests/integration/auth/configs/nginx-bearer-token.yaml similarity index 71% rename from charts/k8s-monitoring/tests/integration/auth/configs/nginx.yaml rename to charts/k8s-monitoring/tests/integration/auth/configs/nginx-bearer-token.yaml index b7d0f90973..09827c0241 100644 --- a/charts/k8s-monitoring/tests/integration/auth/configs/nginx.yaml +++ b/charts/k8s-monitoring/tests/integration/auth/configs/nginx-bearer-token.yaml @@ -8,7 +8,7 @@ serverBlock: |- return 401; } - proxy_pass http://prometheus-noauth-server.prometheus.svc:9090/; + proxy_pass http://prometheus-server.prometheus.svc:9090/; } location /otlp/ { @@ -16,6 +16,6 @@ serverBlock: |- return 401; } - proxy_pass http://prometheus-noauth-server.prometheus.svc:9090/; + proxy_pass http://prometheus-server.prometheus.svc:9090/; } } diff --git a/charts/k8s-monitoring/tests/integration/auth/configs/passwords.yaml b/charts/k8s-monitoring/tests/integration/auth/configs/passwords.yaml new file mode 100644 index 0000000000..10e4d2cef6 --- /dev/null +++ b/charts/k8s-monitoring/tests/integration/auth/configs/passwords.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: v1 +kind: Secret +metadata: + name: passwords +stringData: + htpasswd: |- + promuser:$1$U8rZL/KV$zJKBFBZnXXBc.kztxoGg2.:prompassword + oteluser:$1$yO5Ig8p/$j.1w61d8O8rTF9c0xAXPo/:otelpassword diff --git a/charts/k8s-monitoring/tests/integration/auth/configs/prometheus-basicauth.yaml b/charts/k8s-monitoring/tests/integration/auth/configs/prometheus-basicauth.yaml deleted file mode 100644 index 18f4d837d3..0000000000 --- a/charts/k8s-monitoring/tests/integration/auth/configs/prometheus-basicauth.yaml +++ /dev/null @@ -1,39 +0,0 @@ ---- -server: - extraFlags: - - enable-feature=otlp-write-receiver - - enable-feature=remote-write-receiver - - web.config.file=/etc/config/web.yml - - persistentVolume: - enabled: false - - probeHeaders: - - name: "Authorization" - value: "Basic cHJvbXVzZXI6cHJvbWV0aGV1c3Bhc3N3b3Jk" - - service: - servicePort: 9090 - -serverFiles: - prometheus.yml: - scrape_configs: [] - web.yml: - basic_auth_users: - promuser: $2a$12$1UJsAG4QnhjjDzqcSVkZmeDxxjgIFOAmzfuVTybTuhhDnYgfuAbAq # "prometheuspassword" - -configmapReload: - prometheus: - enabled: false - -alertmanager: - enabled: false - -kube-state-metrics: - enabled: false - -prometheus-node-exporter: - enabled: false - -prometheus-pushgateway: - enabled: false diff --git a/charts/k8s-monitoring/tests/integration/auth/configs/prometheus-noauth.yaml b/charts/k8s-monitoring/tests/integration/auth/configs/prometheus.yaml similarity index 100% rename from charts/k8s-monitoring/tests/integration/auth/configs/prometheus-noauth.yaml rename to charts/k8s-monitoring/tests/integration/auth/configs/prometheus.yaml diff --git a/charts/k8s-monitoring/tests/integration/auth/test-manifest.yaml b/charts/k8s-monitoring/tests/integration/auth/test-manifest.yaml index ba689066c2..15a34e8a61 100644 --- a/charts/k8s-monitoring/tests/integration/auth/test-manifest.yaml +++ b/charts/k8s-monitoring/tests/integration/auth/test-manifest.yaml @@ -1,20 +1,31 @@ --- prerequisites: - - name: nginx-bearer-token + - name: prometheus + type: helm + repo: https://prometheus-community.github.io/helm-charts + chart: prometheus + namespace: prometheus + valuesFile: charts/k8s-monitoring/tests/integration/auth/configs/prometheus.yaml + - name: passwords + type: manifest + namespace: prometheus + file: charts/k8s-monitoring/tests/integration/auth/configs/passwords.yaml + - name: nginx-basic-auth type: helm repo: https://charts.bitnami.com/bitnami chart: nginx namespace: prometheus - valuesFile: charts/k8s-monitoring/tests/integration/auth/configs/nginx.yaml - - name: prometheus-noauth + valuesFile: charts/k8s-monitoring/tests/integration/auth/configs/nginx-basic-auth.yaml + - name: nginx-bearer-token type: helm - repo: https://prometheus-community.github.io/helm-charts - chart: prometheus + repo: https://charts.bitnami.com/bitnami + chart: nginx namespace: prometheus - valuesFile: charts/k8s-monitoring/tests/integration/auth/configs/prometheus-noauth.yaml - - name: prometheus-basicauth + valuesFile: charts/k8s-monitoring/tests/integration/auth/configs/nginx-bearer-token.yaml + + - name: grafana type: helm - repo: https://prometheus-community.github.io/helm-charts - chart: prometheus - namespace: prometheus - valuesFile: charts/k8s-monitoring/tests/integration/auth/configs/prometheus-basicauth.yaml + repo: https://grafana.github.io/helm-charts + chart: grafana + namespace: grafana + valuesFile: charts/k8s-monitoring/tests/integration/auth/configs/grafana.yaml diff --git a/charts/k8s-monitoring/tests/integration/auth/test-values.yaml b/charts/k8s-monitoring/tests/integration/auth/test-values.yaml index 297fec6041..f46d1e92e8 100644 --- a/charts/k8s-monitoring/tests/integration/auth/test-values.yaml +++ b/charts/k8s-monitoring/tests/integration/auth/test-values.yaml @@ -1,20 +1,17 @@ --- tests: - env: - PROMETHEUS_URL: http://prometheus-noauth-server.prometheus.svc:9090/api/v1/query + PROMETHEUS_URL: http://prometheus-server.prometheus.svc:9090/api/v1/query queries: - query: kubernetes_build_info{cluster="auth-integration-test", destination="prometheus-noauth"} type: promql + - query: kubernetes_build_info{cluster="auth-integration-test", destination="prometheus-basicauth"} + type: promql - query: kubernetes_build_info{cluster="auth-integration-test", destination="prometheus-bearer-token"} type: promql -# - query: kubernetes_build_info{cluster="auth-integration-test", destination="prometheus-otlp-noauth"} -# type: promql - - env: - PROMETHEUS_URL: http://prometheus-basicauth-server.prometheus.svc:9090/api/v1/query - PROMETHEUS_USER: promuser - PROMETHEUS_PASS: prometheuspassword - queries: - - query: kubernetes_build_info{cluster="auth-integration-test", destination="prometheus-basicauth"} + - query: kubernetes_build_info{cluster="auth-integration-test", destination="prometheus-otlp-noauth"} + type: promql + - query: kubernetes_build_info{cluster="auth-integration-test", destination="prometheus-otlp-basicauth"} + type: promql + - query: kubernetes_build_info{cluster="auth-integration-test", destination="prometheus-otlp-bearer-token"} type: promql -# - query: kubernetes_build_info{cluster="auth-integration-test", destination="prometheus-otlp-basicauth"} -# type: promql diff --git a/charts/k8s-monitoring/tests/integration/auth/values.yaml b/charts/k8s-monitoring/tests/integration/auth/values.yaml index e27036c6bf..64e92e0bb4 100644 --- a/charts/k8s-monitoring/tests/integration/auth/values.yaml +++ b/charts/k8s-monitoring/tests/integration/auth/values.yaml @@ -4,17 +4,17 @@ cluster: destinations: - name: prometheus-noauth type: prometheus - url: http://prometheus-noauth-server.prometheus.svc:9090/api/v1/write + url: http://prometheus-server.prometheus.svc:9090/api/v1/write extraLabels: destination: prometheus-noauth - name: prometheus-basicauth type: prometheus - url: http://prometheus-basicauth-server.prometheus.svc:9090/api/v1/write + url: http://nginx-basic-auth.prometheus.svc/auth-gateway/api/v1/write auth: type: basic username: promuser - password: prometheuspassword + password: prompassword extraLabels: destination: prometheus-basicauth @@ -31,7 +31,13 @@ destinations: - name: prometheus-otlp-noauth type: otlp protocol: http - url: http://prometheus-noauth-server.prometheus.svc:9090/api/v1/otlp + url: http://prometheus-server.prometheus.svc:9090/api/v1/otlp + processors: + attributes: + actions: + - key: destination + action: upsert + value: prometheus-otlp-noauth metrics: {enabled: true} logs: {enabled: false} traces: {enabled: false} @@ -39,11 +45,17 @@ destinations: - name: prometheus-otlp-basicauth type: otlp protocol: http - url: http://prometheus-basicauth-server.prometheus.svc:9090/api/v1/otlp + url: http://nginx-basic-auth.prometheus.svc/auth-gateway/api/v1/otlp auth: type: basic - username: promuser - password: prometheuspassword + username: oteluser + password: otelpassword + processors: + attributes: + actions: + - key: destination + action: upsert + value: prometheus-otlp-basicauth metrics: {enabled: true} logs: {enabled: false} traces: {enabled: false} @@ -55,6 +67,12 @@ destinations: auth: type: bearerToken bearerToken: my-secret-otlp-token + processors: + attributes: + actions: + - key: destination + action: upsert + value: prometheus-otlp-bearer-token metrics: {enabled: true} logs: {enabled: false} traces: {enabled: false} @@ -62,8 +80,18 @@ destinations: clusterMetrics: enabled: true destinations: [prometheus-noauth, prometheus-basicauth, prometheus-bearer-token, prometheus-otlp-noauth, prometheus-otlp-basicauth, prometheus-otlp-bearer-token] + kubelet: + metricsTuning: + includeMetrics: [kubernetes_build_info] + kubeletResource: {enabled: false} + cadvisor: {enabled: false} kube-state-metrics: {enabled: false, deploy: false} node-exporter: {enabled: false, deploy: false} + windows-exporter: {enabled: false, deploy: false} alloy-metrics: enabled: true + liveDebugging: + enabled: true + alloy: + stabilityLevel: experimental diff --git a/charts/k8s-monitoring/values.schema.json b/charts/k8s-monitoring/values.schema.json index e159f20369..37d6982f8c 100644 --- a/charts/k8s-monitoring/values.schema.json +++ b/charts/k8s-monitoring/values.schema.json @@ -1111,7 +1111,8 @@ "enum": [ "none", "basic", - "bearerToken" + "bearerToken", + "oauth2" ] }, "username": { @@ -1298,7 +1299,8 @@ "enum": [ "none", "basic", - "bearerToken" + "bearerToken", + "oauth2" ] }, "username": { @@ -1322,7 +1324,10 @@ "type": "object", "properties": { "enabled": { - "type": "boolean" + "type": [ + "null", + "boolean" + ] } } }, @@ -1330,7 +1335,10 @@ "type": "object", "properties": { "enabled": { - "type": "boolean" + "type": [ + "null", + "boolean" + ] } } }, @@ -1340,6 +1348,54 @@ "processors": { "type": "object", "properties": { + "attributes": { + "type": "object", + "properties": { + "actions": { + "type": "array", + "items": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "action": { + "type": "string" + }, + "value": {}, + "pattern": { + "type": [ + "null", + "string" + ] + }, + "fromAttribute": { + "type": [ + "null", + "string" + ] + }, + "fromContext": { + "type": [ + "null", + "string" + ] + }, + "convertedType": { + "type": [ + "null", + "string" + ] + } + }, + "required": [ + "key", + "action" + ] + } + } + } + }, "batch": { "type": "object", "properties": { @@ -1374,15 +1430,9 @@ "transform": { "type": "object", "properties": { - "enabled": { - "type": "boolean" - }, - "log": { + "logs": { "type": "object", "properties": { - "labels": { - "type": "array" - }, "log": { "type": "array" }, @@ -1503,7 +1553,10 @@ "type": "object", "properties": { "enabled": { - "type": "boolean" + "type": [ + "null", + "boolean" + ] } } }, @@ -1631,6 +1684,7 @@ "none", "basic", "bearerToken", + "oauth2", "sigv4" ] }, @@ -1864,7 +1918,8 @@ "enum": [ "none", "basic", - "bearerToken" + "bearerToken", + "oauth2" ] }, "username": {