-
Notifications
You must be signed in to change notification settings - Fork 31
/
stats.go
56 lines (46 loc) · 1.82 KB
/
stats.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
// Copyright (c) 2018-2021, R.I. Pienaar and the Choria Project contributors
//
// SPDX-License-Identifier: Apache-2.0
package server
import (
"github.com/prometheus/client_golang/prometheus"
)
var (
totalCtr = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "choria_server_total",
Help: "Total number of messages received from the network",
}, []string{"identity"})
validatedCtr = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "choria_server_validated",
Help: "Number of messages that were received and validated successfully",
}, []string{"identity"})
unvalidatedCtr = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "choria_server_unvalidated",
Help: "Number of messages that were received but did not pass validation",
}, []string{"identity"})
passedCtr = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "choria_server_passed",
Help: "Number of messages where this instance matched the filter expression",
}, []string{"identity"})
filteredCtr = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "choria_server_filtered",
Help: "Number of messages where this instance did not match the filter expression",
}, []string{"identity"})
repliesCtr = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "choria_server_replies",
Help: "Number of reply messages that were produced",
}, []string{"identity"})
ttlExpiredCtr = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "choria_server_ttlexpired",
Help: "Number of messages received that were too old and dropped",
}, []string{"identity"})
)
func init() {
prometheus.MustRegister(validatedCtr)
prometheus.MustRegister(unvalidatedCtr)
prometheus.MustRegister(passedCtr)
prometheus.MustRegister(filteredCtr)
prometheus.MustRegister(repliesCtr)
prometheus.MustRegister(ttlExpiredCtr)
prometheus.MustRegister(totalCtr)
}