-
Notifications
You must be signed in to change notification settings - Fork 13
/
telemetry.go
42 lines (36 loc) · 1004 Bytes
/
telemetry.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 main
import "github.com/prometheus/client_golang/prometheus"
var (
udpPacketCount = prometheus.NewCounter(
prometheus.CounterOpts{
Name: "pushprom_udp_packets_total",
Help: "The number of packets received.",
},
)
httpRequestCount = prometheus.NewCounter(
prometheus.CounterOpts{
Name: "pushprom_http_requests_total",
Help: "The number of http requests received.",
},
)
httpRequestsTotal = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "requests_total",
Help: "A counter for requests to the wrapped handler.",
},
[]string{"code", "method"},
)
httpRequestDuration = prometheus.NewHistogramVec(
prometheus.HistogramOpts{
Name: "request_duration_seconds",
Help: "A histogram of latencies for requests.",
},
[]string{"handler", "method"},
)
)
func init() {
prometheus.MustRegister(udpPacketCount)
prometheus.MustRegister(httpRequestCount)
prometheus.MustRegister(httpRequestsTotal)
prometheus.MustRegister(httpRequestDuration)
}