forked from xmidt-org/scytale
-
Notifications
You must be signed in to change notification settings - Fork 0
/
metrics.go
53 lines (44 loc) · 1.27 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
package main
import (
"github.com/go-kit/kit/metrics"
"github.com/xmidt-org/webpa-common/xmetrics"
)
//Names for our metrics
const (
ReceivedWRPMessageCount = "received_wrp_message_total"
)
// labels
const (
ClientIDLabel = "clientid"
OutcomeLabel = "outcome"
ReasonLabel = "reason"
)
// label values
const (
Accepted = "accepted"
Rejected = "rejected"
TokenMissing = "token_not_found"
TokenTypeMismatch = "token_type_mismatch"
WRPPIDMissing = "wrp_pid_missing"
WRPPIDMismatch = "wrp_pid_mismatch"
WRPPIDMatch = "wrp_pid_match"
JWTPIDMissing = "jwt_pid_missing"
JWTPIDWildcard = "jwt_pid_wildcard"
JWTPIDInvalid = "jwt_pid_invalid"
)
//Metrics returns the metrics relevant to this package
func Metrics() []xmetrics.Metric {
return []xmetrics.Metric{
xmetrics.Metric{
Name: ReceivedWRPMessageCount,
Type: xmetrics.CounterType,
Help: "Number of WRP Messages successfully decoded and ready for fanout.",
LabelNames: []string{OutcomeLabel, ClientIDLabel, ReasonLabel},
},
}
}
//NewReceivedWRPCounter initializes a counter to keep track of
//scytale users which do not populate the partnerIDs field in their WRP messages
func NewReceivedWRPCounter(r xmetrics.Registry) metrics.Counter {
return r.NewCounter(ReceivedWRPMessageCount)
}