grafana-sampling

by Grafana

Helm chartv1.1.7App v1.11.3

A Helm chart for a layered OTLP tail sampling and metrics generation pipeline.

About this chart

grafana-sampling

A Helm chart for a layered OTLP tail sampling and metrics generation pipeline.

Breaking change announcements

v1.0.0

Grafana Agent has been replaced with Grafana Alloy!

These sections in your values file will need to be renamed:

OldNewPurpose
grafana-agent-deploymentalloy-deploymentSettings for the Alloy load balancing instance
grafana-agent-statefulsetalloy-statefulsetSettings for the Alloy tail sampling instance

For example, if you have something like this:

grafana-agent-statefulset:
  agent:

you will need to change it to this:

alloy-statefulset:
  alloy:

This chart deploys the following architecture to your environment (note the agents have been replaced with Alloy):

Note: by default, only OTLP traces are accepted at the load balancing layer.

Chart Repo

Add the following repo to use the chart:

helm repo add grafana https://grafana.github.io/helm-charts

Installing the Chart

Use the following command to install the chart with the release name my-release. Make sure to populate the required values.

helm install my-release grafana/grafana-sampling --values - <<EOF | less
alloy-statefulset:
  alloy:
    extraEnv:
      - name: GRAFANA_CLOUD_API_KEY
        value: <REQUIRED>
      - name: GRAFANA_CLOUD_PROMETHEUS_URL
        value: <REQUIRED> # This should include /api/prom/push uri
      - name: GRAFANA_CLOUD_PROMETHEUS_USERNAME
        value: <REQUIRED>
      - name: GRAFANA_CLOUD_TEMPO_ENDPOINT
        value: <REQUIRED>
      - name: GRAFANA_CLOUD_TEMPO_USERNAME
        value: <REQUIRED>
      # This is required for adaptive metric deduplication in Grafana Cloud
      - name: POD_UID
        valueFrom:
          fieldRef:
            apiVersion: v1
            fieldPath: metadata.uid
EOF

Uninstalling the Chart

To uninstall/delete the my-release deployment:

helm delete my-release

The command removes all the Kubernetes components associated with the chart and deletes the release.

Upgrading

A major chart version change indicates that there is an incompatible breaking change needing manual actions.

Values

