Skip to content

Commit 0e8c3b1

Browse files
authored
Merge pull request #49264 from bburt-rh/RHDEVDOCS-4060-config-map-settings-for-data-retention-period-for-thanos-ruler
RHDEVDOCS-4060 - config map settings for data retention period for Thanos Ruler
2 parents de7dbf1 + d85cac5 commit 0e8c3b1

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * monitoring/configuring-the-monitoring-stack.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="modifying-the-retention-time-for-thanos-ruler-metrics-data_{context}"]
7+
= Modifying the retention time for Thanos Ruler metrics data
8+
9+
By default, for user-defined projects, Thanos Ruler automatically retains metrics data for 24 hours.
10+
You can modify the retention time to change how long this data is retained by specifying a time value in the `user-workload-monitoring-config` config map in the `openshift-user-workload-monitoring` namespace.
11+
12+
.Prerequisites
13+
14+
* You have installed the OpenShift CLI (`oc`).
15+
* A cluster administrator has enabled monitoring for user-defined projects.
16+
* You have access to the cluster as a user with the `cluster-admin` role or as a user with the `user-workload-monitoring-config-edit` role in the `openshift-user-workload-monitoring` project.
17+
* You have created the `user-workload-monitoring-config` `ConfigMap` object.
18+
19+
[WARNING]
20+
====
21+
Saving changes to a monitoring config map might restart monitoring processes and redeploy the pods and other resources in the related project.
22+
The running monitoring processes in that project might also restart.
23+
====
24+
25+
.Procedure
26+
27+
. Edit the `user-workload-monitoring-config` `ConfigMap` object in the `openshift-user-workload-monitoring` project:
28+
+
29+
[source,terminal]
30+
----
31+
$ oc -n openshift-user-workload-monitoring edit configmap user-workload-monitoring-config
32+
----
33+
34+
. Add the retention time configuration under `data/config.yaml`:
35+
+
36+
[source,yaml]
37+
----
38+
apiVersion: v1
39+
kind: ConfigMap
40+
metadata:
41+
name: user-workload-monitoring-config
42+
namespace: openshift-user-workload-monitoring
43+
data:
44+
config.yaml: |
45+
thanosRuler:
46+
retention: <time_specification> <1>
47+
----
48+
+
49+
<1> Specify the retention time in the following format: a number directly followed by `ms` (milliseconds), `s` (seconds), `m` (minutes), `h` (hours), `d` (days), `w` (weeks), or `y` (years).
50+
You can also combine time values for specific times, such as `1h30m15s`.
51+
The default is `24h`.
52+
+
53+
The following example sets the retention time to 10 days for Thanos Ruler data:
54+
+
55+
[source,yaml]
56+
----
57+
apiVersion: v1
58+
kind: ConfigMap
59+
metadata:
60+
name: user-workload-monitoring-config
61+
namespace: openshift-user-workload-monitoring
62+
data:
63+
config.yaml: |
64+
thanosRuler:
65+
retention: 10d
66+
----
67+
68+
. Save the file to apply the changes. The pods affected by the new configuration automatically restart.

monitoring/configuring-the-monitoring-stack.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ include::modules/monitoring-setting-the-body-size-limit-for-metrics-scraping.ado
8080
include::modules/monitoring-configuring-persistent-storage.adoc[leveloffset=+1]
8181
include::modules/monitoring-configuring-a-local-persistent-volume-claim.adoc[leveloffset=+2]
8282
include::modules/monitoring-modifying-retention-time-and-size-for-prometheus-metrics-data.adoc[leveloffset=+2]
83+
include::modules/monitoring-modifying-the-retention-time-for-thanos-ruler-metrics-data.adoc[leveloffset=+2]
8384

8485
[role="_additional-resources"]
8586
.Additional resources

0 commit comments

Comments
 (0)