-
Notifications
You must be signed in to change notification settings - Fork 0
/
instrumentation.go
130 lines (106 loc) · 4.1 KB
/
instrumentation.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package p2p
import (
"github.com/prometheus/client_golang/prometheus"
)
var (
// Connection Controller
p2pControllerNumConnections = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "dcnt_p2p_controller_connections_current",
Help: "Number of current connections",
})
p2pControllerNumMetrics = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "dcnt_p2p_controller_metrics_current",
Help: "Number of current connection metrics",
})
p2pControllerNumConnectionsByAddress = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "dcnt_p2p_controller_connectionsbyaddress_current",
Help: "Number of current connections by address",
})
SentToPeers = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "dcnt_state_number_of_peers_broadcast",
Help: "Number of Peers to which we are broadcasting messages",
})
StartingPoint = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "dcnt_StartingPoint_peers_broadcast",
Help: "Number of msgs broadcasting",
})
//
// Connection Routines
p2pProcessSendsGauge = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "dcnt_p2p_connection_process_sends_routine_gauge",
Help: "Number of current processSend routines",
})
p2pProcessReceivesGauge = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "dcnt_p2p_connection_process_receives_routine_gauge",
Help: "Number of current processReceive routines",
})
p2pConnectionsRunLoop = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "dcnt_p2p_connection_runloop_routine_gauge",
Help: "The number of connections in runloop",
})
p2pConnectionDialLoop = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "dcnt_p2p_connection_dialloop_routine_gauge",
Help: "The number of connections in dialloop",
})
//
// Runloops
p2pConnectionRunLoopInitialized = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "dcnt_p2p_connection_runloop_initialized_counter",
Help: "Numer of runloops that hit initialized",
})
p2pConnectionRunLoopOnline = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "dcnt_p2p_connection_runloop_online_counter",
Help: "Numer of runloops that hit online",
})
p2pConnectionRunLoopOffline = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "dcnt_p2p_connection_runloop_offline_counter",
Help: "Numer of runloops that hit offline",
})
p2pConnectionRunLoopShutdown = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "dcnt_p2p_connection_runloop_shutdown_counter",
Help: "Numer of runloops that hit shutdown",
})
//
// Connections
p2pConnectionCommonInit = prometheus.NewCounter(prometheus.CounterOpts{
Name: "dcnt_p2p_connection_commonInit_calls_total",
Help: "Number of times the commonInit() is called",
})
p2pConnectionOnlineCall = prometheus.NewCounter(prometheus.CounterOpts{
Name: "dcnt_p2p_goOnline_total",
Help: "Number of times we call goOnline()",
})
p2pConnectionOfflineCall = prometheus.NewCounter(prometheus.CounterOpts{
Name: "dcnt_p2p_goOffline_total",
Help: "Number of times we call goOffline()",
})
)
var registered = false
// RegisterPrometheus registers the variables to be exposed. This can only be run once, hence the
// boolean flag to prevent panics if launched more than once. This is called in NetStart
func RegisterPrometheus() {
if registered {
return
}
registered = true
// Controller
prometheus.MustRegister(p2pControllerNumConnections)
prometheus.MustRegister(p2pControllerNumMetrics)
prometheus.MustRegister(p2pControllerNumConnectionsByAddress)
prometheus.MustRegister(SentToPeers)
prometheus.MustRegister(StartingPoint)
// Connection Routines
prometheus.MustRegister(p2pProcessSendsGauge) // processSends
prometheus.MustRegister(p2pProcessReceivesGauge) // processReceives
prometheus.MustRegister(p2pConnectionsRunLoop)
prometheus.MustRegister(p2pConnectionDialLoop)
prometheus.MustRegister(p2pConnectionOnlineCall)
prometheus.MustRegister(p2pConnectionOfflineCall)
// RunLoop
prometheus.MustRegister(p2pConnectionRunLoopInitialized)
prometheus.MustRegister(p2pConnectionRunLoopOnline)
prometheus.MustRegister(p2pConnectionRunLoopOffline)
prometheus.MustRegister(p2pConnectionRunLoopShutdown)
// Connections
prometheus.MustRegister(p2pConnectionCommonInit)
}