-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmetrics.go
42 lines (36 loc) · 904 Bytes
/
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 main
import (
"github.com/prometheus/client_golang/prometheus"
)
var (
bytesTx = prometheus.NewCounter(
prometheus.CounterOpts{
Namespace: "go_websockify",
Name: "websocket_bytes_tx_total",
},
)
bytesRx = prometheus.NewCounter(
prometheus.CounterOpts{
Namespace: "go_websockify",
Name: "websocket_bytes_rx_total",
},
)
wsConnCounter = prometheus.NewGauge(
prometheus.GaugeOpts{
Namespace: "go_websockify",
Name: "websocket_connections_active",
Help: "Active WebSocket connections",
})
tcpConnCounter = prometheus.NewGauge(
prometheus.GaugeOpts{
Namespace: "go_websockify",
Name: "tcp_connections_active",
Help: "Active TCP connections",
})
)
func init() {
prometheus.MustRegister(bytesTx)
prometheus.MustRegister(bytesRx)
prometheus.MustRegister(wsConnCounter)
prometheus.MustRegister(tcpConnCounter)
}