-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
metrics.go
98 lines (94 loc) · 3.88 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
// SPDX-License-Identifier: Apache-2.0
// Copyright Authors of Cilium
package statedb
import (
"github.com/cilium/cilium/pkg/metrics"
"github.com/cilium/cilium/pkg/metrics/metric"
)
type Metrics struct {
// How long a read transaction was held.
WriteTxnDuration metric.Vec[metric.Observer]
// How long it took to acquire a write transaction for all tables.
WriteTxnAcquisition metric.Vec[metric.Observer]
// How long writers were blocked while waiting to acquire a write transaction for a specific table.
TableContention metric.Vec[metric.Gauge]
// The amount of objects in a given table.
TableObjectCount metric.Vec[metric.Gauge]
// The current revision of a given table.
TableRevision metric.Vec[metric.Gauge]
// The amount of delete trackers for a given table.
TableDeleteTrackerCount metric.Vec[metric.Gauge]
// The amount of objects in the graveyard for a given table.
TableGraveyardObjectCount metric.Vec[metric.Gauge]
// The lowest revision of a given table that has been processed by the graveyard garbage collector.
TableGraveyardLowWatermark metric.Vec[metric.Gauge]
// The time it took to clean the graveyard for a given table.
TableGraveyardCleaningDuration metric.Vec[metric.Observer]
}
func NewMetrics() Metrics {
return Metrics{
WriteTxnDuration: metric.NewHistogramVec(metric.HistogramOpts{
Namespace: metrics.CiliumAgentNamespace,
Subsystem: "statedb",
Name: "write_txn_duration_seconds",
Help: "How long a write transaction was held.",
Disabled: true,
}, []string{"tables", "package"}),
WriteTxnAcquisition: metric.NewHistogramVec(metric.HistogramOpts{
Namespace: metrics.CiliumAgentNamespace,
Subsystem: "statedb",
Name: "write_txn_acquisition_seconds",
Help: "How long it took to acquire a write transaction for all tables.",
Disabled: true,
}, []string{"tables", "package"}),
TableContention: metric.NewGaugeVec(metric.GaugeOpts{
Namespace: metrics.CiliumAgentNamespace,
Subsystem: "statedb",
Name: "table_contention_seconds",
Help: "How long writers were blocked while waiting to acquire a write transaction for a specific table.",
Disabled: true,
}, []string{"table"}),
TableObjectCount: metric.NewGaugeVec(metric.GaugeOpts{
Namespace: metrics.CiliumAgentNamespace,
Subsystem: "statedb",
Name: "table_objects",
Help: "The amount of objects in a given table.",
Disabled: true,
}, []string{"table"}),
TableRevision: metric.NewGaugeVec(metric.GaugeOpts{
Namespace: metrics.CiliumAgentNamespace,
Subsystem: "statedb",
Name: "table_revision",
Help: "The current revision of a given table.",
Disabled: true,
}, []string{"table"}),
TableDeleteTrackerCount: metric.NewGaugeVec(metric.GaugeOpts{
Namespace: metrics.CiliumAgentNamespace,
Subsystem: "statedb",
Name: "table_delete_trackers",
Help: "The amount of delete trackers for a given table.",
Disabled: true,
}, []string{"table"}),
TableGraveyardObjectCount: metric.NewGaugeVec(metric.GaugeOpts{
Namespace: metrics.CiliumAgentNamespace,
Subsystem: "statedb",
Name: "table_graveyard_objects",
Help: "The amount of objects in the graveyard for a given table.",
Disabled: true,
}, []string{"table"}),
TableGraveyardLowWatermark: metric.NewGaugeVec(metric.GaugeOpts{
Namespace: metrics.CiliumAgentNamespace,
Subsystem: "statedb",
Name: "table_graveyard_low_watermark",
Help: "The lowest revision of a given table that has been processed by the graveyard garbage collector.",
Disabled: true,
}, []string{"table"}),
TableGraveyardCleaningDuration: metric.NewHistogramVec(metric.HistogramOpts{
Namespace: metrics.CiliumAgentNamespace,
Subsystem: "statedb",
Name: "table_graveyard_cleaning_duration_seconds",
Help: "The time it took to clean the graveyard for a given table.",
Disabled: true,
}, []string{"table"}),
}
}