如何增加Jenkins Prometheus插件的数据保留时间?

huangapple go评论63阅读模式
英文:

How to increase jenkins prometheus plugin data retention?

问题

我们在Jenkins实例中安装了Prometheus插件,指标可在https://jenkins-url/prometheus端点中找到。但是可用数据仅为2天前。我想知道是否有方法增加此数据保留。

Jenkins Prometheus插件配置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 Prometheus插件的数据保留时间?]

我尝试在Github中探索Prometheus插件源代码。搜索了关键词如retention、storage,但未找到相关内容。
PrometheusConfiguration-JavaDoc

英文:

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:

&lt;?xml version=&#39;1.1&#39; encoding=&#39;UTF-8&#39;?&gt;
&lt;org.jenkinsci.plugins.prometheus.config.PrometheusConfiguration plugin=&quot;prometheus@2.0.10&quot;&gt;
  &lt;urlName&gt;prometheus&lt;/urlName&gt;
  &lt;additionalPath&gt;&lt;/additionalPath&gt;
  &lt;defaultNamespace&gt;default&lt;/defaultNamespace&gt;
  &lt;jobAttributeName&gt;jenkins_job&lt;/jobAttributeName&gt;
  &lt;useAuthenticatedEndpoint&gt;true&lt;/useAuthenticatedEndpoint&gt;
  &lt;collectingMetricsPeriodInSeconds&gt;120&lt;/collectingMetricsPeriodInSeconds&gt;
  &lt;countSuccessfulBuilds&gt;true&lt;/countSuccessfulBuilds&gt;
  &lt;countUnstableBuilds&gt;true&lt;/countUnstableBuilds&gt;
  &lt;countFailedBuilds&gt;true&lt;/countFailedBuilds&gt;
  &lt;countNotBuiltBuilds&gt;true&lt;/countNotBuiltBuilds&gt;
  &lt;countAbortedBuilds&gt;true&lt;/countAbortedBuilds&gt;
  &lt;fetchTestResults&gt;true&lt;/fetchTestResults&gt;
  &lt;processingDisabledBuilds&gt;false&lt;/processingDisabledBuilds&gt;
  &lt;appendParamLabel&gt;false&lt;/appendParamLabel&gt;
  &lt;appendStatusLabel&gt;false&lt;/appendStatusLabel&gt;
  &lt;labeledBuildParameterNames&gt;&lt;/labeledBuildParameterNames&gt;
  &lt;collectDiskUsage&gt;true&lt;/collectDiskUsage&gt;
&lt;/org.jenkinsci.plugins.prometheus.config.PrometheusConfiguration&gt;

[如何增加Jenkins Prometheus插件的数据保留时间?]

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

答案1

得分: 1

那不是所有操作的方式:Prometheus插件只是暴露指标(它们的当前状态),它不存储任何数据。

数据是由Prometheus存储的。您可以查看有关如何更改Prometheus保留策略的信息 这个答案

英文:

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.

huangapple
  • 本文由 发表于 2023年3月31日 22:02:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/75899431.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定