From d243174e7485e9fc6d1a9a8184088db624dd1675 Mon Sep 17 00:00:00 2001 From: Robert Lankford Date: Fri, 16 Aug 2024 12:18:09 -0700 Subject: [PATCH] [grafana-sampling] upgrade to grafana alloy (#3273) * feat: upgrade to grafana alloy --------- Signed-off-by: Robbie Lankford --- charts/grafana-sampling/Chart.lock | 12 +- charts/grafana-sampling/Chart.yaml | 18 +-- charts/grafana-sampling/README.md | 140 +++++++++++------- charts/grafana-sampling/README.md.gotmpl | 36 ++++- ...txt => _alloy_config_deployment.alloy.txt} | 2 +- ...xt => _alloy_config_statefulset.alloy.txt} | 6 +- .../grafana-sampling/templates/_helpers.tpl | 8 +- ...iver.txt => _otelcol_auth_basic.alloy.txt} | 2 +- ..._otelcol_connector_servicegraph.alloy.txt} | 2 +- ... _otelcol_connector_spanmetrics.alloy.txt} | 4 +- ..._otelcol_exporter_loadbalancing.alloy.txt} | 2 +- ...r.txt => _otelcol_exporter_otlp.alloy.txt} | 2 +- ...=> _otelcol_exporter_prometheus.alloy.txt} | 4 +- ...txt => _otelcol_processor_batch.alloy.txt} | 4 +- ...xt => _otelcol_processor_filter.alloy.txt} | 9 +- ...otelcol_processor_tail_sampling.alloy.txt} | 2 +- ...=> _otelcol_processor_transform.alloy.txt} | 4 +- ...r.txt => _otelcol_receiver_otlp.alloy.txt} | 4 +- ...txt => _prometheus_remote_write.alloy.txt} | 2 +- .../templates/configmap_deployment.yaml | 4 +- .../templates/configmap_statefulset.yaml | 4 +- charts/grafana-sampling/values.yaml | 16 +- 22 files changed, 176 insertions(+), 111 deletions(-) rename charts/grafana-sampling/templates/{_agent_config_deployment.river.txt => _alloy_config_deployment.alloy.txt} (79%) rename charts/grafana-sampling/templates/{_agent_config_statefulset.river.txt => _alloy_config_statefulset.alloy.txt} (79%) rename charts/grafana-sampling/templates/{_otelcol_auth_basic.river.txt => _otelcol_auth_basic.alloy.txt} (66%) rename charts/grafana-sampling/templates/{_otelcol_connector_servicegraph.river.txt => _otelcol_connector_servicegraph.alloy.txt} (82%) rename charts/grafana-sampling/templates/{_otelcol_connector_spanmetrics.river.txt => _otelcol_connector_spanmetrics.alloy.txt} (78%) rename charts/grafana-sampling/templates/{_otelcol_exporter_loadbalancing.river.txt => _otelcol_exporter_loadbalancing.alloy.txt} (76%) rename charts/grafana-sampling/templates/{_otelcol_exporter_otlp.river.txt => _otelcol_exporter_otlp.alloy.txt} (70%) rename charts/grafana-sampling/templates/{_otelcol_exporter_prometheus.river.txt => _otelcol_exporter_prometheus.alloy.txt} (55%) rename charts/grafana-sampling/templates/{_otelcol_processor_batch.river.txt => _otelcol_processor_batch.alloy.txt} (71%) rename charts/grafana-sampling/templates/{_otelcol_processor_filter.river.txt => _otelcol_processor_filter.alloy.txt} (50%) rename charts/grafana-sampling/templates/{_otelcol_processor_tail_sampling.river.txt => _otelcol_processor_tail_sampling.alloy.txt} (93%) rename charts/grafana-sampling/templates/{_otelcol_processor_transform.river.txt => _otelcol_processor_transform.alloy.txt} (87%) rename charts/grafana-sampling/templates/{_otelcol_receiver_otlp.river.txt => _otelcol_receiver_otlp.alloy.txt} (82%) rename charts/grafana-sampling/templates/{_prometheus_remote_write.river.txt => _prometheus_remote_write.alloy.txt} (82%) diff --git a/charts/grafana-sampling/Chart.lock b/charts/grafana-sampling/Chart.lock index a54564640a..acf12b4b57 100644 --- a/charts/grafana-sampling/Chart.lock +++ b/charts/grafana-sampling/Chart.lock @@ -1,9 +1,9 @@ dependencies: -- name: grafana-agent +- name: alloy repository: https://grafana.github.io/helm-charts - version: 0.36.0 -- name: grafana-agent + version: 0.6.0 +- name: alloy repository: https://grafana.github.io/helm-charts - version: 0.36.0 -digest: sha256:6d04a55dce2c09c4c250c6453e0d58f7280750bf04fce51027b4e235062413e5 -generated: "2024-03-11T15:41:30.921516-07:00" + version: 0.6.0 +digest: sha256:e9dbff0d3707c403c1fb645eb33920a2219cc3156358134537e89caf39c588a5 +generated: "2024-08-14T10:41:47.606272-07:00" diff --git a/charts/grafana-sampling/Chart.yaml b/charts/grafana-sampling/Chart.yaml index a5b985588b..00abebbde7 100644 --- a/charts/grafana-sampling/Chart.yaml +++ b/charts/grafana-sampling/Chart.yaml @@ -2,17 +2,17 @@ apiVersion: v2 name: grafana-sampling description: A Helm chart for a layered OTLP tail sampling and metrics generation pipeline. type: application -version: 0.1.1 -appVersion: "v0.40.2" +version: 1.0.0 +appVersion: "v1.3.0" sources: - - https://github.com/grafana/agent + - https://github.com/grafana/alloy - https://grafana.com/docs/grafana-cloud/monitor-applications/application-observability/setup/sampling/tail/ dependencies: - - name: grafana-agent - version: 0.36.0 + - name: alloy + version: 0.6.0 repository: https://grafana.github.io/helm-charts - alias: grafana-agent-deployment - - name: grafana-agent - version: 0.36.0 + alias: alloy-deployment + - name: alloy + version: 0.6.0 repository: https://grafana.github.io/helm-charts - alias: grafana-agent-statefulset + alias: alloy-statefulset diff --git a/charts/grafana-sampling/README.md b/charts/grafana-sampling/README.md index 0c10e0ec84..3ead959cc8 100644 --- a/charts/grafana-sampling/README.md +++ b/charts/grafana-sampling/README.md @@ -1,10 +1,37 @@ # grafana-sampling -![Version: 0.1.1](https://img.shields.io/badge/Version-0.1.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.40.2](https://img.shields.io/badge/AppVersion-v0.40.2-informational?style=flat-square) +![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.3.0](https://img.shields.io/badge/AppVersion-v1.3.0-informational?style=flat-square) A Helm chart for a layered OTLP tail sampling and metrics generation pipeline. -This chart deploys the following architecture to your environment: +## Breaking change announcements + +### **v1.0.0** + +Grafana Agent has been replaced with [Grafana Alloy](https://grafana.com/oss/alloy-opentelemetry-collector/)! + +These sections in your values file will need to be renamed: + +| Old | New | Purpose | +|-----------------------------|---------------------|------------------------------------------------| +| `grafana-agent-deployment` | `alloy-deployment` | Settings for the Alloy load balancing instance | +| `grafana-agent-statefulset` | `alloy-statefulset` | Settings for the Alloy tail sampling instance | + +For example, if you have something like this: + +```yaml +grafana-agent-statefulset: + agent: +``` + +you will need to change it to this: + +```yaml +alloy-statefulset: + alloy: +````` + +This chart deploys the following architecture to your environment (note the agents have been replaced with Alloy): ![Photo of sampling architecture](./sampling-architecture.png) Note: by default, only OTLP traces are accepted at the load balancing layer. @@ -22,13 +49,13 @@ Use the following command to install the chart with the release name `my-release ```console helm install my-release grafana/grafana-sampling --values - < - name: GRAFANA_CLOUD_PROMETHEUS_URL - value: + value: # This should include /api/prom/push uri - name: GRAFANA_CLOUD_PROMETHEUS_USERNAME value: - name: GRAFANA_CLOUD_TEMPO_ENDPOINT @@ -62,61 +89,62 @@ A major chart version change indicates that there is an incompatible breaking ch | Key | Type | Default | Description | |-----|------|---------|-------------| -| grafana-agent-deployment.agent.configMap.create | bool | `false` | | -| grafana-agent-deployment.agent.extraPorts[0].name | string | `"otlp-grpc"` | | -| grafana-agent-deployment.agent.extraPorts[0].port | int | `4317` | | -| grafana-agent-deployment.agent.extraPorts[0].protocol | string | `"TCP"` | | -| grafana-agent-deployment.agent.extraPorts[0].targetPort | int | `4317` | | -| grafana-agent-deployment.agent.extraPorts[1].name | string | `"otlp-http"` | | -| grafana-agent-deployment.agent.extraPorts[1].port | int | `4318` | | -| grafana-agent-deployment.agent.extraPorts[1].protocol | string | `"TCP"` | | -| grafana-agent-deployment.agent.extraPorts[1].targetPort | int | `4318` | | -| grafana-agent-deployment.agent.resources.requests.cpu | string | `"1"` | | -| grafana-agent-deployment.agent.resources.requests.memory | string | `"2G"` | | -| grafana-agent-deployment.controller.autoscaling.enabled | bool | `false` | Creates a HorizontalPodAutoscaler for controller type deployment. | -| grafana-agent-deployment.controller.autoscaling.maxReplicas | int | `5` | The upper limit for the number of replicas to which the autoscaler can scale up. | -| grafana-agent-deployment.controller.autoscaling.minReplicas | int | `2` | The lower limit for the number of replicas to which the autoscaler can scale down. | -| grafana-agent-deployment.controller.autoscaling.targetCPUUtilizationPercentage | int | `0` | Average CPU utilization across all relevant pods, a percentage of the requested value of the resource for the pods. Setting `targetCPUUtilizationPercentage` to 0 will disable CPU scaling. | -| grafana-agent-deployment.controller.autoscaling.targetMemoryUtilizationPercentage | int | `80` | Average Memory utilization across all relevant pods, a percentage of the requested value of the resource for the pods. Setting `targetMemoryUtilizationPercentage` to 0 will disable Memory scaling. | -| grafana-agent-deployment.controller.replicas | int | `1` | | -| grafana-agent-deployment.controller.type | string | `"deployment"` | | -| grafana-agent-deployment.nameOverride | string | `"deployment"` | Do not change this. | -| grafana-agent-statefulset.agent.configMap.create | bool | `false` | | -| grafana-agent-statefulset.agent.extraEnv[0].name | string | `"GRAFANA_CLOUD_API_KEY"` | | -| grafana-agent-statefulset.agent.extraEnv[0].value | string | `""` | | -| grafana-agent-statefulset.agent.extraEnv[1].name | string | `"GRAFANA_CLOUD_PROMETHEUS_URL"` | | -| grafana-agent-statefulset.agent.extraEnv[1].value | string | `""` | | -| grafana-agent-statefulset.agent.extraEnv[2].name | string | `"GRAFANA_CLOUD_PROMETHEUS_USERNAME"` | | -| grafana-agent-statefulset.agent.extraEnv[2].value | string | `""` | | -| grafana-agent-statefulset.agent.extraEnv[3].name | string | `"GRAFANA_CLOUD_TEMPO_ENDPOINT"` | | -| grafana-agent-statefulset.agent.extraEnv[3].value | string | `""` | | -| grafana-agent-statefulset.agent.extraEnv[4].name | string | `"GRAFANA_CLOUD_TEMPO_USERNAME"` | | -| grafana-agent-statefulset.agent.extraEnv[4].value | string | `""` | | -| grafana-agent-statefulset.agent.extraEnv[5].name | string | `"POD_UID"` | | -| grafana-agent-statefulset.agent.extraEnv[5].valueFrom.fieldRef.apiVersion | string | `"v1"` | | -| grafana-agent-statefulset.agent.extraEnv[5].valueFrom.fieldRef.fieldPath | string | `"metadata.uid"` | | -| grafana-agent-statefulset.agent.extraPorts[0].name | string | `"otlp-grpc"` | | -| grafana-agent-statefulset.agent.extraPorts[0].port | int | `4317` | | -| grafana-agent-statefulset.agent.extraPorts[0].protocol | string | `"TCP"` | | -| grafana-agent-statefulset.agent.extraPorts[0].targetPort | int | `4317` | | -| grafana-agent-statefulset.agent.resources.requests.cpu | string | `"1"` | | -| grafana-agent-statefulset.agent.resources.requests.memory | string | `"2G"` | | -| grafana-agent-statefulset.controller.autoscaling.enabled | bool | `false` | Creates a HorizontalPodAutoscaler for controller type deployment. | -| grafana-agent-statefulset.controller.autoscaling.maxReplicas | int | `5` | The upper limit for the number of replicas to which the autoscaler can scale up. | -| grafana-agent-statefulset.controller.autoscaling.minReplicas | int | `2` | The lower limit for the number of replicas to which the autoscaler can scale down. | -| grafana-agent-statefulset.controller.autoscaling.targetCPUUtilizationPercentage | int | `0` | Average CPU utilization across all relevant pods, a percentage of the requested value of the resource for the pods. Setting `targetCPUUtilizationPercentage` to 0 will disable CPU scaling. | -| grafana-agent-statefulset.controller.autoscaling.targetMemoryUtilizationPercentage | int | `80` | Average Memory utilization across all relevant pods, a percentage of the requested value of the resource for the pods. Setting `targetMemoryUtilizationPercentage` to 0 will disable Memory scaling. | -| grafana-agent-statefulset.controller.replicas | int | `1` | | -| grafana-agent-statefulset.controller.type | string | `"statefulset"` | | -| grafana-agent-statefulset.nameOverride | string | `"statefulset"` | Do not change this. | -| grafana-agent-statefulset.rbac.create | bool | `false` | | -| grafana-agent-statefulset.service.clusterIP | string | `"None"` | | -| grafana-agent-statefulset.serviceAccount.create | bool | `false` | | +| alloy-deployment.alloy.configMap.create | bool | `false` | | +| alloy-deployment.alloy.extraPorts[0].name | string | `"otlp-grpc"` | | +| alloy-deployment.alloy.extraPorts[0].port | int | `4317` | | +| alloy-deployment.alloy.extraPorts[0].protocol | string | `"TCP"` | | +| alloy-deployment.alloy.extraPorts[0].targetPort | int | `4317` | | +| alloy-deployment.alloy.extraPorts[1].name | string | `"otlp-http"` | | +| alloy-deployment.alloy.extraPorts[1].port | int | `4318` | | +| alloy-deployment.alloy.extraPorts[1].protocol | string | `"TCP"` | | +| alloy-deployment.alloy.extraPorts[1].targetPort | int | `4318` | | +| alloy-deployment.alloy.resources.requests.cpu | string | `"1"` | | +| alloy-deployment.alloy.resources.requests.memory | string | `"2G"` | | +| alloy-deployment.controller.autoscaling.enabled | bool | `false` | Creates a HorizontalPodAutoscaler for controller type deployment. | +| alloy-deployment.controller.autoscaling.maxReplicas | int | `5` | The upper limit for the number of replicas to which the autoscaler can scale up. | +| alloy-deployment.controller.autoscaling.minReplicas | int | `2` | The lower limit for the number of replicas to which the autoscaler can scale down. | +| alloy-deployment.controller.autoscaling.targetCPUUtilizationPercentage | int | `0` | Average CPU utilization across all relevant pods, a percentage of the requested value of the resource for the pods. Setting `targetCPUUtilizationPercentage` to 0 will disable CPU scaling. | +| alloy-deployment.controller.autoscaling.targetMemoryUtilizationPercentage | int | `80` | Average Memory utilization across all relevant pods, a percentage of the requested value of the resource for the pods. Setting `targetMemoryUtilizationPercentage` to 0 will disable Memory scaling. | +| alloy-deployment.controller.replicas | int | `1` | | +| alloy-deployment.controller.type | string | `"deployment"` | | +| alloy-deployment.nameOverride | string | `"deployment"` | Do not change this. | +| alloy-statefulset.alloy.configMap.create | bool | `false` | | +| alloy-statefulset.alloy.extraEnv[0].name | string | `"GRAFANA_CLOUD_API_KEY"` | | +| alloy-statefulset.alloy.extraEnv[0].value | string | `""` | | +| alloy-statefulset.alloy.extraEnv[1].name | string | `"GRAFANA_CLOUD_PROMETHEUS_URL"` | | +| alloy-statefulset.alloy.extraEnv[1].value | string | `""` | | +| alloy-statefulset.alloy.extraEnv[2].name | string | `"GRAFANA_CLOUD_PROMETHEUS_USERNAME"` | | +| alloy-statefulset.alloy.extraEnv[2].value | string | `""` | | +| alloy-statefulset.alloy.extraEnv[3].name | string | `"GRAFANA_CLOUD_TEMPO_ENDPOINT"` | | +| alloy-statefulset.alloy.extraEnv[3].value | string | `""` | | +| alloy-statefulset.alloy.extraEnv[4].name | string | `"GRAFANA_CLOUD_TEMPO_USERNAME"` | | +| alloy-statefulset.alloy.extraEnv[4].value | string | `""` | | +| alloy-statefulset.alloy.extraEnv[5].name | string | `"POD_UID"` | | +| alloy-statefulset.alloy.extraEnv[5].valueFrom.fieldRef.apiVersion | string | `"v1"` | | +| alloy-statefulset.alloy.extraEnv[5].valueFrom.fieldRef.fieldPath | string | `"metadata.uid"` | | +| alloy-statefulset.alloy.extraPorts[0].name | string | `"otlp-grpc"` | | +| alloy-statefulset.alloy.extraPorts[0].port | int | `4317` | | +| alloy-statefulset.alloy.extraPorts[0].protocol | string | `"TCP"` | | +| alloy-statefulset.alloy.extraPorts[0].targetPort | int | `4317` | | +| alloy-statefulset.alloy.resources.requests.cpu | string | `"1"` | | +| alloy-statefulset.alloy.resources.requests.memory | string | `"2G"` | | +| alloy-statefulset.controller.autoscaling.enabled | bool | `false` | Creates a HorizontalPodAutoscaler for controller type deployment. | +| alloy-statefulset.controller.autoscaling.maxReplicas | int | `5` | The upper limit for the number of replicas to which the autoscaler can scale up. | +| alloy-statefulset.controller.autoscaling.minReplicas | int | `2` | The lower limit for the number of replicas to which the autoscaler can scale down. | +| alloy-statefulset.controller.autoscaling.targetCPUUtilizationPercentage | int | `0` | Average CPU utilization across all relevant pods, a percentage of the requested value of the resource for the pods. Setting `targetCPUUtilizationPercentage` to 0 will disable CPU scaling. | +| alloy-statefulset.controller.autoscaling.targetMemoryUtilizationPercentage | int | `80` | Average Memory utilization across all relevant pods, a percentage of the requested value of the resource for the pods. Setting `targetMemoryUtilizationPercentage` to 0 will disable Memory scaling. | +| alloy-statefulset.controller.replicas | int | `1` | | +| alloy-statefulset.controller.type | string | `"statefulset"` | | +| alloy-statefulset.nameOverride | string | `"statefulset"` | Do not change this. | +| alloy-statefulset.rbac.create | bool | `false` | | +| alloy-statefulset.service.clusterIP | string | `"None"` | | +| alloy-statefulset.serviceAccount.create | bool | `false` | | | metricsGeneration.dimensions | list | `["service.namespace","service.version","deployment.environment","k8s.cluster.name"]` | Additional dimensions to add to generated metrics. | | metricsGeneration.enabled | bool | `true` | Toggle generation of spanmetrics and servicegraph metrics. | +| metricsGeneration.legacy | bool | `true` | Use legacy metric names that match those used by the Tempo metrics generator. | | sampling.decisionWait | string | `"15s"` | Wait time since the first span of a trace before making a sampling decision. | | sampling.enabled | bool | `true` | Toggle tail sampling. | -| sampling.extraPolicies | string | A policy to sample long requests is added by default. | User-defined policies in river format. | +| sampling.extraPolicies | string | A policy to sample long requests is added by default. | User-defined policies in alloy format. | | sampling.failedRequests.percentage | int | `50` | Percentage of failed requests to sample. | | sampling.failedRequests.sample | bool | `false` | Toggle sampling failed requests. | | sampling.successfulRequests.percentage | int | `10` | Percentage of successful requests to sample. | diff --git a/charts/grafana-sampling/README.md.gotmpl b/charts/grafana-sampling/README.md.gotmpl index 5cae818919..68bf0015b4 100644 --- a/charts/grafana-sampling/README.md.gotmpl +++ b/charts/grafana-sampling/README.md.gotmpl @@ -4,12 +4,38 @@ {{ template "chart.description" . }} -This chart deploys the following architecture to your environment: +## Breaking change announcements + +### **v1.0.0** + +Grafana Agent has been replaced with [Grafana Alloy](https://grafana.com/oss/alloy-opentelemetry-collector/)! + +These sections in your values file will need to be renamed: + +| Old | New | Purpose | +|-----------------------------|---------------------|------------------------------------------------| +| `grafana-agent-deployment` | `alloy-deployment` | Settings for the Alloy load balancing instance | +| `grafana-agent-statefulset` | `alloy-statefulset` | Settings for the Alloy tail sampling instance | + +For example, if you have something like this: + +```yaml +grafana-agent-statefulset: + agent: +``` + +you will need to change it to this: + +```yaml +alloy-statefulset: + alloy: +````` + +This chart deploys the following architecture to your environment (note the agents have been replaced with Alloy): ![Photo of sampling architecture](./sampling-architecture.png) Note: by default, only OTLP traces are accepted at the load balancing layer. - ## Chart Repo Add the following repo to use the chart: @@ -23,13 +49,13 @@ Use the following command to install the chart with the release name `my-release ```console helm install my-release grafana/grafana-sampling --values - < - name: GRAFANA_CLOUD_PROMETHEUS_URL - value: + value: # This should include /api/prom/push uri - name: GRAFANA_CLOUD_PROMETHEUS_USERNAME value: - name: GRAFANA_CLOUD_TEMPO_ENDPOINT diff --git a/charts/grafana-sampling/templates/_agent_config_deployment.river.txt b/charts/grafana-sampling/templates/_alloy_config_deployment.alloy.txt similarity index 79% rename from charts/grafana-sampling/templates/_agent_config_deployment.river.txt rename to charts/grafana-sampling/templates/_alloy_config_deployment.alloy.txt index c78b8e702a..c6c16a5c19 100644 --- a/charts/grafana-sampling/templates/_agent_config_deployment.river.txt +++ b/charts/grafana-sampling/templates/_alloy_config_deployment.alloy.txt @@ -1,4 +1,4 @@ -{{- define "agent.config.deployment" -}} +{{- define "alloy.config.deployment" -}} {{- include "deployment.receiver.otlp" . }} {{- include "deployment.processor.batch" . }} {{- include "deployment.exporter.loadbalancing" . }} diff --git a/charts/grafana-sampling/templates/_agent_config_statefulset.river.txt b/charts/grafana-sampling/templates/_alloy_config_statefulset.alloy.txt similarity index 79% rename from charts/grafana-sampling/templates/_agent_config_statefulset.river.txt rename to charts/grafana-sampling/templates/_alloy_config_statefulset.alloy.txt index 44e8b7f671..ee32031b58 100644 --- a/charts/grafana-sampling/templates/_agent_config_statefulset.river.txt +++ b/charts/grafana-sampling/templates/_alloy_config_statefulset.alloy.txt @@ -1,9 +1,11 @@ -{{- define "agent.config.statefulset" -}} +{{- define "alloy.config.statefulset" -}} {{- include "statefulset.receiver.otlp" . }} {{- if .Values.metricsGeneration.enabled -}} {{- include "statefulset.connector.spanmetrics" . }} {{- include "statefulset.processor.transform.drop_unneeded_resource_attributes" . }} - {{- include "statefulset.processor.transform.use_grafana_metric_names" . }} + {{- if .Values.metricsGeneration.legacy -}} + {{- include "statefulset.processor.transform.use_grafana_metric_names" . }} + {{- end -}} {{- include "statefulset.processor.filter" . }} {{- include "statefulset.connector.servicegraph" . }} {{- include "statefulset.exporter.prometheus" . }} diff --git a/charts/grafana-sampling/templates/_helpers.tpl b/charts/grafana-sampling/templates/_helpers.tpl index eabc133596..38e1d130e7 100644 --- a/charts/grafana-sampling/templates/_helpers.tpl +++ b/charts/grafana-sampling/templates/_helpers.tpl @@ -1,9 +1,9 @@ -{{/* use the release name as the serviceAccount name for deployment and statefulset agents */}} -{{- define "grafana-agent.serviceAccountName" -}} +{{/* use the release name as the serviceAccount name for deployment and statefulset collectors */}} +{{- define "alloy.serviceAccountName" -}} {{- default .Release.Name }} {{- end }} -{{/* Calculate name of image ID to use for "grafana-agent". */}} -{{- define "grafana-agent.imageId" -}} +{{/* Calculate name of image ID to use for "alloy". */}} +{{- define "alloy.imageId" -}} {{- printf ":%s" .Chart.AppVersion }} {{- end }} diff --git a/charts/grafana-sampling/templates/_otelcol_auth_basic.river.txt b/charts/grafana-sampling/templates/_otelcol_auth_basic.alloy.txt similarity index 66% rename from charts/grafana-sampling/templates/_otelcol_auth_basic.river.txt rename to charts/grafana-sampling/templates/_otelcol_auth_basic.alloy.txt index 2a34fe93ba..3a0f7389a6 100644 --- a/charts/grafana-sampling/templates/_otelcol_auth_basic.river.txt +++ b/charts/grafana-sampling/templates/_otelcol_auth_basic.alloy.txt @@ -1,6 +1,6 @@ {{- define "auth.basic" -}} otelcol.auth.basic "grafana_cloud_tempo" { - // https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.auth.basic/ + // https://grafana.com/docs/alloy/latest/reference/components/otelcol.auth.basic/ username = env("GRAFANA_CLOUD_TEMPO_USERNAME") password = env("GRAFANA_CLOUD_API_KEY") } diff --git a/charts/grafana-sampling/templates/_otelcol_connector_servicegraph.river.txt b/charts/grafana-sampling/templates/_otelcol_connector_servicegraph.alloy.txt similarity index 82% rename from charts/grafana-sampling/templates/_otelcol_connector_servicegraph.river.txt rename to charts/grafana-sampling/templates/_otelcol_connector_servicegraph.alloy.txt index f3e97c52e3..1b8fe65b8a 100644 --- a/charts/grafana-sampling/templates/_otelcol_connector_servicegraph.river.txt +++ b/charts/grafana-sampling/templates/_otelcol_connector_servicegraph.alloy.txt @@ -1,6 +1,6 @@ {{- define "statefulset.connector.servicegraph" -}} otelcol.connector.servicegraph "default" { - // https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.connector.servicegraph/ + // https://grafana.com/docs/alloy/latest/reference/components/otelcol.connector.servicegraph/ dimensions = [ {{- range $.Values.metricsGeneration.dimensions }} {{ . | quote }}, diff --git a/charts/grafana-sampling/templates/_otelcol_connector_spanmetrics.river.txt b/charts/grafana-sampling/templates/_otelcol_connector_spanmetrics.alloy.txt similarity index 78% rename from charts/grafana-sampling/templates/_otelcol_connector_spanmetrics.river.txt rename to charts/grafana-sampling/templates/_otelcol_connector_spanmetrics.alloy.txt index 1c12d34c13..f66f5bd860 100644 --- a/charts/grafana-sampling/templates/_otelcol_connector_spanmetrics.river.txt +++ b/charts/grafana-sampling/templates/_otelcol_connector_spanmetrics.alloy.txt @@ -1,13 +1,15 @@ {{- define "statefulset.connector.spanmetrics" -}} otelcol.connector.spanmetrics "default" { - // https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.connector.spanmetrics/ + // https://grafana.com/docs/alloy/latest/reference/components/otelcol.connector.spanmetrics/ {{- range $.Values.metricsGeneration.dimensions }} dimension { name = {{ . | quote }} } {{- end }} + {{ if .Values.metricsGeneration.legacy }} namespace = "traces.spanmetrics" + {{- end }} histogram { unit = "s" diff --git a/charts/grafana-sampling/templates/_otelcol_exporter_loadbalancing.river.txt b/charts/grafana-sampling/templates/_otelcol_exporter_loadbalancing.alloy.txt similarity index 76% rename from charts/grafana-sampling/templates/_otelcol_exporter_loadbalancing.river.txt rename to charts/grafana-sampling/templates/_otelcol_exporter_loadbalancing.alloy.txt index f2ec7ef43e..be11f86478 100644 --- a/charts/grafana-sampling/templates/_otelcol_exporter_loadbalancing.river.txt +++ b/charts/grafana-sampling/templates/_otelcol_exporter_loadbalancing.alloy.txt @@ -1,6 +1,6 @@ {{- define "deployment.exporter.loadbalancing" -}} otelcol.exporter.loadbalancing "default" { - // https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.exporter.loadbalancing/ + // https://grafana.com/docs/alloy/latest/reference/components/otelcol.exporter.loadbalancing/ resolver { kubernetes { diff --git a/charts/grafana-sampling/templates/_otelcol_exporter_otlp.river.txt b/charts/grafana-sampling/templates/_otelcol_exporter_otlp.alloy.txt similarity index 70% rename from charts/grafana-sampling/templates/_otelcol_exporter_otlp.river.txt rename to charts/grafana-sampling/templates/_otelcol_exporter_otlp.alloy.txt index 6b1c68285a..7d5984917e 100644 --- a/charts/grafana-sampling/templates/_otelcol_exporter_otlp.river.txt +++ b/charts/grafana-sampling/templates/_otelcol_exporter_otlp.alloy.txt @@ -1,6 +1,6 @@ {{- define "exporter.otlp" -}} otelcol.exporter.otlp "grafana_cloud_tempo" { - // https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.exporter.otlp/ + // https://grafana.com/docs/alloy/latest/reference/components/otelcol.exporter.otlp/ client { endpoint = env("GRAFANA_CLOUD_TEMPO_ENDPOINT") auth = otelcol.auth.basic.grafana_cloud_tempo.handler diff --git a/charts/grafana-sampling/templates/_otelcol_exporter_prometheus.river.txt b/charts/grafana-sampling/templates/_otelcol_exporter_prometheus.alloy.txt similarity index 55% rename from charts/grafana-sampling/templates/_otelcol_exporter_prometheus.river.txt rename to charts/grafana-sampling/templates/_otelcol_exporter_prometheus.alloy.txt index 9813580b4e..eeb28f2b3d 100644 --- a/charts/grafana-sampling/templates/_otelcol_exporter_prometheus.river.txt +++ b/charts/grafana-sampling/templates/_otelcol_exporter_prometheus.alloy.txt @@ -1,7 +1,7 @@ {{- define "statefulset.exporter.prometheus" -}} otelcol.exporter.prometheus "grafana_cloud_prometheus" { - // https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.exporter.prometheus/ - add_metric_suffixes = false + // https://grafana.com/docs/alloy/latest/reference/components/otelcol.exporter.prometheus/ + add_metric_suffixes = {{ not .Values.metricsGeneration.legacy }} forward_to = [prometheus.remote_write.grafana_cloud_prometheus.receiver] } diff --git a/charts/grafana-sampling/templates/_otelcol_processor_batch.river.txt b/charts/grafana-sampling/templates/_otelcol_processor_batch.alloy.txt similarity index 71% rename from charts/grafana-sampling/templates/_otelcol_processor_batch.river.txt rename to charts/grafana-sampling/templates/_otelcol_processor_batch.alloy.txt index 25fb2ef497..cc487634e6 100644 --- a/charts/grafana-sampling/templates/_otelcol_processor_batch.river.txt +++ b/charts/grafana-sampling/templates/_otelcol_processor_batch.alloy.txt @@ -1,6 +1,6 @@ {{- define "deployment.processor.batch" -}} otelcol.processor.batch "default" { - // https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.processor.batch/ + // https://grafana.com/docs/alloy/latest/reference/components/otelcol.processor.batch/ output { traces = [otelcol.exporter.loadbalancing.default.input] } @@ -10,7 +10,7 @@ otelcol.processor.batch "default" { {{- define "statefulset.processor.batch" -}} otelcol.processor.batch "default" { - // https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.processor.batch/ + // https://grafana.com/docs/alloy/latest/reference/components/otelcol.processor.batch/ output { {{ if .Values.metricsGeneration.enabled }} metrics = [otelcol.exporter.prometheus.grafana_cloud_prometheus.input] diff --git a/charts/grafana-sampling/templates/_otelcol_processor_filter.river.txt b/charts/grafana-sampling/templates/_otelcol_processor_filter.alloy.txt similarity index 50% rename from charts/grafana-sampling/templates/_otelcol_processor_filter.river.txt rename to charts/grafana-sampling/templates/_otelcol_processor_filter.alloy.txt index b02087ef7b..00388179b5 100644 --- a/charts/grafana-sampling/templates/_otelcol_processor_filter.river.txt +++ b/charts/grafana-sampling/templates/_otelcol_processor_filter.alloy.txt @@ -1,6 +1,6 @@ {{- define "statefulset.processor.filter" -}} otelcol.processor.filter "drop_unneeded_span_metrics" { - // https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.processor.filter/ + // https://grafana.com/docs/alloy/latest/reference/components/otelcol.processor.filter/ error_mode = "ignore" metrics { @@ -10,7 +10,12 @@ otelcol.processor.filter "drop_unneeded_span_metrics" { } output { - metrics = [otelcol.processor.transform.use_grafana_metric_names.input] + // TODO: only use grafana_metric_names is legacy is enabled. + {{ if .Values.metricsGeneration.legacy }} + metrics = [otelcol.processor.transform.use_grafana_metric_names.input] + {{ else }} + metrics = [otelcol.processor.batch.default.input] + {{- end }} } } diff --git a/charts/grafana-sampling/templates/_otelcol_processor_tail_sampling.river.txt b/charts/grafana-sampling/templates/_otelcol_processor_tail_sampling.alloy.txt similarity index 93% rename from charts/grafana-sampling/templates/_otelcol_processor_tail_sampling.river.txt rename to charts/grafana-sampling/templates/_otelcol_processor_tail_sampling.alloy.txt index 0e752a8089..0b79537a15 100644 --- a/charts/grafana-sampling/templates/_otelcol_processor_tail_sampling.river.txt +++ b/charts/grafana-sampling/templates/_otelcol_processor_tail_sampling.alloy.txt @@ -1,6 +1,6 @@ {{- define "statefulset.processor.tail_sampling" -}} otelcol.processor.tail_sampling "default" { - // https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.processor.tail_sampling/ + // https://grafana.com/docs/alloy/latest/reference/components/otelcol.processor.tail_sampling/ decision_wait = {{ .Values.sampling.decisionWait | quote }} diff --git a/charts/grafana-sampling/templates/_otelcol_processor_transform.river.txt b/charts/grafana-sampling/templates/_otelcol_processor_transform.alloy.txt similarity index 87% rename from charts/grafana-sampling/templates/_otelcol_processor_transform.river.txt rename to charts/grafana-sampling/templates/_otelcol_processor_transform.alloy.txt index 7963a325aa..b48debc8c1 100644 --- a/charts/grafana-sampling/templates/_otelcol_processor_transform.river.txt +++ b/charts/grafana-sampling/templates/_otelcol_processor_transform.alloy.txt @@ -1,6 +1,6 @@ {{- define "statefulset.processor.transform.use_grafana_metric_names" -}} otelcol.processor.transform "use_grafana_metric_names" { - // https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.processor.transform/ + // https://grafana.com/docs/alloy/latest/reference/components/otelcol.processor.transform/ error_mode = "ignore" metric_statements { @@ -20,7 +20,7 @@ otelcol.processor.transform "use_grafana_metric_names" { {{- define "statefulset.processor.transform.drop_unneeded_resource_attributes"}} otelcol.processor.transform "drop_unneeded_resource_attributes" { - // https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.processor.transform/ + // https://grafana.com/docs/alloy/latest/reference/components/otelcol.processor.transform/ error_mode = "ignore" trace_statements { diff --git a/charts/grafana-sampling/templates/_otelcol_receiver_otlp.river.txt b/charts/grafana-sampling/templates/_otelcol_receiver_otlp.alloy.txt similarity index 82% rename from charts/grafana-sampling/templates/_otelcol_receiver_otlp.river.txt rename to charts/grafana-sampling/templates/_otelcol_receiver_otlp.alloy.txt index 386a604a5a..34c9428a21 100644 --- a/charts/grafana-sampling/templates/_otelcol_receiver_otlp.river.txt +++ b/charts/grafana-sampling/templates/_otelcol_receiver_otlp.alloy.txt @@ -1,6 +1,6 @@ {{- define "deployment.receiver.otlp" -}} otelcol.receiver.otlp "default" { - // https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.receiver.otlp/ + // https://grafana.com/docs/alloy/latest/reference/components/otelcol.receiver.otlp/ // configures the default grpc endpoint "0.0.0.0:4317" grpc { } @@ -16,7 +16,7 @@ otelcol.receiver.otlp "default" { {{- define "statefulset.receiver.otlp" -}} otelcol.receiver.otlp "default" { - // https://grafana.com/docs/agent/latest/flow/reference/components/otelcol.receiver.otlp/ + // https://grafana.com/docs/alloy/latest/reference/components/otelcol.receiver.otlp/ // configures the default grpc endpoint "0.0.0.0:4317" grpc { } diff --git a/charts/grafana-sampling/templates/_prometheus_remote_write.river.txt b/charts/grafana-sampling/templates/_prometheus_remote_write.alloy.txt similarity index 82% rename from charts/grafana-sampling/templates/_prometheus_remote_write.river.txt rename to charts/grafana-sampling/templates/_prometheus_remote_write.alloy.txt index 1ddee68f17..3c76e45cd7 100644 --- a/charts/grafana-sampling/templates/_prometheus_remote_write.river.txt +++ b/charts/grafana-sampling/templates/_prometheus_remote_write.alloy.txt @@ -1,6 +1,6 @@ {{- define "statefulset.prometheus.remote_write" -}} prometheus.remote_write "grafana_cloud_prometheus" { - // https://grafana.com/docs/agent/latest/flow/reference/components/prometheus.remote_write/ + // https://grafana.com/docs/alloy/latest/reference/components/prometheus.remote_write/ endpoint { url = env("GRAFANA_CLOUD_PROMETHEUS_URL") diff --git a/charts/grafana-sampling/templates/configmap_deployment.yaml b/charts/grafana-sampling/templates/configmap_deployment.yaml index 0255b35e12..f123226148 100644 --- a/charts/grafana-sampling/templates/configmap_deployment.yaml +++ b/charts/grafana-sampling/templates/configmap_deployment.yaml @@ -3,6 +3,6 @@ kind: ConfigMap metadata: name: {{ .Release.Name }}-deployment labels: - {{- include "grafana-agent.labels" . | nindent 4 }} + {{- include "alloy.labels" . | nindent 4 }} data: - config.river: |- {{- (include "agent.config.deployment" .) | nindent 4 }} + config.alloy: |- {{- (include "alloy.config.deployment" .) | nindent 4 }} diff --git a/charts/grafana-sampling/templates/configmap_statefulset.yaml b/charts/grafana-sampling/templates/configmap_statefulset.yaml index 2a0a5499f1..40b595dc7e 100644 --- a/charts/grafana-sampling/templates/configmap_statefulset.yaml +++ b/charts/grafana-sampling/templates/configmap_statefulset.yaml @@ -3,6 +3,6 @@ kind: ConfigMap metadata: name: {{ .Release.Name }}-statefulset labels: - {{- include "grafana-agent.labels" . | nindent 4 }} + {{- include "alloy.labels" . | nindent 4 }} data: - config.river: |- {{- (include "agent.config.statefulset" .) | nindent 4 }} + config.alloy: |- {{- (include "alloy.config.statefulset" .) | nindent 4 }} diff --git a/charts/grafana-sampling/values.yaml b/charts/grafana-sampling/values.yaml index 71b9ab18c6..0644b42d79 100644 --- a/charts/grafana-sampling/values.yaml +++ b/charts/grafana-sampling/values.yaml @@ -1,6 +1,8 @@ metricsGeneration: # -- Toggle generation of spanmetrics and servicegraph metrics. enabled: true + # -- Use legacy metric names that match those used by the Tempo metrics generator. + legacy: true # -- Additional dimensions to add to generated metrics. dimensions: - service.namespace @@ -23,7 +25,7 @@ sampling: sample: false # -- Percentage of failed requests to sample. percentage: 50 - # -- User-defined policies in river format. + # -- User-defined policies in alloy format. # @default -- A policy to sample long requests is added by default. extraPolicies: |- policy { @@ -47,8 +49,8 @@ sampling: } } -# @ignored Ignore agent deployment -grafana-agent-deployment: +# @ignored Ignore alloy deployment +alloy-deployment: # -- Do not change this. nameOverride: deployment controller: @@ -65,7 +67,7 @@ grafana-agent-deployment: targetCPUUtilizationPercentage: 0 # -- Average Memory utilization across all relevant pods, a percentage of the requested value of the resource for the pods. Setting `targetMemoryUtilizationPercentage` to 0 will disable Memory scaling. targetMemoryUtilizationPercentage: 80 - agent: + alloy: # This chart creates the configmaps configMap: create: false @@ -83,8 +85,8 @@ grafana-agent-deployment: targetPort: 4318 protocol: TCP -# @ignored Ignore agent statefulset -grafana-agent-statefulset: +# @ignored Ignore alloy statefulset +alloy-statefulset: # -- Do not change this. nameOverride: statefulset controller: @@ -103,7 +105,7 @@ grafana-agent-statefulset: targetMemoryUtilizationPercentage: 80 service: clusterIP: None - agent: + alloy: extraEnv: - name: GRAFANA_CLOUD_API_KEY value: