Metrics Retention Configuration
Guide to modifying the default 30-day metrics data retention period by editing the PROMETHEUS_RETENTION_TIME environment variable and restarting services.
Last updated
Was this helpful?
Guide to modifying the default 30-day metrics data retention period by editing the PROMETHEUS_RETENTION_TIME environment variable and restarting services.
By default, MariaDB Enterprise Manager retains detailed metrics for 30 days. You can configure this data retention period to balance your need for historical data with storage costs.
This guide explains how to change the retention period and how the underlying storage system works.
Changing the retention time is done by editing the environment file for Enterprise Manager and then restarting the services.
Locate and edit the .env file
Navigate to your Enterprise Manager installation directory and open the .env file in a text editor.
cd enterprise-manager/
vim .envModify the retention time variable
Find the line containing PROMETHEUS_RETENTION_TIME and change its value. The change will only take effect after the Prometheus service is restarted.
Examples:
PROMETHEUS_RETENTION_TIME=90dPROMETHEUS_RETENTION_TIME=52wChanges to PROMETHEUS_RETENTION_TIME take effect only after the Prometheus service is restarted.
Restart services to apply the change
You must restart the services for the new retention period to be applied.
docker compose up -dPrometheus, the time-series database used by Enterprise Manager, does not delete expired data instantly.
Block-Based Storage: Prometheus stores metrics data in blocks, which are typically two-hour chunks of time. In the background, these small blocks are compacted into larger ones.
Delayed Cleanup: Data is not deleted on a sample-by-sample basis. Instead, Prometheus removes an entire block once all the data within it has passed the retention period. This cleanup process runs in the background and may not be immediate.
Delayed metrics removal for deleted databases
After you delete a database from MariaDB Enterprise Manager, you may continue to see its historical metrics in Grafana dashboards for a period of time.
This is expected behavior. Enterprise Manager does not immediately delete a database's metric history from Prometheus. Instead, the data is removed automatically by Prometheus's own cleanup process once it passes the configured retention period.
These old metrics will no longer receive new data and will eventually disappear from the dashboards on their own.
When setting PROMETHEUS_RETENTION_TIME, you can use the following units:
y - years
w - weeks
d - days
h - hours
m - minutes
s - seconds
This page is: Copyright © 2025 MariaDB. All rights reserved.
Last updated
Was this helpful?
Was this helpful?

