forked from Restream/reindexer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
prometheus.go
35 lines (29 loc) · 872 Bytes
/
prometheus.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package reindexer
import (
"net/url"
"time"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
var (
promStatsClientCallsLatency = promauto.NewSummaryVec(
prometheus.SummaryOpts{
Namespace: "reindexer",
Subsystem: "client",
Name: "calls_latency_seconds",
Help: "Latency of Reindexer Client calls",
Objectives: map[float64]float64{0.5: 0.05, 0.9: 0.01, 0.99: 0.001},
MaxAge: 3 * time.Minute,
AgeBuckets: 3,
},
[]string{"dsn", "cmd", "ns"},
)
)
type reindexerPrometheusMetrics struct {
clientCallsLatency prometheus.ObserverVec
}
func newPrometheusMetrics(dsnParsed []url.URL) *reindexerPrometheusMetrics {
return &reindexerPrometheusMetrics{
clientCallsLatency: promStatsClientCallsLatency.MustCurryWith(prometheus.Labels{"dsn": dsnString(dsnParsed)}),
}
}