nlopes / actix-web-prom

Actix-web middleware to expose Prometheus metrics
MIT License
93 stars 56 forks source link

Wrong response times #13

Closed JanPel closed 1 year ago

JanPel commented 4 years ago

Currently the timing of the reponse times seems off. I think because on line 355 and 356: fut: self.service.call(req), clock: SystemTime::now(), Is in the wrong order, so the processing of the request is started before the timer is initiated. Should be fixed by initiating the time before making the MetricsResponse object. If needed I am happy to make a pull request for this.

nlopes commented 4 years ago

A PR would be 👌

sd2k commented 4 years ago

FWIW I recently switched rocket_prometheus to use Instant::now() instead of SystemTime::now() so it might be worth making the same change here :slightly_smiling_face:

JanPel commented 4 years ago

Okay done! Also changed SystemTIme to Instant.