Setting the storage time for metrics in Graphite

MITIGATOR stores graph data in Graphite-ClickHouse.

Fresh data is stored with a smaller sparsity, then thinned out:

Term Sparcity
Less than a day 5 seconds
day to week 10 seconds
week to month 1 minute
month to 145 days 5 minutes
Over 145 days 10 minutes

The retention times are not cumulative, i.e. data for the last day of the last week is stored at a 5 second spacing, and the next 6 days (not 7) are stored at a 10 second spacing. Unlike the standard Graphite storage,
ClickHouse continues to store the metrics with the highest sparsity given and beyond the configured time limit (with default settings after 145 days).

Parameters are set in the clickhouse-rollup-config.xml configuration file. Syntax is described in the ClickHouse Documentation.

The base version can be obtained from a running container with the command:

docker cp $(docker-compose ps -q clickhouse):/etc/clickhouse-server/config.d/clickhouse-rollup-config.xml .

The configuration change is done while the containers are stopped:

docker-compose stop graphite-clickhouse clickhouse

It is recommended to change only the mitigator section parameters.

You need to prepare and mount a new configuration file for the ClickHouse service. If files are created in /srv/mitigator, mounting is done via docker-compose.override.yml as follows:

version: "2.2"
services:
  clickhouse:
    volumes:
    - ./clickhouse-rollup-config.xml:/etc/clickhouse-server/config.d/clickhouse-rollup-config.xml:ro

Next, you need to launch Graphite with the new settings:

docker-compose up -d