-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
metrics.go
42 lines (40 loc) · 1.05 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
package prometheus
// Metrics prototypes
// Example:
// Counter *prometheus.CounterVec
// ResponseTime *prometheus.HistogramVec
type Metrics struct{}
// Method for creation new custom Prometheus metrics
// Example:
// pm := &Metrics{
// Counter: prometheus.NewCounterVec(
// prometheus.CounterOpts{
// Name: "servicename_requests_total",
// Help: "Description",
// ConstLabels: map[string]string{
// "version": version,
// "hash": hash,
// "buildTime": buildTime,
// },
// },
// []string{"endpoint"},
// ),
// ResponseTime: prometheus.NewHistogramVec(
// prometheus.HistogramOpts{
// Name: "servicename_response_time_seconds",
// Help: "Description",
// ConstLabels: map[string]string{
// "version": version,
// "hash": hash,
// "buildTime": buildTime,
// },
// },
// []string{"endpoint"},
// ),
// }
// prometheus.Register(pm.Counter)
// prometheus.Register(pm.ResponseTime)
func NewMetrics(version, hash, date string) *Metrics {
pm := &Metrics{}
return pm
}