Answers: <p>You can define a different <code>scrape_interval</code> in the <a href="https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config" rel="nofollow noreferrer">scrape config</a> of two different jobs: a job for <em>slow</em> polling and one for <em>fast</em> polling.</p>
  <p>If your metrics are on different endpoints you can simply adjust which endpoint should be scraped more frequently than the other.</p>
  <p>If your metrics are on the same endpoint, you can define the same endpoint in both job and use the <a href="https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config" rel="nofollow noreferrer">metric_relabel_configs</a> of your target to adapt the metrics you want to ingest:</p>
  <p>On the <em>fast</em> job, keep only the metrics you want to keep</p>
  <pre><code>metric_relabel_configs:
  - source_labels: [__name__]
    regex: go_gc_duration_seconds_sum
    action: keep
  </code></pre>
  <p>If the duplication of metrics between the jobs is an issue, you can drop them in the <em>slow job</em>:</p>
  <pre><code>metric_relabel_configs:
  - source_labels: [__name__]
    regex: go_gc_duration_seconds_sum
    action: drop
  </code></pre>
  <p>And optionally rename the job label in the <em>fast</em> job to match the <em>slow</em> job (exercise left to the reader).</p>
  
Answers: CC BY-SA 4.0
Answers: 2021-11-01T09:19:14.497Z
Answers: 2021-11-01T09:19:14.497Z
Answers: Michael Doubez
Body: <p>I am running a Tendermint network. I am using Prometheus to track various metrics, and to track node health. For performance metrics such as <code>tendermint_consensus_total_txs</code>, I want updates every second. For health metrics such as <code>go_gc_duration_seconds_sum</code>, I only want updates every minute.</p>
  <p>How can I configure Prometheus to scrape metric A every second and metric B every minute? Or alternatively how can I configure it to only keep every 60th sample of metric B?</p>
  <p>Frequently updating performance metrics is important for business reasons, but I need to avoid ballooning my storage costs by storing lots of samples for metrics I don't need that frequently.</p>
  
Tags: <prometheus>
Title: Scraping different Prometheus metrics at different rates
UserDisplayName: Ethan Reesor
ThreadText: # Scraping different Prometheus metrics at different rates
  
  (Asked by: username_0 on 2021-10-28)
  
  I am running a Tendermint network. I am using Prometheus to track various metrics, and to track node health. For performance metrics such as `tendermint_consensus_total_txs`, I want updates every second. For health metrics such as `go_gc_duration_seconds_sum`, I only want updates every minute.
  
  How can I configure Prometheus to scrape metric A every second and metric B every minute? Or alternatively how can I configure it to only keep every 60th sample of metric B?
  
  Frequently updating performance metrics is important for business reasons, but I need to avoid ballooning my storage costs by storing lots of samples for metrics I don't need that frequently.
  
  **Tags:** prometheus
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-11-01. Score: 2 | Accepted answer
  
  You can define a different `scrape_interval` in the [scrape config](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config) of two different jobs: a job for *slow* polling and one for *fast* polling.
  
  If your metrics are on different endpoints you can simply adjust which endpoint should be scraped more frequently than the other.
  
  If your metrics are on the same endpoint, you can define the same endpoint in both job and use the [metric\_relabel\_configs](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config) of your target to adapt the metrics you want to ingest:
  
  On the *fast* job, keep only the metrics you want to keep
  
  ```
  metric_relabel_configs:
  - source_labels: [__name__]
    regex: go_gc_duration_seconds_sum
    action: keep
  
  ```
  
  If the duplication of metrics between the jobs is an issue, you can drop them in the *slow job*:
  
  ```
  metric_relabel_configs:
  - source_labels: [__name__]
    regex: go_gc_duration_seconds_sum
    action: drop
  
  ```
  
  And optionally rename the job label in the *fast* job to match the *slow* job (exercise left to the reader).
  
  
  ---
  
  