Skip to content
This repository was archived by the owner on Aug 4, 2021. It is now read-only.

Http Request Duration Histogram should be in seconds unit #106

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cmd/prometheus-postgresql-adapter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ var (
)
httpRequestDuration = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Name: "http_request_duration_ms",
Help: "Duration of HTTP request in milliseconds",
Name: "http_request_duration_seconds",
Help: "Duration of HTTP request in seconds",
Buckets: prometheus.DefBuckets,
},
[]string{"path"},
Expand Down Expand Up @@ -396,8 +396,8 @@ func timeHandler(path string, handler http.Handler) http.Handler {
f := func(w http.ResponseWriter, r *http.Request) {
start := time.Now()
handler.ServeHTTP(w, r)
elapsedMs := time.Since(start).Nanoseconds() / int64(time.Millisecond)
httpRequestDuration.WithLabelValues(path).Observe(float64(elapsedMs))
elapsedSec := time.Since(start).Nanoseconds() / int64(time.Second)
httpRequestDuration.WithLabelValues(path).Observe(float64(elapsedSec))
}
return http.HandlerFunc(f)
}