-
Notifications
You must be signed in to change notification settings - Fork 0
/
prom.go
48 lines (42 loc) · 1.18 KB
/
prom.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 metrics
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
func NewCounterWithLabel(name string, help string, label []string) (m *prometheus.CounterVec) {
return promauto.NewCounterVec(
prometheus.CounterOpts{
Name: name,
Help: help,
}, label)
}
func NewCounter(name string, help string) (m prometheus.Counter) {
return promauto.NewCounter(
prometheus.CounterOpts{
Name: name,
Help: help,
})
}
func NewGaugeWithLabel(name string, help string, label []string) (m *prometheus.GaugeVec) {
return promauto.NewGaugeVec(
prometheus.GaugeOpts{
Name: name,
Help: help,
}, label)
}
func NewHistogramWithLabel(name string, help string, buckets []float64, label []string) (m *prometheus.HistogramVec) {
return promauto.NewHistogramVec(
prometheus.HistogramOpts{
Name: name,
Help: help,
Buckets: buckets,
}, label)
}
func NewSummaryWithLabel(name string, help string, objectives map[float64]float64, label []string) (m *prometheus.SummaryVec) {
return promauto.NewSummaryVec(
prometheus.SummaryOpts{
Name: name,
Help: help,
Objectives: objectives,
}, label)
}