You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
386 B
14 lines
386 B
9 years ago
|
package utils
|
||
|
|
||
|
import (
|
||
|
"time"
|
||
|
|
||
|
"github.com/prometheus/client_golang/prometheus"
|
||
|
)
|
||
|
|
||
|
// PrometheusObserveTimeMilliseconds observes the elapsed time since start, in milliseconds,
|
||
|
// on the specified Prometheus Histogram.
|
||
|
func PrometheusObserveTimeMilliseconds(h prometheus.Histogram, start time.Time) {
|
||
|
h.Observe(float64(time.Since(start).Nanoseconds()) / float64(time.Millisecond))
|
||
|
}
|