|
|
@@ -13,11 +13,13 @@ import (
|
|
13
|
13
|
)
|
|
14
|
14
|
|
|
15
|
15
|
type statsPrometheus struct {
|
|
16
|
|
- connections *prometheus.GaugeVec
|
|
17
|
|
- telegramConnections *prometheus.GaugeVec
|
|
18
|
|
- traffic *prometheus.GaugeVec
|
|
19
|
|
- crashes prometheus.Counter
|
|
20
|
|
- replayAttacks prometheus.Counter
|
|
|
16
|
+ connections *prometheus.GaugeVec
|
|
|
17
|
+ telegramConnections *prometheus.GaugeVec
|
|
|
18
|
+ traffic *prometheus.GaugeVec
|
|
|
19
|
+ crashes prometheus.Counter
|
|
|
20
|
+ replayAttacks prometheus.Counter
|
|
|
21
|
+ authenticationFailed prometheus.Counter
|
|
|
22
|
+ cloakedRequests prometheus.Counter
|
|
21
|
23
|
}
|
|
22
|
24
|
|
|
23
|
25
|
func (s *statsPrometheus) IngressTraffic(traffic int) {
|
|
|
@@ -87,6 +89,14 @@ func (s *statsPrometheus) ReplayDetected() {
|
|
87
|
89
|
s.replayAttacks.Inc()
|
|
88
|
90
|
}
|
|
89
|
91
|
|
|
|
92
|
+func (s *statsPrometheus) AuthenticationFailed() {
|
|
|
93
|
+ s.authenticationFailed.Inc()
|
|
|
94
|
+}
|
|
|
95
|
+
|
|
|
96
|
+func (s *statsPrometheus) CloakedRequest() {
|
|
|
97
|
+ s.cloakedRequests.Inc()
|
|
|
98
|
+}
|
|
|
99
|
+
|
|
90
|
100
|
func newStatsPrometheus(mux *http.ServeMux) Interface {
|
|
91
|
101
|
registry := prometheus.NewPedanticRegistry()
|
|
92
|
102
|
|
|
|
@@ -116,6 +126,16 @@ func newStatsPrometheus(mux *http.ServeMux) Interface {
|
|
116
|
126
|
Name: "replay_attacks",
|
|
117
|
127
|
Help: "How many replay attacks were prevented.",
|
|
118
|
128
|
}),
|
|
|
129
|
+ authenticationFailed: prometheus.NewCounter(prometheus.CounterOpts{
|
|
|
130
|
+ Namespace: config.C.StatsNamespace,
|
|
|
131
|
+ Name: "authentication_failed",
|
|
|
132
|
+ Help: "How many authentication failed events we've seen.",
|
|
|
133
|
+ }),
|
|
|
134
|
+ cloakedRequests: prometheus.NewCounter(prometheus.CounterOpts{
|
|
|
135
|
+ Namespace: config.C.StatsNamespace,
|
|
|
136
|
+ Name: "cloaked_requests",
|
|
|
137
|
+ Help: "How many requests were proxified during cloaking.",
|
|
|
138
|
+ }),
|
|
119
|
139
|
}
|
|
120
|
140
|
|
|
121
|
141
|
registry.MustRegister(instance.connections)
|
|
|
@@ -123,6 +143,8 @@ func newStatsPrometheus(mux *http.ServeMux) Interface {
|
|
123
|
143
|
registry.MustRegister(instance.traffic)
|
|
124
|
144
|
registry.MustRegister(instance.crashes)
|
|
125
|
145
|
registry.MustRegister(instance.replayAttacks)
|
|
|
146
|
+ registry.MustRegister(instance.authenticationFailed)
|
|
|
147
|
+ registry.MustRegister(instance.cloakedRequests)
|
|
126
|
148
|
|
|
127
|
149
|
handler := promhttp.HandlerFor(registry, promhttp.HandlerOpts{})
|
|
128
|
150
|
mux.Handle("/", handler)
|