Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tempo-distributed] Enable autoscaling for Compactor #2817

Merged
merged 13 commits into from
Aug 5, 2024
2 changes: 1 addition & 1 deletion charts/tempo-distributed/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: tempo-distributed
description: Grafana Tempo in MicroService mode
type: application
version: 1.15.4
version: 1.16.0
appVersion: 2.5.0
engine: gotpl
home: https://grafana.com/docs/tempo/latest/
Expand Down
12 changes: 11 additions & 1 deletion charts/tempo-distributed/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# tempo-distributed

![Version: 1.15.4](https://img.shields.io/badge/Version-1.15.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.5.0](https://img.shields.io/badge/AppVersion-2.5.0-informational?style=flat-square)
![Version: 1.16.0](https://img.shields.io/badge/Version-1.16.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.5.0](https://img.shields.io/badge/AppVersion-2.5.0-informational?style=flat-square)

Grafana Tempo in MicroService mode

Expand Down Expand Up @@ -261,6 +261,16 @@ The memcached default args are removed and should be provided manually. The sett
| cache.caches[0].roles[0] | string | `"parquet-footer"` | |
| cache.caches[0].roles[1] | string | `"bloom"` | |
| cache.caches[0].roles[2] | string | `"frontend-search"` | |
| compactor.autoscaling | object | `{"enabled":false,"hpa":{"behavior":{},"enabled":false,"targetCPUUtilizationPercentage":100,"targetMemoryUtilizationPercentage":null},"keda":{"enabled":false,"triggers":[]},"maxReplicas":3,"minReplicas":1}` | Autoscaling configurations |
| compactor.autoscaling.enabled | bool | `false` | Enable autoscaling for the compactor |
| compactor.autoscaling.hpa | object | `{"behavior":{},"enabled":false,"targetCPUUtilizationPercentage":100,"targetMemoryUtilizationPercentage":null}` | Autoscaling via HPA object |
| compactor.autoscaling.hpa.behavior | object | `{}` | Autoscaling behavior configuration for the compactor |
| compactor.autoscaling.hpa.targetCPUUtilizationPercentage | int | `100` | Target CPU utilisation percentage for the compactor |
| compactor.autoscaling.hpa.targetMemoryUtilizationPercentage | string | `nil` | Target memory utilisation percentage for the compactor |
| compactor.autoscaling.keda | object | `{"enabled":false,"triggers":[]}` | Autoscaling via keda/ScaledObject |
| compactor.autoscaling.keda.triggers | list | `[]` | List of autoscaling triggers for the compactor |
| compactor.autoscaling.maxReplicas | int | `3` | Maximum autoscaling replicas for the compactor |
| compactor.autoscaling.minReplicas | int | `1` | Minimum autoscaling replicas for the compactor |
| compactor.config.compaction.block_retention | string | `"48h"` | Duration to keep blocks |
| compactor.config.compaction.compacted_block_retention | string | `"1h"` | |
| compactor.config.compaction.compaction_cycle | string | `"30s"` | The time between compaction cycles |
Expand Down
46 changes: 46 additions & 0 deletions charts/tempo-distributed/templates/compactor/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{{- if and .Values.compactor.autoscaling.enabled .Values.compactor.autoscaling.hpa.enabled }}
{{- $apiVersion := include "tempo.hpa.apiVersion" . -}}
apiVersion: {{ $apiVersion }}
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "tempo.resourceName" (dict "ctx" . "component" "compactor") }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "tempo.labels" (dict "ctx" . "component" "compactor") | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "tempo.resourceName" (dict "ctx" . "component" "compactor") }}
minReplicas: {{ .Values.compactor.autoscaling.minReplicas }}
maxReplicas: {{ .Values.compactor.autoscaling.maxReplicas }}
{{- with .Values.compactor.autoscaling.hpa.behavior }}
behavior:
{{- toYaml . | nindent 4 }}
{{- end }}
metrics:
{{- with .Values.compactor.autoscaling.hpa.targetMemoryUtilizationPercentage }}
- type: Resource
resource:
name: memory
{{- if (eq $apiVersion "autoscaling/v2") }}
target:
type: Utilization
averageUtilization: {{ . }}
{{- else }}
targetAverageUtilization: {{ . }}
{{- end }}
{{- end }}
{{- with .Values.compactor.autoscaling.hpa.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: cpu
{{- if (eq $apiVersion "autoscaling/v2") }}
target:
type: Utilization
averageUtilization: {{ . }}
{{- else }}
targetAverageUtilization: {{ . }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{- if and .Values.compactor.autoscaling.enabled .Values.compactor.autoscaling.keda.enabled }}
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: {{ include "tempo.resourceName" (dict "ctx" . "component" "compactor") }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "tempo.labels" (dict "ctx" . "component" "compactor") | nindent 4 }}
spec:
minReplicaCount: {{ .Values.compactor.autoscaling.minReplicas }}
maxReplicaCount: {{ .Values.compactor.autoscaling.maxReplicas }}
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "tempo.resourceName" (dict "ctx" . "component" "compactor") }}
triggers:
{{- range .Values.compactor.autoscaling.keda.triggers }}
- type: {{ .type | quote }}
metadata:
serverAddress: {{ .metadata.serverAddress }}
threshold: {{ .metadata.threshold | quote }}
query: |
{{- .metadata.query | nindent 8 }}
{{- end }}
{{- end }}
36 changes: 36 additions & 0 deletions charts/tempo-distributed/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,42 @@ distributor:
compactor:
# -- Number of replicas for the compactor
replicas: 1

# -- Autoscaling configurations
autoscaling:
# -- Enable autoscaling for the compactor
enabled: false
# -- Minimum autoscaling replicas for the compactor
minReplicas: 1
# -- Maximum autoscaling replicas for the compactor
maxReplicas: 3
# -- Autoscaling via HPA object
hpa:
enabled: false
# -- Autoscaling behavior configuration for the compactor
behavior: {}
# -- Target CPU utilisation percentage for the compactor
targetCPUUtilizationPercentage: 100
# -- Target memory utilisation percentage for the compactor
targetMemoryUtilizationPercentage:
# -- Autoscaling via keda/ScaledObject
keda:
# requires https://keda.sh/
enabled: false
# -- List of autoscaling triggers for the compactor
triggers: []
# - type: prometheus
# metadata:
# serverAddress: "http://<prometheus-host>:9090"
# threshold: "250"
# query: |-
# sum by (cluster, namespace, tenant) (
# tempodb_compaction_outstanding_blocks{container="compactor", namespace=~".*"}
# ) /
# ignoring(tenant) group_left count by (cluster, namespace)(
# tempo_build_info{container="compactor", namespace=~".*"}
# )

# -- hostAliases to add
hostAliases: []
# - ip: 1.2.3.4
Expand Down
Loading