Cleaning GitLab Prometheus data

My YunoHost server

Hardware: Hetzner VPS, 40 GB
YunoHost version:
I have access to my server : Through SSH
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

This is a continuation of my quest to increase available storage on my yunohost install. You can find part 1 at Reducing Docker directory size (spoiler: the culprit was GitLab there as well).

Description of my issue

I was taking a stroll through the output of sudo ncdu / and decided to focus my attention on /var/opt/gitlab/prometheus/data/, which was clocking at 9.3 GiB.

If I understand correctly, Prometheus being a monitoring tool, such a large size of its data dir would be either indicative of intense levels of activity, or simply of a complete lack of cleaning of obsolete history.

The size couldn’t be due to activity, given that my GitLab only has 1 user (me), there are only a few repos hosted on there, and the intervals between commits are measured in months.

In theory, GitLab’s Prometheus is set to only keep 15d of history by default. For some reason, this seems to not have been taken into account by my install (I might be wrong here, but that’s the simplest explanation I can think of, and that’s why I’m adding this to the YunoHost forum instead of some GitLab-specific resource).


GitLab provides instructions on how to configure Prometheus to one’s liking here.

There are 2 possible solutions:

  1. Depending on what you want to do, add the following config to /etc/gitlab/gitlab-persistent.rb (because gitlab.rb gets rewritten at each upgrade)
  2. Take the new config into account by running:
    sudo gitlab-ctl reconfigure

This made my /var/opt/gitlab/prometheus/data/ dir size go from 9+ GiB to 70 MiB.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.