Metrics Retention Configuration

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.

How to Change the Retention Period

Changing the retention time is done by editing the environment file for Enterprise Manager and then restarting the services.

1

Locate and edit the .env file

Navigate to your Enterprise Manager installation directory and open the .env file in a text editor.

# .env location
cd enterprise-manager/
vim .env
2

Modify 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:

# Set retention to 90 days
PROMETHEUS_RETENTION_TIME=90d
# Set retention to 52 weeks (one year)
PROMETHEUS_RETENTION_TIME=52w

Changes to PROMETHEUS_RETENTION_TIME take effect only after the Prometheus service is restarted.

3

Restart services to apply the change

You must restart the services for the new retention period to be applied.

# Restart services
docker compose up -d

Data Retention Policy

Prometheus, 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.

Valid Retention Time Units

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?