-
Notifications
You must be signed in to change notification settings - Fork 111
/
metrics.go
48 lines (43 loc) · 1.47 KB
/
metrics.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
36
37
38
39
40
41
42
43
44
45
46
47
48
package write
import "github.com/prometheus/client_golang/prometheus"
type metrics struct {
sentBytes *prometheus.CounterVec
droppedBytes *prometheus.CounterVec
sentProfiles *prometheus.CounterVec
droppedProfiles *prometheus.CounterVec
retries *prometheus.CounterVec
}
func newMetrics(reg prometheus.Registerer) *metrics {
m := &metrics{
sentBytes: prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "pyroscope_write_sent_bytes_total",
Help: "Total number of compressed bytes sent to Pyroscope.",
}, []string{"endpoint"}),
droppedBytes: prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "pyroscope_write_dropped_bytes_total",
Help: "Total number of compressed bytes dropped by Pyroscope.",
}, []string{"endpoint"}),
sentProfiles: prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "pyroscope_write_sent_profiles_total",
Help: "Total number of profiles sent to Pyroscope.",
}, []string{"endpoint"}),
droppedProfiles: prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "pyroscope_write_dropped_profiles_total",
Help: "Total number of profiles dropped by Pyroscope.",
}, []string{"endpoint"}),
retries: prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "pyroscope_write_retries_total",
Help: "Total number of retries to Pyroscope.",
}, []string{"endpoint"}),
}
if reg != nil {
reg.MustRegister(
m.sentBytes,
m.droppedBytes,
m.sentProfiles,
m.droppedProfiles,
m.retries,
)
}
return m
}