KeyTypeDefaultDescription
alloy-deployment.alloy.configMap.createboolfalse
alloy-deployment.alloy.extraPorts[0].namestring"otlp-grpc"
alloy-deployment.alloy.extraPorts[0].portint4317
alloy-deployment.alloy.extraPorts[0].protocolstring"TCP"
alloy-deployment.alloy.extraPorts[0].targetPortint4317
alloy-deployment.alloy.extraPorts[1].namestring"otlp-http"
alloy-deployment.alloy.extraPorts[1].portint4318
alloy-deployment.alloy.extraPorts[1].protocolstring"TCP"
alloy-deployment.alloy.extraPorts[1].targetPortint4318
alloy-deployment.alloy.resources.requests.cpustring"1"
alloy-deployment.alloy.resources.requests.memorystring"2G"
alloy-deployment.controller.autoscaling.enabledboolfalseCreates a HorizontalPodAutoscaler for controller type deployment.
alloy-deployment.controller.autoscaling.maxReplicasint5The upper limit for the number of replicas to which the autoscaler can scale up.
alloy-deployment.controller.autoscaling.minReplicasint2The lower limit for the number of replicas to which the autoscaler can scale down.
alloy-deployment.controller.autoscaling.targetCPUUtilizationPercentageint0Average 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.targetMemoryUtilizationPercentageint80Average 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.replicasint1
alloy-deployment.controller.typestring"deployment"
alloy-deployment.nameOverridestring"deployment"Do not change this.
alloy-statefulset.alloy.configMap.createboolfalse
alloy-statefulset.alloy.extraEnv[0].namestring"GRAFANA_CLOUD_API_KEY"
alloy-statefulset.alloy.extraEnv[0].valuestring"<REQUIRED>"
alloy-statefulset.alloy.extraEnv[1].namestring"GRAFANA_CLOUD_PROMETHEUS_URL"
alloy-statefulset.alloy.extraEnv[1].valuestring"<REQUIRED>"
alloy-statefulset.alloy.extraEnv[2].namestring"GRAFANA_CLOUD_PROMETHEUS_USERNAME"
alloy-statefulset.alloy.extraEnv[2].valuestring"<REQUIRED>"
alloy-statefulset.alloy.extraEnv[3].namestring"GRAFANA_CLOUD_TEMPO_ENDPOINT"
alloy-statefulset.alloy.extraEnv[3].valuestring"<REQUIRED>"
alloy-statefulset.alloy.extraEnv[4].namestring"GRAFANA_CLOUD_TEMPO_USERNAME"
alloy-statefulset.alloy.extraEnv[4].valuestring"<REQUIRED>"
alloy-statefulset.alloy.extraEnv[5].namestring"POD_UID"
alloy-statefulset.alloy.extraEnv[5].valueFrom.fieldRef.apiVersionstring"v1"
alloy-statefulset.alloy.extraEnv[5].valueFrom.fieldRef.fieldPathstring"metadata.uid"
alloy-statefulset.alloy.extraPorts[0].namestring"otlp-grpc"
alloy-statefulset.alloy.extraPorts[0].portint4317
alloy-statefulset.alloy.extraPorts[0].protocolstring"TCP"
alloy-statefulset.alloy.extraPorts[0].targetPortint4317
alloy-statefulset.alloy.resources.requests.cpustring"1"
alloy-statefulset.alloy.resources.requests.memorystring"2G"
alloy-statefulset.controller.autoscaling.enabledboolfalseCreates a HorizontalPodAutoscaler for controller type deployment.
alloy-statefulset.controller.autoscaling.maxReplicasint5The upper limit for the number of replicas to which the autoscaler can scale up.
alloy-statefulset.controller.autoscaling.minReplicasint2The lower limit for the number of replicas to which the autoscaler can scale down.
alloy-statefulset.controller.autoscaling.targetCPUUtilizationPercentageint0Average 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.targetMemoryUtilizationPercentageint80Average 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.replicasint1
alloy-statefulset.controller.typestring"statefulset"
alloy-statefulset.nameOverridestring"statefulset"Do not change this.
alloy-statefulset.rbac.createboolfalse
alloy-statefulset.service.clusterIPstring"None"
alloy-statefulset.serviceAccount.createboolfalse
batch.deploymentobject{"send_batch_max_size":0,"send_batch_size":8192,"timeout":"200ms"}Configure batch processing options.
batch.statefulset.send_batch_max_sizeint0
batch.statefulset.send_batch_sizeint8192
batch.statefulset.timeoutstring"200ms"
deployment.otlp.receiverobject{"grpc":{"keepalive":{"enforcementPolicy":{"minTime":"","permitWithoutStream":false},"serverParameters":{"maxConnectionAge":"","maxConnectionAgeGrace":"","maxConnectionIdle":"","time":"","timeout":""}},"max_recv_msg_size":"4MB"}}otlp receiver settings for deployment (loadbalancer)
deployment.otlp.receiver.grpc.keepalive.enforcementPolicy.minTimestring""Minimum time clients should wait before sending a keepalive ping. Default is 5 minutes. @section -- Receivers: OTLP
deployment.otlp.receiver.grpc.keepalive.enforcementPolicy.permitWithoutStreamboolfalseAllow clients to send keepalive pings when there are no active streams. @section -- Receivers: OTLP
deployment.otlp.receiver.grpc.keepalive.serverParameters.maxConnectionAgestring""Maximum age for non-idle connections. Default is infinity. @section -- Receivers: OTLP
deployment.otlp.receiver.grpc.keepalive.serverParameters.maxConnectionAgeGracestring""Time to wait before forcibly closing connections. Default is infinity. @section -- Receivers: OTLP
deployment.otlp.receiver.grpc.keepalive.serverParameters.maxConnectionIdlestring""Maximum age for idle connections. Default is infinity. @section -- Receivers: OTLP
deployment.otlp.receiver.grpc.keepalive.serverParameters.timestring""How often to ping inactive clients to check for liveness. Default is 2 hours. @section -- Receivers: OTLP
deployment.otlp.receiver.grpc.keepalive.serverParameters.timeoutstring""Time to wait before closing inactive clients that don’t respond to liveness checks. Default is 20 seconds. @section -- Receivers: OTLP
deployment.otlp.receiver.grpc.max_recv_msg_sizestring"4MB"gRPC max message receive size. Default to 4MB
liveDebugging.enabledboolfalseEnable live debugging in the Alloy UI.
metricsGeneration.dimensionslist["service.namespace","service.version","deployment.environment","k8s.cluster.name","k8s.pod.name"]Additional dimensions to add to generated metrics.
metricsGeneration.enabledbooltrueToggle generation of spanmetrics and servicegraph metrics.
metricsGeneration.legacybooltrueUse legacy metric names that match those used by the Tempo metrics generator.
metricsGeneration.serviceGraph.metricsFlushIntervalstring"60s"The interval at which metrics are flushed to downstream components.
metricsGeneration.spanMetrics.metricsExpirationstring"5m"Time period after which metrics are considered stale and are removed from the cache.
sampling.decisionWaitstring"15s"Wait time since the first span of a trace before making a sampling decision.
sampling.enabledbooltrueToggle tail sampling.
sampling.extraPoliciesstringA policy to sample long requests is added by default.User-defined policies in alloy format.
sampling.failedRequests.percentageint50Percentage of failed requests to sample.
sampling.failedRequests.sampleboolfalseToggle sampling failed requests.
sampling.successfulRequests.percentageint10Percentage of successful requests to sample.
sampling.successfulRequests.samplebooltrueToggle sampling successful requests.
statefulset.otlp.receiverobject{"grpc":{"keepalive":{"enforcementPolicy":{"minTime":"","permitWithoutStream":false},"serverParameters":{"maxConnectionAge":"","maxConnectionAgeGrace":"","maxConnectionIdle":"","time":"","timeout":""}},"max_recv_msg_size":"4MB"}}otlp receiver settings for statefulset (sampler)
statefulset.otlp.receiver.grpc.keepalive.enforcementPolicy.minTimestring""Minimum time clients should wait before sending a keepalive ping. Default is 5 minutes. @section -- Receivers: OTLP
statefulset.otlp.receiver.grpc.keepalive.enforcementPolicy.permitWithoutStreamboolfalseAllow clients to send keepalive pings when there are no active streams. @section -- Receivers: OTLP
statefulset.otlp.receiver.grpc.keepalive.serverParameters.maxConnectionAgestring""Maximum age for non-idle connections. Default is infinity. @section -- Receivers: OTLP
statefulset.otlp.receiver.grpc.keepalive.serverParameters.maxConnectionAgeGracestring""Time to wait before forcibly closing connections. Default is infinity. @section -- Receivers: OTLP
statefulset.otlp.receiver.grpc.keepalive.serverParameters.maxConnectionIdlestring""Maximum age for idle connections. Default is infinity. @section -- Receivers: OTLP
statefulset.otlp.receiver.grpc.keepalive.serverParameters.timestring""How often to ping inactive clients to check for liveness. Default is 2 hours. @section -- Receivers: OTLP
statefulset.otlp.receiver.grpc.keepalive.serverParameters.timeoutstring""Time to wait before closing inactive clients that don’t respond to liveness checks. Default is 20 seconds. @section -- Receivers: OTLP
statefulset.otlp.receiver.grpc.max_recv_msg_sizestring"4MB"gRPC max message receive size. Default to 4MB

Deploy grafana-sampling with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has grafana-sampling on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartgrafana-sampling is pinned at v1.1.7 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply