Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/monitoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ This doesn't consider the action taken by the shard.
#### `controller_sharding_ring_calculations_total`

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

## sharding-exporter
Expand Down
38 changes: 22 additions & 16 deletions pkg/sharding/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,44 @@ import (
"sigs.k8s.io/controller-runtime/pkg/metrics"
)

const Namespace = "controller_sharding"

var (
// AssignmentsTotal is a prometheus counter metric which holds the total number of shard assignments by the sharder
// webhook per Ring and GroupResource.
// webhook per ControllerRing and GroupResource.
// It has a label which refers to the ControllerRing and two labels which refer to the object's GroupResource.
AssignmentsTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "controller_sharding_assignments_total",
Help: "Total number of shard assignments by the sharder webhook per Ring and GroupResource",
}, []string{"ringName", "group", "resource"})
Namespace: Namespace,
Name: "assignments_total",
Help: "Total number of shard assignments by the sharder webhook per ControllerRing and GroupResource",
}, []string{"controllerring", "group", "resource"})

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

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

// RingCalculationsTotal is a prometheus counter metric which holds the total
// number of shard ring calculations per ring kind.
// number of hash ring calculations per ControllerRing.
// It has a label which refers to the ControllerRing.
RingCalculationsTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "controller_sharding_ring_calculations_total",
Help: "Total number of shard ring calculations per ring kind",
}, []string{"name"})
Namespace: Namespace,
Name: "ring_calculations_total",
Help: "Total number of hash ring calculations per ControllerRing",
}, []string{"controllerring"})
)

func init() {
Expand Down
Loading
Loading