Skip to content

Commit 89f6e10

Browse files
authored
Harmonize metric label names to controllerring (#439)
* Harmonize metric label names to `controllerring` * Extract const for metrics namespace
1 parent 9506c28 commit 89f6e10

File tree

3 files changed

+89
-41
lines changed

3 files changed

+89
-41
lines changed

docs/monitoring.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ This doesn't consider the action taken by the shard.
3333
#### `controller_sharding_ring_calculations_total`
3434

3535
Type: counter
36-
Description: Total number of shard ring calculations per `ControllerRing`.
36+
Description: Total number of hash ring calculations per `ControllerRing`.
3737
This counter is incremented every time the sharder calculates a new consistent hash ring based on the shard leases.
3838

3939
## sharding-exporter

pkg/sharding/metrics/metrics.go

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,38 +22,44 @@ import (
2222
"sigs.k8s.io/controller-runtime/pkg/metrics"
2323
)
2424

25+
const Namespace = "controller_sharding"
26+
2527
var (
2628
// AssignmentsTotal is a prometheus counter metric which holds the total number of shard assignments by the sharder
27-
// webhook per Ring and GroupResource.
29+
// webhook per ControllerRing and GroupResource.
2830
// It has a label which refers to the ControllerRing and two labels which refer to the object's GroupResource.
2931
AssignmentsTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
30-
Name: "controller_sharding_assignments_total",
31-
Help: "Total number of shard assignments by the sharder webhook per Ring and GroupResource",
32-
}, []string{"ringName", "group", "resource"})
32+
Namespace: Namespace,
33+
Name: "assignments_total",
34+
Help: "Total number of shard assignments by the sharder webhook per ControllerRing and GroupResource",
35+
}, []string{"controllerring", "group", "resource"})
3336

3437
// MovementsTotal is a prometheus counter metric which holds the total number of shard movements triggered by the
35-
// sharder controller per Ring and GroupResource.
38+
// sharder controller per ControllerRing and GroupResource.
3639
// It has a label which refers to the ControllerRing and two labels which refer to the object's GroupResource.
3740
MovementsTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
38-
Name: "controller_sharding_movements_total",
39-
Help: "Total number of shard movements triggered by the sharder controller per Ring and GroupResource",
40-
}, []string{"ringName", "group", "resource"})
41+
Namespace: Namespace,
42+
Name: "movements_total",
43+
Help: "Total number of shard movements triggered by the sharder controller per ControllerRing and GroupResource",
44+
}, []string{"controllerring", "group", "resource"})
4145

4246
// DrainsTotal is a prometheus counter metric which holds the total number of shard drains triggered by the sharder
43-
// controller per Ring and GroupResource.
47+
// controller per ControllerRing and GroupResource.
4448
// It has a label which refers to the ControllerRing and two labels which refer to the object's GroupResource.
4549
DrainsTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
46-
Name: "controller_sharding_drains_total",
47-
Help: "Total number of shard drains triggered by the sharder controller per Ring and GroupResource",
48-
}, []string{"ringName", "group", "resource"})
50+
Namespace: Namespace,
51+
Name: "drains_total",
52+
Help: "Total number of shard drains triggered by the sharder controller per ControllerRing and GroupResource",
53+
}, []string{"controllerring", "group", "resource"})
4954

5055
// RingCalculationsTotal is a prometheus counter metric which holds the total
51-
// number of shard ring calculations per ring kind.
56+
// number of hash ring calculations per ControllerRing.
5257
// It has a label which refers to the ControllerRing.
5358
RingCalculationsTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
54-
Name: "controller_sharding_ring_calculations_total",
55-
Help: "Total number of shard ring calculations per ring kind",
56-
}, []string{"name"})
59+
Namespace: Namespace,
60+
Name: "ring_calculations_total",
61+
Help: "Total number of hash ring calculations per ControllerRing",
62+
}, []string{"controllerring"})
5763
)
5864

5965
func init() {

0 commit comments

Comments
 (0)