Skip to content

Commit 92ed1e9

Browse files
authored
Add option to configure Prometheus maximum storage capacity (#649)
Option to configure maximum storage capacity for the Prometheus. This is addition to already configurable time retention. Signed-off-by: Michal Pryc <mpryc@redhat.com> Signed-off-by: Michal Pryc <mpryc@redhat.com>
1 parent 8affa83 commit 92ed1e9

4 files changed

Lines changed: 19 additions & 5 deletions

File tree

charts/pelorus/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ type: application
1414

1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
17-
version: 1.8.2
17+
version: 1.8.3
1818

1919
dependencies:
2020
- name: exporters

charts/pelorus/templates/prometheus-cr.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,11 @@ spec:
2626
name: thanos-objstore-config
2727
{{- end }}
2828
replicas: 2
29-
retention: {{ .Values.prometheus_retention | default "1y" }}
3029
replicaExternalLabelName: ""
30+
retention: {{ .Values.prometheus_retention | default "1y" }}
31+
{{- if .Values.prometheus_retention_size }}
32+
retentionSize: {{ .Values.prometheus_retention_size }}
33+
{{- end }}
3134
ruleNamespaceSelector: {}
3235
ruleSelector: {}
3336
serviceAccountName: pelorus-prometheus

charts/pelorus/values.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,19 @@ extra_prometheus_hosts:
1919
## Persistent storage for Prometheus Operator
2020
# https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/storage.md
2121

22-
# Set Prometheus retention time. Older data values are deleted
23-
# prometheus_retention: 1y
24-
2522
# Uncomment to use PVC for Prometheus
2623
# prometheus_storage: true
2724

2825
# Additional configuration options for Prometheus PVC
2926
# prometheus_storage_pvc_capacity: 2Gi
3027
# prometheus_storage_pvc_storageclass: "gp2"
3128

29+
# Set Prometheus retention time. Older data values are deleted
30+
# prometheus_retention: 1y
31+
# Set Prometheus retention size. If data grows over old values are deleted
32+
# This should be lower of what's defined in the prometheus_storage_pvc_capacity
33+
# prometheus_retention_size: 1GB
34+
3235
exporters:
3336
instances:
3437
- app_name: deploytime-exporter

docs/Install.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,20 @@ See [Configuring the Pelorus Stack](Configuration.md) for a full readout of all
5252

5353
### Configure Prometheus Retention
5454

55+
For detailed information about planning Prometheus storage capacity and configuration options please refer to the [operational aspects](https://prometheus.io/docs/prometheus/latest/storage/#operational-aspects) of the Prometheus documentation.
56+
5557
Prometheus is removing data older than 1 year, so if the metric you are interested in happened to be older than 1 year it won't be visible. This is configurable in the `values.yaml` file with the following option:
5658

5759
```yaml
5860
prometheus_retention: 1y
5961
```
6062
63+
Additionally user have option to configure maximum size of storage to be used by Prometheus. The oldest data will get removed first if over that limit. If the data is within retention time but over retention size it will also be removed:
64+
65+
```yaml
66+
prometheus_retention_size: 1GB
67+
```
68+
6169
### Configure Prometheus Persistent Volume (Recommended)
6270
6371
Unlike ephemeral volume that have a lifetime of a pod, persistent volume allows to withstand container restarts or crashes making Prometheus data resilient to such situations.

0 commit comments

Comments
 (0)