Skip to content

Commit 4de9b7c

Browse files
jbowensannrpom
authored andcommitted
db: reformat Metrics.String
Reformat the string outputted by Metrics.String to add more organization.
1 parent 0ef4b16 commit 4de9b7c

File tree

10 files changed

+2183
-1154
lines changed

10 files changed

+2183
-1154
lines changed

metrics.go

Lines changed: 502 additions & 272 deletions
Large diffs are not rendered by default.

metrics_test.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ func exampleMetrics() Metrics {
9292
m.Table.Local.ZombieSize = 30
9393
m.Table.PendingStatsCollectionCount = 31
9494
m.Table.InitialStatsCollectionComplete = true
95+
m.Table.Garbage.PointDeletionsBytesEstimate = 1024
96+
m.Table.Garbage.RangeDeletionsBytesEstimate = 2048
97+
m.Table.CompressedCountMinLZ = 32
98+
m.Table.CompressedCountSnappy = 33
99+
m.Table.CompressedCountZstd = 34
100+
m.Table.CompressedCountNone = 35
95101

96102
for i := range m.Levels {
97103
l := &m.Levels[i]
@@ -117,6 +123,10 @@ func exampleMetrics() Metrics {
117123
l.TablesFlushed = base + 11
118124
l.TablesIngested = base + 12
119125
l.TablesMoved = base + 13
126+
l.Additional.ValueBlocksSize = base + 14
127+
l.BlobBytesCompacted = base + 15
128+
l.BlobBytesFlushed = base + 16
129+
l.BlobBytesRead = base + 17
120130
l.MultiLevel.TableBytesInTop = base + 4
121131
l.MultiLevel.TableBytesIn = base + 4
122132
l.MultiLevel.TableBytesRead = base + 4
@@ -380,7 +390,7 @@ func TestMetrics(t *testing.T) {
380390
var buf strings.Builder
381391
fmt.Fprintf(&buf, "%s", m.StringForTests())
382392
if len(m.CategoryStats) > 0 {
383-
fmt.Fprintf(&buf, "Iter category stats:\n")
393+
fmt.Fprintf(&buf, "\nIter category stats:\n")
384394
for _, stats := range m.CategoryStats {
385395
fmt.Fprintf(&buf, "%20s, %11s: %+v\n", stats.Category,
386396
redact.StringWithoutMarkers(stats.Category.QoSLevel()), stats.CategoryStats)

testdata/compaction/l0_to_lbase_compaction

Lines changed: 59 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -32,34 +32,62 @@ L6:
3232

3333
metrics
3434
----
35-
| | | | ingested | moved | written | | amp | val sep
36-
level | tables size val-bl vtables | score ff cff | in | tables size | tables size | tables size | read | r w | refsz valblk
37-
------+-----------------------------+----------------+-------+--------------+--------------+--------------+-------+----------+--------------
38-
0 | 0 0B 0B 0 | - 0 0 | 4.5MB | 0 0B | 0 0B | 3 6.0MB | 0B | 0 1.32 | 0B 0B
39-
1 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0 | 0B 0B
40-
2 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0 | 0B 0B
41-
3 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0 | 0B 0B
42-
4 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0 | 0B 0B
43-
5 | 0 0B 0B 0 | - 0 0 | 0B | 0 0B | 0 0B | 0 0B | 0B | 0 0 | 0B 0B
44-
6 | 3 6.0MB 0B 0 | - 0.09 0.09 | 0B | 0 0B | 3 6.0MB | 0 0B | 0B | 1 0 | 0B 0B
45-
total | 3 6.0MB 0B 0 | - - - | 4.5MB | 0 0B | 3 6.0MB | 3 10MB | 0B | 1 2.32 | 0B 0B
46-
--------------------------------------------------------------------------------------------------------------------------------------------
47-
WAL: 1 files (0B) in: 4.5MB written: 4.5MB (0% overhead)
48-
Flushes: 2
49-
Compactions: 3 estimated debt: 0B in progress: 0 (0B) canceled: 0 (0B) failed: 0 problem spans: 0
50-
default: 0 delete: 0 elision: 0 move: 3 read: 0 tombstone-density: 0 rewrite: 0 copy: 0 multi-level: 0 blob-file-rewrite: 0
51-
MemTables: 1 (512KB) zombie: 1 (512KB)
52-
Zombie tables: 0 (0B, local: 0B)
53-
Backing tables: 0 (0B)
54-
Virtual tables: 0 (0B)
55-
Local tables size: 6.0MB
56-
Compression types: snappy: 3
57-
Table stats: all loaded
58-
Block cache: 1.5K entries (6.4MB) hit rate: 60.0%
59-
File cache: 3 tables, 0 blobfiles (840B) hit rate: 90.0%
60-
Range key sets: 0 Tombstones: 0 Total missized tombstones encountered: 0
61-
Snapshots: 0 earliest seq num: 0
62-
Table iters: 0
63-
Filter utility: 0.0%
64-
Ingestions: 0 as flushable: 0 (0B in 0 tables)
65-
Cgo memory usage: 0B block cache: 0B (data: 0B, maps: 0B, entries: 0B) memtables: 0B
35+
LSM | vtables | value sep | | ingested | amp
36+
level size | tables size | count size | refsz valblk | in | tables size | r w
37+
-----------------+--------------+--------------+---------------+--------+--------------+----------
38+
0 0 B | 0 0 B | 0 0 | 0 B 0 B | 4.5 Mi | 0 0 B | 0 1.32
39+
1 0 B | 0 0 B | 0 0 | 0 B 0 B | 0 B | 0 0 B | 0 0
40+
2 0 B | 0 0 B | 0 0 | 0 B 0 B | 0 B | 0 0 B | 0 0
41+
3 0 B | 0 0 B | 0 0 | 0 B 0 B | 0 B | 0 0 B | 0 0
42+
4 0 B | 0 0 B | 0 0 | 0 B 0 B | 0 B | 0 0 B | 0 0
43+
5 0 B | 0 0 B | 0 0 | 0 B 0 B | 0 B | 0 0 B | 0 0
44+
total 6 MiB | 3 6 MiB | 0 0 | 0 B 0 B | 0 B | 0 0 B | 1 0
45+
--------------------------------------------------------------------------------------------------
46+
COMPACTIONS | moved | multilevel | read | written
47+
level | score ff cff | tables size | top in read | tables blob | tables sstsz blobsz
48+
------+-------------------+--------------+-------------------+--------------+---------------------
49+
0 | 0 0 0 | 0 0 B | 0 B 0 B 0 B | 0 B 0 B | 3 6 MiB 0 B
50+
1 | 0 0 0 | 0 0 B | 0 B 0 B 0 B | 0 B 0 B | 0 0 B 0 B
51+
2 | 0 0 0 | 0 0 B | 0 B 0 B 0 B | 0 B 0 B | 0 0 B 0 B
52+
3 | 0 0 0 | 0 0 B | 0 B 0 B 0 B | 0 B 0 B | 0 0 B 0 B
53+
4 | 0 0 0 | 0 0 B | 0 B 0 B 0 B | 0 B 0 B | 0 0 B 0 B
54+
5 | 0 0 0 | 0 0 B | 0 B 0 B 0 B | 0 B 0 B | 0 0 B 0 B
55+
total | 0 0.09 0.09 | 3 6 MiB | 0 B 0 B 0 B | 0 B 0 B | 0 0 B 0 B
56+
--------------------------------------------------------------------------------------------------
57+
kind | default delete elision move read tomb rewrite copy multi
58+
count | 0 0 0 3 0 0 0 0 0
59+
--------------------------------------------------------------------------------------------------
60+
COMMIT PIPELINE
61+
wals | memtables | ingestions
62+
files | written | overhead | flushes | live | zombie | total | flushable
63+
----------+------------+-----------+-----------+------------+------------+-----------+------------
64+
1 (0B) | 4.5MB: 4.5 | 0.0% | 2 | 1 (512KB) | 1 (512KB) | 9.5M | 0 (0B)
65+
--------------------------------------------------------------------------------------------------
66+
ITERATORS
67+
block cache | file cache | filter | sst iters | snapshots
68+
entries | hit rate | entries | hit rate | util | open | open
69+
-------------+-------------+--------------+-------------+--------------+-------------+------------
70+
1.5K (6.4MB) | 60.0% | 3 (840B) | 90.0% | 0.0% | 0 | 0
71+
--------------------------------------------------------------------------------------------------
72+
FILES tables | blob files | blob values
73+
stats prog | backing | zombie | loc zomb | live | zombie | total | refed | refed %
74+
--------------+-----------+-----------+-----------+---------+----------+--------+--------+--------
75+
all loaded | 0B (0) | 0B (0) | 0B | 0 (0B) | 0 (0B) | 0B | 0B | 0%
76+
--------------------------------------------------------------------------------------------------
77+
CGO MEMORY | block cache | memtables
78+
tot | tot | data | maps | ents | tot
79+
--------------+---------------+----------------+-----------------+-----------------+--------------
80+
0B | 0B | 0B | 0B | 0B | 0B
81+
--------------------------------------------------------------------------------------------------
82+
COMPACTIONS
83+
estimated debt | in progress | cancelled | failed | problem spans
84+
------------------+-------------------+-------------------+-------------------+-------------------
85+
0B | 0 (0B) | 0 (0B) | 0 | 0
86+
--------------------------------------------------------------------------------------------------
87+
KEYS
88+
range keys | tombstones | missized tombstones | point dels | range dels
89+
-----------------+------------------+--------------------------+-----------------+----------------
90+
0 | 0 | 0 | 0B | 0B
91+
--------------------------------------------------------------------------------------------------
92+
COMPRESSION
93+
snappy: 3

0 commit comments

Comments
 (0)