-
Notifications
You must be signed in to change notification settings - Fork 0
/
metrics.go
76 lines (69 loc) · 2.7 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
package recursor
import (
"github.com/coredns/coredns/plugin"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"sync"
)
var promBuildInfo = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: plugin.Namespace,
Subsystem: pluginName,
Name: "build_info",
Help: "Plugin build info",
}, []string{"version"})
var promResolvesInfo = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: plugin.Namespace,
Subsystem: pluginName,
Name: "resolvers_info",
Help: "Resolves info",
}, []string{"port", "zone", "resolver", "urls"})
var promAliasesInfo = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: plugin.Namespace,
Subsystem: pluginName,
Name: "aliases_info",
Help: "Aliases info",
}, []string{"port", "zone", "alias", "resolver", "ttl"})
var promAliasesEntriesInfo = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: plugin.Namespace,
Subsystem: pluginName,
Name: "aliases_entries_info",
Help: "Aliases entries info",
}, []string{"port", "zone", "alias", "resolver", "type", "entry"})
var promQueryServedCountTotal = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: plugin.Namespace,
Subsystem: pluginName,
Name: "query_served_count_total",
Help: "Total count of served queries",
}, []string{"port", "zone", "alias", "resolver", "client_ip"})
var promQueryOmittedCountTotal = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: plugin.Namespace,
Subsystem: pluginName,
Name: "query_omitted_count_total",
Help: "Total count of omitted queries",
}, []string{"port", "zone", "alias", "reason", "client_ip"})
var commonLabels = []string{"port", "zone", "alias", "resolver", "host", "result"}
var promResolveCountTotal = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: plugin.Namespace,
Subsystem: pluginName,
Name: "resolve_count_total",
Help: "Total count of resolve operations",
}, commonLabels)
var promResolveDurationMs = promauto.NewGaugeVec(prometheus.GaugeOpts{
Namespace: plugin.Namespace,
Subsystem: pluginName,
Name: "resolve_duration_ms",
Help: "Duration of resolve operation in milliseconds",
}, commonLabels)
var promResolveDurationMsTotal = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: plugin.Namespace,
Subsystem: pluginName,
Name: "resolve_duration_ms_total",
Help: "Total duration of resolve operations in milliseconds",
}, commonLabels)
var promResolveIpCountTotal = promauto.NewCounterVec(prometheus.CounterOpts{
Namespace: plugin.Namespace,
Subsystem: pluginName,
Name: "resolve_ip_count_total",
Help: "Total count of answers",
}, []string{"port", "zone", "alias", "resolver", "ip"})
var _ sync.Once