Skip to content

Commit ac802fe

Browse files
committed
kvserver: rename ReplicateQueueDroppedDueToSize to ReplicateQueueFull
This commit improves the clarity around the naming and description of the metrics.
1 parent b4b486d commit ac802fe

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

docs/generated/metrics/metrics.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13903,14 +13903,6 @@ layers:
1390313903
unit: COUNT
1390413904
aggregation: AVG
1390513905
derivative: NON_NEGATIVE_DERIVATIVE
13906-
- name: queue.replicate.dropped_due_to_size
13907-
exported_name: queue_replicate_dropped_due_to_size
13908-
description: Number of replicas dropped due to the replicate queue exceeding its max size
13909-
y_axis_label: Replicas
13910-
type: COUNTER
13911-
unit: COUNT
13912-
aggregation: AVG
13913-
derivative: NON_NEGATIVE_DERIVATIVE
1391413906
- name: queue.replicate.nonvoterpromotions
1391513907
exported_name: queue_replicate_nonvoterpromotions
1391613908
description: Number of non-voters promoted to voters by the replicate queue
@@ -13959,6 +13951,14 @@ layers:
1395913951
unit: COUNT
1396013952
aggregation: AVG
1396113953
derivative: NONE
13954+
- name: queue.replicate.queue_full
13955+
exported_name: queue_replicate_queue_full
13956+
description: Number of times a replica was dropped from the queue due to queue fullness
13957+
y_axis_label: Replicas
13958+
type: COUNTER
13959+
unit: COUNT
13960+
aggregation: AVG
13961+
derivative: NON_NEGATIVE_DERIVATIVE
1396213962
- name: queue.replicate.rebalancenonvoterreplica
1396313963
exported_name: queue_replicate_rebalancenonvoterreplica
1396413964
description: Number of non-voter replica rebalancer-initiated additions attempted by the replicate queue

