forked from grafana/grafana
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathremote_writer.go
30 lines (27 loc) · 933 Bytes
/
remote_writer.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
package metrics
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
type RemoteWriter struct {
WritesTotal *prometheus.CounterVec
WriteDuration *prometheus.HistogramVec
}
func NewRemoteWriterMetrics(r prometheus.Registerer) *RemoteWriter {
return &RemoteWriter{
WritesTotal: promauto.With(r).NewCounterVec(prometheus.CounterOpts{
Namespace: Namespace,
Subsystem: Subsystem,
Name: "remote_writer_writes_total",
Help: "The total number of remote writes attempted.",
}, []string{"org", "backend", "status_code"}),
WriteDuration: promauto.With(r).NewHistogramVec(
prometheus.HistogramOpts{
Namespace: Namespace,
Subsystem: Subsystem,
Name: "remote_writer_write_duration_seconds",
Help: "Histogram of remote write durations.",
Buckets: prometheus.DefBuckets,
}, []string{"org", "backend"}),
}
}