-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
metrics.go
108 lines (100 loc) · 3.64 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
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
package prommetrics
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
)
// Namespaces
const (
NamespaceAutomationLogTrigger = "automation_log_trigger"
NamespaceAutomationStreams = "automation_streams"
)
// Streams steps
const (
StreamsLookupStepDoMercuryRequest = "do_mercury_request"
StreamsLookupStepCheckErrorHandler = "check_error_handler"
StreamsLookupStepCheckCallback = "check_callback"
)
// Streams error labels
const (
StreamsLookupErrorReasonNotReverted = "reason_not_target_check_reverted"
StreamsLookupErrorDecodeRequestFailed = "decode_request_failed"
StreamsLookupErrorCredentialsNotConfigured = "credentials_not_configured"
StreamsLookupErrorDoMercuryRequest = "do_mercury_request"
StreamsLookupErrorCodeNotNil = "err_code_not_nil"
StreamsLookupErrorCheckCallback = "check_callback"
StreamsLookupErrorPackUserCheckErrorHandler = "pack_user_check_error_handler"
StreamsLookupErrorPackExecuteCallback = "pack_execute_callback"
)
// Streams versions
const (
StreamsVersion02 = "v02"
StreamsVersion03 = "v03"
)
// Metric labels
const (
LogBufferFlowDirectionIngress = "ingress"
LogBufferFlowDirectionEgress = "egress"
LogBufferFlowDirectionDropped = "dropped"
LogBufferFlowDirectionExpired = "expired"
)
// Automation metrics
var (
// Log Trigger metrics
AutomationLogBufferFlow = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: NamespaceAutomationLogTrigger,
Name: "num_logs_in_log_buffer",
Help: "The total number of logs currently being stored in the log buffer",
}, []string{
"direction",
})
AutomationRecovererMissedLogs = promauto.NewCounter(prometheus.CounterOpts{
Namespace: NamespaceAutomationLogTrigger,
Name: "num_recoverer_missed_logs",
Help: "How many valid log triggers were identified as being missed by the recoverer",
})
AutomationRecovererPendingPayloads = promauto.NewGauge(prometheus.GaugeOpts{
Namespace: NamespaceAutomationLogTrigger,
Name: "num_recoverer_pending_payloads",
Help: "How many log trigger payloads are currently pending in the recoverer",
})
AutomationActiveUpkeeps = promauto.NewGauge(prometheus.GaugeOpts{
Namespace: NamespaceAutomationLogTrigger,
Name: "num_active_upkeeps",
Help: "How many log trigger upkeeps are currently active",
})
AutomationLogProviderLatestBlock = promauto.NewGauge(prometheus.GaugeOpts{
Namespace: NamespaceAutomationLogTrigger,
Name: "log_provider_latest_block",
Help: "The latest block number the log provider has seen",
})
// Streams metrics
AutomationStreamsLookupStep = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: NamespaceAutomationStreams,
Name: "streams_lookup_step_count",
Help: "How many times individual steps of the streams lookup process run",
}, []string{
"step",
})
AutomationStreamsLookupError = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: NamespaceAutomationStreams,
Name: "streams_lookup_error_count",
Help: "Errors occurred during a streams lookup attempt",
}, []string{
"error",
})
AutomationStreamsRetries = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: NamespaceAutomationStreams,
Name: "streams_retries",
Help: "Count of the times a streams lookup was retried",
}, []string{
"version",
})
AutomationStreamsResponses = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: NamespaceAutomationStreams,
Name: "streams_responses",
Help: "Count of individual response codes from streams lookup",
}, []string{
"version",
"status",
})
)