gebn / bmc_exporter

Exposes Baseboard Management Controller data in Prometheus format.
GNU Lesser General Public License v3.0
45 stars 3 forks source link

Add time to collect metric #26

Closed gebn closed 4 years ago

gebn commented 5 years ago

It would be interesting, especially in the case of multiple scrapers, to expose the time between the request coming in and Collect() beginning. This might be difficult for the same reason as #13.

gebn commented 5 years ago

Note that bmc_scrape_duration_seconds is only the duration of the Collect() method - the request may have to wait for a substantial period of time to get to there, especially if another request for the same target just beat it, and the session had timed out and needed re-establishing.

gebn commented 4 years ago

This could be done by adding a time.Time parameter to Target's ServeHTTP() (it doesn't need to implement http.Handler), however that's messy.

What we actually care about here is time spent waiting for the event loop to get to us, which we can do entirely within Target. Can pass the start time.Time in scrapeReqOpts, then observe a histogram value for that case in the event loop. Will be fairly coarse (near-instant to 30s or so), but will provide the desired information.