-
Notifications
You must be signed in to change notification settings - Fork 3.8k
/
metrics.go
1956 lines (1834 loc) · 77 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2016 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.
package kvserver
import (
"context"
"runtime/debug"
"sync/atomic"
"time"
"unsafe"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/batcheval/result"
"github.com/cockroachdb/cockroach/pkg/kv/kvserver/rangefeed"
"github.com/cockroachdb/cockroach/pkg/multitenant"
"github.com/cockroachdb/cockroach/pkg/roachpb"
"github.com/cockroachdb/cockroach/pkg/storage"
"github.com/cockroachdb/cockroach/pkg/storage/enginepb"
"github.com/cockroachdb/cockroach/pkg/util/log"
"github.com/cockroachdb/cockroach/pkg/util/metric"
"github.com/cockroachdb/cockroach/pkg/util/metric/aggmetric"
"github.com/cockroachdb/cockroach/pkg/util/syncutil"
"go.etcd.io/etcd/raft/v3/raftpb"
)
var (
// Replica metrics.
metaReplicaCount = metric.Metadata{
Name: "replicas",
Help: "Number of replicas",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaReservedReplicaCount = metric.Metadata{
Name: "replicas.reserved",
Help: "Number of replicas reserved for snapshots",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaRaftLeaderCount = metric.Metadata{
Name: "replicas.leaders",
Help: "Number of raft leaders",
Measurement: "Raft Leaders",
Unit: metric.Unit_COUNT,
}
metaRaftLeaderNotLeaseHolderCount = metric.Metadata{
Name: "replicas.leaders_not_leaseholders",
Help: "Number of replicas that are Raft leaders whose range lease is held by another store",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaLeaseHolderCount = metric.Metadata{
Name: "replicas.leaseholders",
Help: "Number of lease holders",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaQuiescentCount = metric.Metadata{
Name: "replicas.quiescent",
Help: "Number of quiesced replicas",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
// Range metrics.
metaRangeCount = metric.Metadata{
Name: "ranges",
Help: "Number of ranges",
Measurement: "Ranges",
Unit: metric.Unit_COUNT,
}
metaUnavailableRangeCount = metric.Metadata{
Name: "ranges.unavailable",
Help: "Number of ranges with fewer live replicas than needed for quorum",
Measurement: "Ranges",
Unit: metric.Unit_COUNT,
}
metaUnderReplicatedRangeCount = metric.Metadata{
Name: "ranges.underreplicated",
Help: "Number of ranges with fewer live replicas than the replication target",
Measurement: "Ranges",
Unit: metric.Unit_COUNT,
}
metaOverReplicatedRangeCount = metric.Metadata{
Name: "ranges.overreplicated",
Help: "Number of ranges with more live replicas than the replication target",
Measurement: "Ranges",
Unit: metric.Unit_COUNT,
}
// Lease request metrics.
metaLeaseRequestSuccessCount = metric.Metadata{
Name: "leases.success",
Help: "Number of successful lease requests",
Measurement: "Lease Requests",
Unit: metric.Unit_COUNT,
}
metaLeaseRequestErrorCount = metric.Metadata{
Name: "leases.error",
Help: "Number of failed lease requests",
Measurement: "Lease Requests",
Unit: metric.Unit_COUNT,
}
metaLeaseTransferSuccessCount = metric.Metadata{
Name: "leases.transfers.success",
Help: "Number of successful lease transfers",
Measurement: "Lease Transfers",
Unit: metric.Unit_COUNT,
}
metaLeaseTransferErrorCount = metric.Metadata{
Name: "leases.transfers.error",
Help: "Number of failed lease transfers",
Measurement: "Lease Transfers",
Unit: metric.Unit_COUNT,
}
metaLeaseExpirationCount = metric.Metadata{
Name: "leases.expiration",
Help: "Number of replica leaseholders using expiration-based leases",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaLeaseEpochCount = metric.Metadata{
Name: "leases.epoch",
Help: "Number of replica leaseholders using epoch-based leases",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
// Storage metrics.
metaLiveBytes = metric.Metadata{
Name: "livebytes",
Help: "Number of bytes of live data (keys plus values)",
Measurement: "Storage",
Unit: metric.Unit_BYTES,
}
metaKeyBytes = metric.Metadata{
Name: "keybytes",
Help: "Number of bytes taken up by keys",
Measurement: "Storage",
Unit: metric.Unit_BYTES,
}
metaValBytes = metric.Metadata{
Name: "valbytes",
Help: "Number of bytes taken up by values",
Measurement: "Storage",
Unit: metric.Unit_BYTES,
}
metaTotalBytes = metric.Metadata{
Name: "totalbytes",
Help: "Total number of bytes taken up by keys and values including non-live data",
Measurement: "Storage",
Unit: metric.Unit_BYTES,
}
metaIntentBytes = metric.Metadata{
Name: "intentbytes",
Help: "Number of bytes in intent KV pairs",
Measurement: "Storage",
Unit: metric.Unit_BYTES,
}
metaLiveCount = metric.Metadata{
Name: "livecount",
Help: "Count of live keys",
Measurement: "Keys",
Unit: metric.Unit_COUNT,
}
metaKeyCount = metric.Metadata{
Name: "keycount",
Help: "Count of all keys",
Measurement: "Keys",
Unit: metric.Unit_COUNT,
}
metaValCount = metric.Metadata{
Name: "valcount",
Help: "Count of all values",
Measurement: "MVCC Values",
Unit: metric.Unit_COUNT,
}
metaIntentCount = metric.Metadata{
Name: "intentcount",
Help: "Count of intent keys",
Measurement: "Keys",
Unit: metric.Unit_COUNT,
}
metaIntentAge = metric.Metadata{
Name: "intentage",
Help: "Cumulative age of intents",
Measurement: "Age",
Unit: metric.Unit_SECONDS,
}
metaGcBytesAge = metric.Metadata{
Name: "gcbytesage",
Help: "Cumulative age of non-live data",
Measurement: "Age",
Unit: metric.Unit_SECONDS,
}
// Contention and intent resolution metrics.
metaResolveCommit = metric.Metadata{
Name: "intents.resolve-attempts",
Help: "Count of (point or range) intent commit evaluation attempts",
Measurement: "Operations",
Unit: metric.Unit_COUNT,
}
metaResolveAbort = metric.Metadata{
Name: "intents.abort-attempts",
Help: "Count of (point or range) non-poisoning intent abort evaluation attempts",
Measurement: "Operations",
Unit: metric.Unit_COUNT,
}
metaResolvePoison = metric.Metadata{
Name: "intents.poison-attempts",
Help: "Count of (point or range) poisoning intent abort evaluation attempts",
Measurement: "Operations",
Unit: metric.Unit_COUNT,
}
// Disk usage diagram (CR=Cockroach):
// ---------------------------------
// Entire hard drive: | non-CR data | CR data | empty |
// ---------------------------------
// Metrics:
// "capacity": |===============================|
// "used": |=========|
// "available": |=======|
// "usable" (computed in UI): |=================|
metaCapacity = metric.Metadata{
Name: "capacity",
Help: "Total storage capacity",
Measurement: "Storage",
Unit: metric.Unit_BYTES,
}
metaAvailable = metric.Metadata{
Name: "capacity.available",
Help: "Available storage capacity",
Measurement: "Storage",
Unit: metric.Unit_BYTES,
}
metaUsed = metric.Metadata{
Name: "capacity.used",
Help: "Used storage capacity",
Measurement: "Storage",
Unit: metric.Unit_BYTES,
}
metaReserved = metric.Metadata{
Name: "capacity.reserved",
Help: "Capacity reserved for snapshots",
Measurement: "Storage",
Unit: metric.Unit_BYTES,
}
metaSysBytes = metric.Metadata{
Name: "sysbytes",
Help: "Number of bytes in system KV pairs",
Measurement: "Storage",
Unit: metric.Unit_BYTES,
}
metaSysCount = metric.Metadata{
Name: "syscount",
Help: "Count of system KV pairs",
Measurement: "Keys",
Unit: metric.Unit_COUNT,
}
metaAbortSpanBytes = metric.Metadata{
Name: "abortspanbytes",
Help: "Number of bytes in the abort span",
Measurement: "Storage",
Unit: metric.Unit_BYTES,
}
// Metrics used by the rebalancing logic that aren't already captured elsewhere.
metaAverageQueriesPerSecond = metric.Metadata{
Name: "rebalancing.queriespersecond",
Help: "Number of kv-level requests received per second by the store, averaged over a large time period as used in rebalancing decisions",
Measurement: "Keys/Sec",
Unit: metric.Unit_COUNT,
}
metaAverageWritesPerSecond = metric.Metadata{
Name: "rebalancing.writespersecond",
Help: "Number of keys written (i.e. applied by raft) per second to the store, averaged over a large time period as used in rebalancing decisions",
Measurement: "Keys/Sec",
Unit: metric.Unit_COUNT,
}
// Metric for tracking follower reads.
metaFollowerReadsCount = metric.Metadata{
Name: "follower_reads.success_count",
Help: "Number of reads successfully processed by any replica",
Measurement: "Read Ops",
Unit: metric.Unit_COUNT,
}
// Server-side transaction metrics.
metaCommitWaitBeforeCommitTriggerCount = metric.Metadata{
Name: "txn.commit_waits.before_commit_trigger",
Help: "Number of KV transactions that had to commit-wait on the server " +
"before committing because they had a commit trigger",
Measurement: "KV Transactions",
Unit: metric.Unit_COUNT,
}
// RocksDB/Pebble metrics.
metaRdbBlockCacheHits = metric.Metadata{
Name: "rocksdb.block.cache.hits",
Help: "Count of block cache hits",
Measurement: "Cache Ops",
Unit: metric.Unit_COUNT,
}
metaRdbBlockCacheMisses = metric.Metadata{
Name: "rocksdb.block.cache.misses",
Help: "Count of block cache misses",
Measurement: "Cache Ops",
Unit: metric.Unit_COUNT,
}
metaRdbBlockCacheUsage = metric.Metadata{
Name: "rocksdb.block.cache.usage",
Help: "Bytes used by the block cache",
Measurement: "Memory",
Unit: metric.Unit_BYTES,
}
metaRdbBlockCachePinnedUsage = metric.Metadata{
Name: "rocksdb.block.cache.pinned-usage",
Help: "Bytes pinned by the block cache",
Measurement: "Memory",
Unit: metric.Unit_BYTES,
}
metaRdbBloomFilterPrefixChecked = metric.Metadata{
Name: "rocksdb.bloom.filter.prefix.checked",
Help: "Number of times the bloom filter was checked",
Measurement: "Bloom Filter Ops",
Unit: metric.Unit_COUNT,
}
metaRdbBloomFilterPrefixUseful = metric.Metadata{
Name: "rocksdb.bloom.filter.prefix.useful",
Help: "Number of times the bloom filter helped avoid iterator creation",
Measurement: "Bloom Filter Ops",
Unit: metric.Unit_COUNT,
}
metaRdbMemtableTotalSize = metric.Metadata{
Name: "rocksdb.memtable.total-size",
Help: "Current size of memtable in bytes",
Measurement: "Memory",
Unit: metric.Unit_BYTES,
}
metaRdbFlushes = metric.Metadata{
Name: "rocksdb.flushes",
Help: "Number of table flushes",
Measurement: "Flushes",
Unit: metric.Unit_COUNT,
}
metaRdbFlushedBytes = metric.Metadata{
Name: "rocksdb.flushed-bytes",
Help: "Bytes written during flush",
Measurement: "Bytes Written",
Unit: metric.Unit_BYTES,
}
metaRdbCompactions = metric.Metadata{
Name: "rocksdb.compactions",
Help: "Number of table compactions",
Measurement: "Compactions",
Unit: metric.Unit_COUNT,
}
metaRdbIngestedBytes = metric.Metadata{
Name: "rocksdb.ingested-bytes",
Help: "Bytes ingested",
Measurement: "Bytes Ingested",
Unit: metric.Unit_BYTES,
}
metaRdbCompactedBytesRead = metric.Metadata{
Name: "rocksdb.compacted-bytes-read",
Help: "Bytes read during compaction",
Measurement: "Bytes Read",
Unit: metric.Unit_BYTES,
}
metaRdbCompactedBytesWritten = metric.Metadata{
Name: "rocksdb.compacted-bytes-written",
Help: "Bytes written during compaction",
Measurement: "Bytes Written",
Unit: metric.Unit_BYTES,
}
metaRdbTableReadersMemEstimate = metric.Metadata{
Name: "rocksdb.table-readers-mem-estimate",
Help: "Memory used by index and filter blocks",
Measurement: "Memory",
Unit: metric.Unit_BYTES,
}
metaRdbReadAmplification = metric.Metadata{
Name: "rocksdb.read-amplification",
Help: "Number of disk reads per query",
Measurement: "Disk Reads per Query",
Unit: metric.Unit_COUNT,
}
metaRdbNumSSTables = metric.Metadata{
Name: "rocksdb.num-sstables",
Help: "Number of rocksdb SSTables",
Measurement: "SSTables",
Unit: metric.Unit_COUNT,
}
metaRdbPendingCompaction = metric.Metadata{
Name: "rocksdb.estimated-pending-compaction",
Help: "Estimated pending compaction bytes",
Measurement: "Storage",
Unit: metric.Unit_BYTES,
}
metaRdbL0Sublevels = metric.Metadata{
Name: "storage.l0-sublevels",
Help: "Number of Level 0 sublevels",
Measurement: "Storage",
Unit: metric.Unit_COUNT,
}
metaRdbL0NumFiles = metric.Metadata{
Name: "storage.l0-num-files",
Help: "Number of Level 0 files",
Measurement: "Storage",
Unit: metric.Unit_COUNT,
}
metaRdbWriteStalls = metric.Metadata{
Name: "storage.write-stalls",
Help: "Number of instances of intentional write stalls to backpressure incoming writes",
Measurement: "Events",
Unit: metric.Unit_COUNT,
}
// Disk health metrics.
metaDiskSlow = metric.Metadata{
Name: "storage.disk-slow",
Help: "Number of instances of disk operations taking longer than 10s",
Measurement: "Events",
Unit: metric.Unit_COUNT,
}
metaDiskStalled = metric.Metadata{
Name: "storage.disk-stalled",
Help: "Number of instances of disk operations taking longer than 30s",
Measurement: "Events",
Unit: metric.Unit_COUNT,
}
// Range event metrics.
metaRangeSplits = metric.Metadata{
Name: "range.splits",
Help: "Number of range splits",
Measurement: "Range Ops",
Unit: metric.Unit_COUNT,
}
metaRangeMerges = metric.Metadata{
Name: "range.merges",
Help: "Number of range merges",
Measurement: "Range Ops",
Unit: metric.Unit_COUNT,
}
metaRangeAdds = metric.Metadata{
Name: "range.adds",
Help: "Number of range additions",
Measurement: "Range Ops",
Unit: metric.Unit_COUNT,
}
metaRangeRemoves = metric.Metadata{
Name: "range.removes",
Help: "Number of range removals",
Measurement: "Range Ops",
Unit: metric.Unit_COUNT,
}
metaRangeSnapshotsGenerated = metric.Metadata{
Name: "range.snapshots.generated",
Help: "Number of generated snapshots",
Measurement: "Snapshots",
Unit: metric.Unit_COUNT,
}
metaRangeSnapshotsAppliedByVoters = metric.Metadata{
Name: "range.snapshots.applied-voter",
Help: "Number of snapshots applied by voter replicas",
Measurement: "Snapshots",
Unit: metric.Unit_COUNT,
}
metaRangeSnapshotsAppliedForInitialUpreplication = metric.Metadata{
Name: "range.snapshots.applied-initial",
Help: "Number of snapshots applied for initial upreplication",
Measurement: "Snapshots",
Unit: metric.Unit_COUNT,
}
metaRangeSnapshotsAppliedByNonVoter = metric.Metadata{
Name: "range.snapshots.applied-non-voter",
Help: "Number of snapshots applied by non-voter replicas",
Measurement: "Snapshots",
Unit: metric.Unit_COUNT,
}
metaRangeRaftLeaderTransfers = metric.Metadata{
Name: "range.raftleadertransfers",
Help: "Number of raft leader transfers",
Measurement: "Leader Transfers",
Unit: metric.Unit_COUNT,
}
// Raft processing metrics.
metaRaftTicks = metric.Metadata{
Name: "raft.ticks",
Help: "Number of Raft ticks queued",
Measurement: "Ticks",
Unit: metric.Unit_COUNT,
}
metaRaftWorkingDurationNanos = metric.Metadata{
Name: "raft.process.workingnanos",
Help: `Nanoseconds spent in store.processRaft() working.
This is the sum of the measurements passed to the raft.process.handleready.latency
histogram.
`,
Measurement: "Processing Time",
Unit: metric.Unit_NANOSECONDS,
}
metaRaftTickingDurationNanos = metric.Metadata{
Name: "raft.process.tickingnanos",
Help: "Nanoseconds spent in store.processRaft() processing replica.Tick()",
Measurement: "Processing Time",
Unit: metric.Unit_NANOSECONDS,
}
metaRaftCommandsApplied = metric.Metadata{
Name: "raft.commandsapplied",
Help: `Count of Raft commands applied.
This measurement is taken on the Raft apply loops of all Replicas (leaders and
followers alike), meaning that it does not measure the number of Raft commands
*proposed* (in the hypothetical extreme case, all Replicas may apply all commands
through snapshots, thus not increasing this metric at all).
Instead, it is a proxy for how much work is being done advancing the Replica
state machines on this node.`,
Measurement: "Commands",
Unit: metric.Unit_COUNT,
}
metaRaftLogCommitLatency = metric.Metadata{
Name: "raft.process.logcommit.latency",
Help: `Latency histogram for committing Raft log entries to stable storage
This measures the latency of durably committing a group of newly received Raft
entries as well as the HardState entry to disk. This excludes any data
processing, i.e. we measure purely the commit latency of the resulting Engine
write. Homogeneous bands of p50-p99 latencies (in the presence of regular Raft
traffic), make it likely that the storage layer is healthy. Spikes in the
latency bands can either hint at the presence of large sets of Raft entries
being received, or at performance issues at the storage layer.
`,
Measurement: "Latency",
Unit: metric.Unit_NANOSECONDS,
}
metaRaftCommandCommitLatency = metric.Metadata{
Name: "raft.process.commandcommit.latency",
Help: `Latency histogram for applying a batch of Raft commands to the state machine.
This metric is misnamed: it measures the latency for *applying* a batch of
committed Raft commands to a Replica state machine. This requires only
non-durable I/O (except for replication configuration changes).
Note that a "batch" in this context is really a sub-batch of the batch received
for application during raft ready handling. The
'raft.process.applycommitted.latency' histogram is likely more suitable in most
cases, as it measures the total latency across all sub-batches (i.e. the sum of
commandcommit.latency for a complete batch).
`,
Measurement: "Latency",
Unit: metric.Unit_NANOSECONDS,
}
// TODO(tbg): I think this metric skews low because we will often handle Readies
// for which the result is that there is nothing to do. Do we want to change this
// metric to only record ready handling when there is a Ready? That seems more
// useful, experimentally it seems that we're recording 50% no-ops right now.
// Though they aren't really no-ops, they still have to get a mutex and check
// for a Ready, etc, but I still think it would be better to avoid those measure-
// ments and to count the number of noops instead if we really want to.
metaRaftHandleReadyLatency = metric.Metadata{
Name: "raft.process.handleready.latency",
Help: `Latency histogram for handling a Raft ready.
This measures the end-to-end-latency of the Raft state advancement loop, and
in particular includes:
- snapshot application
- SST ingestion
- durably appending to the Raft log (i.e. includes fsync)
- entry application (incl. replicated side effects, notably log truncation)
as well as updates to in-memory structures.
The above steps include the work measured in 'raft.process.commandcommit.latency',
as well as 'raft.process.applycommitted.latency'. Note that matching percentiles
of these metrics may nevertheless be *higher* than that of the handlready latency.
This is because not every handleready cycle leads to an update to the applycommitted
and commandcommit latencies. For example, under tpcc-100 on a single node, the
handleready count is approximately twice the logcommit count (and logcommit count
tracks closely with applycommitted count).
High percentile outliers can be caused by individual large Raft commands or
storage layer blips. An increase in lower (say the 50th) percentile is often
driven by either CPU exhaustion or a slowdown at the storage layer.
`,
Measurement: "Latency",
Unit: metric.Unit_NANOSECONDS,
}
metaRaftApplyCommittedLatency = metric.Metadata{
Name: "raft.process.applycommitted.latency",
Help: `Latency histogram for applying all committed Raft commands in a Raft ready.
This measures the end-to-end latency of applying all commands in a Raft ready. Note that
this closes over possibly multiple measurements of the 'raft.process.commandcommit.latency'
metric, which receives datapoints for each sub-batch processed in the process.`,
Measurement: "Latency",
Unit: metric.Unit_NANOSECONDS,
}
metaRaftSchedulerLatency = metric.Metadata{
Name: "raft.scheduler.latency",
Help: `Queueing durations for ranges waiting to be processed by the Raft scheduler.
This histogram measures the delay from when a range is registered with the scheduler
for processing to when it is actually processed. This does not include the duration
of processing.
`,
Measurement: "Latency",
Unit: metric.Unit_NANOSECONDS,
}
metaRaftTimeoutCampaign = metric.Metadata{
Name: "raft.timeoutcampaign",
Help: "Number of Raft replicas campaigning after missed heartbeats from leader",
Measurement: "Elections called after timeout",
Unit: metric.Unit_COUNT,
}
// Raft message metrics.
metaRaftRcvdProp = metric.Metadata{
Name: "raft.rcvd.prop",
Help: "Number of MsgProp messages received by this store",
Measurement: "Messages",
Unit: metric.Unit_COUNT,
}
metaRaftRcvdApp = metric.Metadata{
Name: "raft.rcvd.app",
Help: "Number of MsgApp messages received by this store",
Measurement: "Messages",
Unit: metric.Unit_COUNT,
}
metaRaftRcvdAppResp = metric.Metadata{
Name: "raft.rcvd.appresp",
Help: "Number of MsgAppResp messages received by this store",
Measurement: "Messages",
Unit: metric.Unit_COUNT,
}
metaRaftRcvdVote = metric.Metadata{
Name: "raft.rcvd.vote",
Help: "Number of MsgVote messages received by this store",
Measurement: "Messages",
Unit: metric.Unit_COUNT,
}
metaRaftRcvdVoteResp = metric.Metadata{
Name: "raft.rcvd.voteresp",
Help: "Number of MsgVoteResp messages received by this store",
Measurement: "Messages",
Unit: metric.Unit_COUNT,
}
metaRaftRcvdPreVote = metric.Metadata{
Name: "raft.rcvd.prevote",
Help: "Number of MsgPreVote messages received by this store",
Measurement: "Messages",
Unit: metric.Unit_COUNT,
}
metaRaftRcvdPreVoteResp = metric.Metadata{
Name: "raft.rcvd.prevoteresp",
Help: "Number of MsgPreVoteResp messages received by this store",
Measurement: "Messages",
Unit: metric.Unit_COUNT,
}
metaRaftRcvdSnap = metric.Metadata{
Name: "raft.rcvd.snap",
Help: "Number of MsgSnap messages received by this store",
Measurement: "Messages",
Unit: metric.Unit_COUNT,
}
metaRaftRcvdHeartbeat = metric.Metadata{
Name: "raft.rcvd.heartbeat",
Help: "Number of (coalesced, if enabled) MsgHeartbeat messages received by this store",
Measurement: "Messages",
Unit: metric.Unit_COUNT,
}
metaRaftRcvdHeartbeatResp = metric.Metadata{
Name: "raft.rcvd.heartbeatresp",
Help: "Number of (coalesced, if enabled) MsgHeartbeatResp messages received by this store",
Measurement: "Messages",
Unit: metric.Unit_COUNT,
}
metaRaftRcvdTransferLeader = metric.Metadata{
Name: "raft.rcvd.transferleader",
Help: "Number of MsgTransferLeader messages received by this store",
Measurement: "Messages",
Unit: metric.Unit_COUNT,
}
metaRaftRcvdTimeoutNow = metric.Metadata{
Name: "raft.rcvd.timeoutnow",
Help: "Number of MsgTimeoutNow messages received by this store",
Measurement: "Messages",
Unit: metric.Unit_COUNT,
}
metaRaftRcvdDropped = metric.Metadata{
Name: "raft.rcvd.dropped",
Help: "Number of dropped incoming Raft messages",
Measurement: "Messages",
Unit: metric.Unit_COUNT,
}
metaRaftEnqueuedPending = metric.Metadata{
Name: "raft.enqueued.pending",
Help: `Number of pending outgoing messages in the Raft Transport queue.
The queue is bounded in size, so instead of unbounded growth one would observe a
ceiling value in the tens of thousands.`,
Measurement: "Messages",
Unit: metric.Unit_COUNT,
}
metaRaftCoalescedHeartbeatsPending = metric.Metadata{
Name: "raft.heartbeats.pending",
Help: "Number of pending heartbeats and responses waiting to be coalesced",
Measurement: "Messages",
Unit: metric.Unit_COUNT,
}
// Raft log metrics.
metaRaftLogFollowerBehindCount = metric.Metadata{
Name: "raftlog.behind",
Help: `Number of Raft log entries followers on other stores are behind.
This gauge provides a view of the aggregate number of log entries the Raft leaders
on this node think the followers are behind. Since a raft leader may not always
have a good estimate for this information for all of its followers, and since
followers are expected to be behind (when they are not required as part of a
quorum) *and* the aggregate thus scales like the count of such followers, it is
difficult to meaningfully interpret this metric.`,
Measurement: "Log Entries",
Unit: metric.Unit_COUNT,
}
metaRaftLogTruncated = metric.Metadata{
Name: "raftlog.truncated",
Help: "Number of Raft log entries truncated",
Measurement: "Log Entries",
Unit: metric.Unit_COUNT,
}
// Replica queue metrics.
metaGCQueueSuccesses = metric.Metadata{
Name: "queue.gc.process.success",
Help: "Number of replicas successfully processed by the GC queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaGCQueueFailures = metric.Metadata{
Name: "queue.gc.process.failure",
Help: "Number of replicas which failed processing in the GC queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaGCQueuePending = metric.Metadata{
Name: "queue.gc.pending",
Help: "Number of pending replicas in the GC queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaGCQueueProcessingNanos = metric.Metadata{
Name: "queue.gc.processingnanos",
Help: "Nanoseconds spent processing replicas in the GC queue",
Measurement: "Processing Time",
Unit: metric.Unit_NANOSECONDS,
}
metaMergeQueueSuccesses = metric.Metadata{
Name: "queue.merge.process.success",
Help: "Number of replicas successfully processed by the merge queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaMergeQueueFailures = metric.Metadata{
Name: "queue.merge.process.failure",
Help: "Number of replicas which failed processing in the merge queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaMergeQueuePending = metric.Metadata{
Name: "queue.merge.pending",
Help: "Number of pending replicas in the merge queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaMergeQueueProcessingNanos = metric.Metadata{
Name: "queue.merge.processingnanos",
Help: "Nanoseconds spent processing replicas in the merge queue",
Measurement: "Processing Time",
Unit: metric.Unit_NANOSECONDS,
}
metaMergeQueuePurgatory = metric.Metadata{
Name: "queue.merge.purgatory",
Help: "Number of replicas in the merge queue's purgatory, waiting to become mergeable",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaRaftLogQueueSuccesses = metric.Metadata{
Name: "queue.raftlog.process.success",
Help: "Number of replicas successfully processed by the Raft log queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaRaftLogQueueFailures = metric.Metadata{
Name: "queue.raftlog.process.failure",
Help: "Number of replicas which failed processing in the Raft log queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaRaftLogQueuePending = metric.Metadata{
Name: "queue.raftlog.pending",
Help: "Number of pending replicas in the Raft log queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaRaftLogQueueProcessingNanos = metric.Metadata{
Name: "queue.raftlog.processingnanos",
Help: "Nanoseconds spent processing replicas in the Raft log queue",
Measurement: "Processing Time",
Unit: metric.Unit_NANOSECONDS,
}
metaRaftSnapshotQueueSuccesses = metric.Metadata{
Name: "queue.raftsnapshot.process.success",
Help: "Number of replicas successfully processed by the Raft repair queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaRaftSnapshotQueueFailures = metric.Metadata{
Name: "queue.raftsnapshot.process.failure",
Help: "Number of replicas which failed processing in the Raft repair queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaRaftSnapshotQueuePending = metric.Metadata{
Name: "queue.raftsnapshot.pending",
Help: "Number of pending replicas in the Raft repair queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaRaftSnapshotQueueProcessingNanos = metric.Metadata{
Name: "queue.raftsnapshot.processingnanos",
Help: "Nanoseconds spent processing replicas in the Raft repair queue",
Measurement: "Processing Time",
Unit: metric.Unit_NANOSECONDS,
}
metaConsistencyQueueSuccesses = metric.Metadata{
Name: "queue.consistency.process.success",
Help: "Number of replicas successfully processed by the consistency checker queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaConsistencyQueueFailures = metric.Metadata{
Name: "queue.consistency.process.failure",
Help: "Number of replicas which failed processing in the consistency checker queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaConsistencyQueuePending = metric.Metadata{
Name: "queue.consistency.pending",
Help: "Number of pending replicas in the consistency checker queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaConsistencyQueueProcessingNanos = metric.Metadata{
Name: "queue.consistency.processingnanos",
Help: "Nanoseconds spent processing replicas in the consistency checker queue",
Measurement: "Processing Time",
Unit: metric.Unit_NANOSECONDS,
}
metaReplicaGCQueueSuccesses = metric.Metadata{
Name: "queue.replicagc.process.success",
Help: "Number of replicas successfully processed by the replica GC queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaReplicaGCQueueFailures = metric.Metadata{
Name: "queue.replicagc.process.failure",
Help: "Number of replicas which failed processing in the replica GC queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaReplicaGCQueuePending = metric.Metadata{
Name: "queue.replicagc.pending",
Help: "Number of pending replicas in the replica GC queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaReplicaGCQueueProcessingNanos = metric.Metadata{
Name: "queue.replicagc.processingnanos",
Help: "Nanoseconds spent processing replicas in the replica GC queue",
Measurement: "Processing Time",
Unit: metric.Unit_NANOSECONDS,
}
metaReplicateQueueSuccesses = metric.Metadata{
Name: "queue.replicate.process.success",
Help: "Number of replicas successfully processed by the replicate queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaReplicateQueueFailures = metric.Metadata{
Name: "queue.replicate.process.failure",
Help: "Number of replicas which failed processing in the replicate queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaReplicateQueuePending = metric.Metadata{
Name: "queue.replicate.pending",
Help: "Number of pending replicas in the replicate queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaReplicateQueueProcessingNanos = metric.Metadata{
Name: "queue.replicate.processingnanos",
Help: "Nanoseconds spent processing replicas in the replicate queue",
Measurement: "Processing Time",
Unit: metric.Unit_NANOSECONDS,
}
metaReplicateQueuePurgatory = metric.Metadata{
Name: "queue.replicate.purgatory",
Help: "Number of replicas in the replicate queue's purgatory, awaiting allocation options",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaSplitQueueSuccesses = metric.Metadata{
Name: "queue.split.process.success",
Help: "Number of replicas successfully processed by the split queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaSplitQueueFailures = metric.Metadata{
Name: "queue.split.process.failure",
Help: "Number of replicas which failed processing in the split queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaSplitQueuePending = metric.Metadata{
Name: "queue.split.pending",
Help: "Number of pending replicas in the split queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaSplitQueueProcessingNanos = metric.Metadata{
Name: "queue.split.processingnanos",
Help: "Nanoseconds spent processing replicas in the split queue",
Measurement: "Processing Time",
Unit: metric.Unit_NANOSECONDS,
}
metaSplitQueuePurgatory = metric.Metadata{
Name: "queue.split.purgatory",
Help: "Number of replicas in the split queue's purgatory, waiting to become splittable",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaTimeSeriesMaintenanceQueueSuccesses = metric.Metadata{
Name: "queue.tsmaintenance.process.success",
Help: "Number of replicas successfully processed by the time series maintenance queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaTimeSeriesMaintenanceQueueFailures = metric.Metadata{
Name: "queue.tsmaintenance.process.failure",
Help: "Number of replicas which failed processing in the time series maintenance queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaTimeSeriesMaintenanceQueuePending = metric.Metadata{
Name: "queue.tsmaintenance.pending",
Help: "Number of pending replicas in the time series maintenance queue",
Measurement: "Replicas",
Unit: metric.Unit_COUNT,
}
metaTimeSeriesMaintenanceQueueProcessingNanos = metric.Metadata{
Name: "queue.tsmaintenance.processingnanos",
Help: "Nanoseconds spent processing replicas in the time series maintenance queue",
Measurement: "Processing Time",
Unit: metric.Unit_NANOSECONDS,
}
// GCInfo cumulative totals.
metaGCNumKeysAffected = metric.Metadata{
Name: "queue.gc.info.numkeysaffected",
Help: "Number of keys with GC'able data",
Measurement: "Keys",
Unit: metric.Unit_COUNT,
}
metaGCIntentsConsidered = metric.Metadata{
Name: "queue.gc.info.intentsconsidered",
Help: "Number of 'old' intents",
Measurement: "Intents",
Unit: metric.Unit_COUNT,
}
metaGCIntentTxns = metric.Metadata{
Name: "queue.gc.info.intenttxns",
Help: "Number of associated distinct transactions",
Measurement: "Txns",
Unit: metric.Unit_COUNT,
}