amppackager icon indicating copy to clipboard operation
amppackager copied to clipboard

Testing non-deterministic Prometheus metrics e.g. latency?

Open MichaelRybak opened this issue 4 years ago • 0 comments

TL;DR: I'm unit-testing Prometheus metrics: server's requests count and latencies. The server is written in Go. Latencies are non-determinstic and there seems to be no good way to fake clock in Prometheus or Go. Does Prometheus provide a method similar to CollectAndCompare that lets validating a value (e.g. latency) against a range, not exact expectation? If not, would it be a good feature to add to Prometheus? Alternatively, is there a way to fake clock in Prometheus, so e.g. InstrumentHandlerDuration would propagate the pre-defined fake duration? Or, is there a good way to fake clock in Go?

  • Research existing options
  • Possibly propose new features to Prometheus

https://groups.google.com/g/prometheus-developers/c/do7t-vmktk0

MichaelRybak avatar Jun 08 '20 17:06 MichaelRybak