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="[email protected]">
<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>
[]
I tried exploring the prometheus plugin source code in Github. Searched for keywords like retention, storage but couldn't find anything. PrometheusConfiguration-JavaDoc
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.