0

We've installed prometheus plugin in our jenkins instance and the metrics are available in https://jenkins-url/prometheus endpoint. However the data available is only 2 days old. I'd like to know if there's a way to increase this data retention.

Jenkins Prometheus Plugin Configuration org.jenkinsci.plugins.prometheus.config.PrometheusConfiguration.xml:

<?xml version='1.1' encoding='UTF-8'?>
<org.jenkinsci.plugins.prometheus.config.PrometheusConfiguration plugin="prometheus@2.0.10">
  <urlName>prometheus</urlName>
  <additionalPath></additionalPath>
  <defaultNamespace>default</defaultNamespace>
  <jobAttributeName>jenkins_job</jobAttributeName>
  <useAuthenticatedEndpoint>true</useAuthenticatedEndpoint>
  <collectingMetricsPeriodInSeconds>120</collectingMetricsPeriodInSeconds>
  <countSuccessfulBuilds>true</countSuccessfulBuilds>
  <countUnstableBuilds>true</countUnstableBuilds>
  <countFailedBuilds>true</countFailedBuilds>
  <countNotBuiltBuilds>true</countNotBuiltBuilds>
  <countAbortedBuilds>true</countAbortedBuilds>
  <fetchTestResults>true</fetchTestResults>
  <processingDisabledBuilds>false</processingDisabledBuilds>
  <appendParamLabel>false</appendParamLabel>
  <appendStatusLabel>false</appendStatusLabel>
  <labeledBuildParameterNames></labeledBuildParameterNames>
  <collectDiskUsage>true</collectDiskUsage>
</org.jenkinsci.plugins.prometheus.config.PrometheusConfiguration>

[Jenkins executor Panel]

I tried exploring the prometheus plugin source code in Github. Searched for keywords like retention, storage but couldn't find anything. PrometheusConfiguration-JavaDoc

Dávid Pásztor
  • 51,403
  • 9
  • 85
  • 116
vijay v
  • 1,888
  • 1
  • 12
  • 19

1 Answers1

1

That's not how it all works: Prometheus plugin just exposes metrics (their current state), it doesn't store anything.

Data is stored by Prometheus. You can see information on how to change retention policy of Prometheus in this answer.

markalex
  • 8,623
  • 2
  • 7
  • 32
  • Ok. I've a stupid question. If it doesn't store anything, how does it exposes 2 days data alone? – vijay v Mar 31 '23 at 14:40
  • @vijayv, it means that prometheus collected data from jenkins for this 2 past days. Could it be that you installed plugin on 28.03 near 17 o'clock? If it's the case - than you don't need to change any settings, and just wait when Prometheus scrape more data. – markalex Mar 31 '23 at 14:45
  • We've this plugin installed for almost a year now. But only last month we setup this executor dashboard in grafana. Everytime we load, we only see 2 days data here. – vijay v Mar 31 '23 at 15:19
  • Then look into your Prometheus. Copy query from your panel, go to Prometheus (something like `http://prometheus.company.local:9090/graph`), insert query and switch to Graph. You'll see how long into past prometheus have data. Also check status > command line flag there: you'll see retention policy. Investigate from there. – markalex Mar 31 '23 at 15:28
  • Thanks Mark. Looks like the retention size we had for prometheus was less for the amount of data we ingest. It's not an issue with jenkins prometheus plugin. – vijay v Apr 04 '23 at 15:17