pkg/kv/kvserver/metrics.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2192,9 +2192,9 @@ The messages are dropped to help these replicas to recover from I/O overload.`,
21922192
Measurement: "Replicas",
21932193
Unit: metric.Unit_COUNT,
21942194
}
2195-
metaReplicateQueueDroppedDueToSize = metric.Metadata{
2196-
Name: "queue.replicate.dropped_due_to_size",
2197-
Help: "Number of replicas dropped due to the replicate queue exceeding its max size",
2195+
metaReplicateQueueFull = metric.Metadata{
2196+
Name: "queue.replicate.queue_full",
2197+
Help: "Number of times a replica was dropped from the queue due to queue fullness",
21982198
Measurement: "Replicas",
21992199
Unit: metric.Unit_COUNT,
22002200
}
@@ -3191,7 +3191,7 @@ type StoreMetrics struct {
31913191
ReplicateQueueSuccesses *metric.Counter
31923192
ReplicateQueueFailures *metric.Counter
31933193
ReplicateQueuePending *metric.Gauge
3194-
ReplicateQueueDroppedDueToSize *metric.Counter
3194+
ReplicateQueueFull *metric.Counter
31953195
ReplicateQueueProcessingNanos *metric.Counter
31963196
ReplicateQueuePurgatory *metric.Gauge
31973197
SplitQueueSuccesses *metric.Counter
@@ -3981,7 +3981,7 @@ func newStoreMetrics(histogramWindow time.Duration) *StoreMetrics {
39813981
ReplicateQueueSuccesses: metric.NewCounter(metaReplicateQueueSuccesses),
39823982
ReplicateQueueFailures: metric.NewCounter(metaReplicateQueueFailures),
39833983
ReplicateQueuePending: metric.NewGauge(metaReplicateQueuePending),
3984-
ReplicateQueueDroppedDueToSize: metric.NewCounter(metaReplicateQueueDroppedDueToSize),
3984+
ReplicateQueueFull: metric.NewCounter(metaReplicateQueueFull),
39853985
ReplicateQueueProcessingNanos: metric.NewCounter(metaReplicateQueueProcessingNanos),
39863986
ReplicateQueuePurgatory: metric.NewGauge(metaReplicateQueuePurgatory),
39873987
SplitQueueSuccesses: metric.NewCounter(metaSplitQueueSuccesses),

pkg/kv/kvserver/queue.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,11 @@ type queueConfig struct {
331331
failures *metric.Counter
332332
// pending is a gauge measuring current replica count pending.
333333
pending *metric.Gauge
334-
// droppedDueToSize is a counter measuring replicas dropped due to
335-
// exceeding the queue max size.
334+
// full is a counter measuring replicas dropped due to exceeding the queue max
335+
// size.
336336
// NB: this metric may be nil for queues that are not interested in tracking
337337
// this.
338-
droppedDueToSize *metric.Counter
338+
full *metric.Counter
339339
// processingNanos is a counter measuring total nanoseconds spent processing
340340
// replicas.
341341
processingNanos *metric.Counter
@@ -556,7 +556,7 @@ func (bq *baseQueue) SetMaxSize(maxSize int64) {
556556
// queue. To be safe, however, we use removeLocked.
557557
for int64(bq.mu.priorityQ.Len()) > maxSize {
558558
pqLen := bq.mu.priorityQ.Len()
559-
bq.droppedDueToSize.Inc(1)
559+
bq.full.Inc(1)
560560
bq.removeLocked(bq.mu.priorityQ.sl[pqLen-1])
561561
}
562562
}
@@ -798,8 +798,8 @@ func (bq *baseQueue) addInternal(
798798
// scan.
799799
if pqLen := bq.mu.priorityQ.Len(); int64(pqLen) > bq.mu.maxSize {
800800
replicaItemToDrop := bq.mu.priorityQ.sl[pqLen-1]
801-
if bq.droppedDueToSize != nil {
802-
bq.droppedDueToSize.Inc(1)
801+
if bq.full != nil {
802+
bq.full.Inc(1)
803803
}
804804
log.Dev.VInfof(ctx, 1, "dropping due to exceeding queue max size: priority=%0.3f, replica=%v",
805805
priority, replicaItemToDrop.replicaID)

pkg/kv/kvserver/replicate_queue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ func newReplicateQueue(store *Store, allocator allocatorimpl.Allocator) *replica
598598
successes: store.metrics.ReplicateQueueSuccesses,
599599
failures: store.metrics.ReplicateQueueFailures,
600600
pending: store.metrics.ReplicateQueuePending,
601-
droppedDueToSize: store.metrics.ReplicateQueueDroppedDueToSize,
601+
full: store.metrics.ReplicateQueueFull,
602602
processingNanos: store.metrics.ReplicateQueueProcessingNanos,
603603
purgatory: store.metrics.ReplicateQueuePurgatory,
604604
disabledConfig: kvserverbase.ReplicateQueueEnabled,

pkg/kv/kvserver/store_rebalancer_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,8 +1888,8 @@ func TestReplicateQueueMaxSize(t *testing.T) {
18881888
// Helper function to add a replica and verify queue state.
18891889
verify := func(expectedLength int, expectedDropped int64) {
18901890
require.Equal(t, expectedLength, replicateQueue.Length())
1891-
require.Equal(t, expectedDropped, replicateQueue.droppedDueToSize.Count())
1892-
require.Equal(t, expectedDropped, tc.store.metrics.ReplicateQueueDroppedDueToSize.Count())
1891+
require.Equal(t, expectedDropped, replicateQueue.full.Count())
1892+
require.Equal(t, expectedDropped, tc.store.metrics.ReplicateQueueFull.Count())
18931893
}
18941894

18951895
addReplicaAndVerify := func(rangeID roachpb.RangeID, expectedLength int, expectedDropped int64) {

0 commit comments

Comments
 (0)