Answers: <p>Yes, you can use the <a href="https://prometheus.io/docs/concepts/jobs_instances/" rel="nofollow noreferrer">scrape_duration_seconds</a> metric.</p>
  <p>Then you can run queries in the Prometheus query box like:</p>
  <pre><code>scrape_duration_seconds{instance=&quot;localhost:9100&quot;, job=&quot;node&quot;}[5m]
  </code></pre>
  <p>or use Grafana.</p>
  <p>To count the (incremented) number of scrapes served by the exporter, I believe what you want is the <a href="https://prometheus.io/docs/introduction/first_steps/" rel="nofollow noreferrer">promhttp_metric_handler_requests_total</a> metric. The metric is returned multiple times along with resulting HTTP status code: 200, 500, 503, possibly others. Successful scrapes have code 200. Other status codes will typically show a count of zero.</p>
  <p>If you are only interested in counting successful scrapes, you could do something like this:</p>
  <pre><code>promhttp_metric_handler_requests_total{instance=&quot;localhost:9100&quot;, job=&quot;node&quot;, code=&quot;200&quot;}
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2021-11-10T14:14:25.350Z
Answers: 2021-11-10T14:14:25.350Z
Answers: Kate
Body: <p>I'd like to graph <em>scrape duration</em> for a particular target.</p>
  <p>The Prometheus web interface has a Status of Targets page, which tabulates the (time elapsed since) &quot;last scrape&quot; and corresponding &quot;scrape duration&quot;. Does Prometheus itself publish metrics such as scrape count and cumulative duration, or are scrape durations logged someplace else?</p>
  
Tags: <prometheus>
Title: Does Prometheus log scrape-duration?
UserDisplayName: benjimin
ThreadText: # Does Prometheus log scrape-duration?
  
  (Asked by: username_0 on 2021-11-10)
  
  I'd like to graph *scrape duration* for a particular target.
  
  The Prometheus web interface has a Status of Targets page, which tabulates the (time elapsed since) "last scrape" and corresponding "scrape duration". Does Prometheus itself publish metrics such as scrape count and cumulative duration, or are scrape durations logged someplace else?
  
  **Tags:** prometheus
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-11-10. Score: 3 | Accepted answer
  
  Yes, you can use the [scrape\_duration\_seconds](https://prometheus.io/docs/concepts/jobs_instances/) metric.
  
  Then you can run queries in the Prometheus query box like:
  
  ```
  scrape_duration_seconds{instance="localhost:9100", job="node"}[5m]
  
  ```
  
  or use Grafana.
  
  To count the (incremented) number of scrapes served by the exporter, I believe what you want is the [promhttp\_metric\_handler\_requests\_total](https://prometheus.io/docs/introduction/first_steps/) metric. The metric is returned multiple times along with resulting HTTP status code: 200, 500, 503, possibly others. Successful scrapes have code 200. Other status codes will typically show a count of zero.
  
  If you are only interested in counting successful scrapes, you could do something like this:
  
  ```
  promhttp_metric_handler_requests_total{instance="localhost:9100", job="node", code="200"}
  
  ```
  
  
  ---
  
  