forked from Tinkoff/prometheus-actions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
metrics.go
45 lines (42 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
package main
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/common/version"
)
var (
cmdExecuteDuration = prometheus.NewSummaryVec(
prometheus.SummaryOpts{
Name: "prometheus_actions_command_execute_duration_seconds",
Help: "The duration of the command execution in seconds.",
},
[]string{"action"},
)
cmdExecuteErrorsCount = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "prometheus_actions_command_execute_errors_total",
Help: "The number of command execution errors.",
},
[]string{"action"},
)
promRequestDuration = prometheus.NewSummaryVec(
prometheus.SummaryOpts{
Name: "prometheus_actions_prometheus_request_duration_seconds",
Help: "The duration of Prometheus request in seconds.",
},
[]string{"action"},
)
promRequestErrorsCount = prometheus.NewCounterVec(
prometheus.CounterOpts{
Name: "prometheus_actions_prometheus_request_errors_total",
Help: "The number of Prometheus request errors.",
},
[]string{"action"},
)
)
func init() {
prometheus.MustRegister(cmdExecuteDuration)
prometheus.MustRegister(cmdExecuteErrorsCount)
prometheus.MustRegister(promRequestErrorsCount)
prometheus.MustRegister(promRequestDuration)
prometheus.MustRegister(version.NewCollector("prometheus_actions"))
}