Skip to content

Commit

Permalink
fix(metrics): Expose Badger LSM and vlog size bytes. (#7488)
Browse files Browse the repository at this point in the history
Expose the Badger metrics for the lsm tree size and vlog size.

* badger_v3_lsm_size_bytes
* badger_v3_vlog_size_bytes
  • Loading branch information
danielmai authored Mar 2, 2021
1 parent 96073fc commit f21ee36
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions dgraph/cmd/alpha/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ func TestMetrics(t *testing.T) {
"badger_v3_disk_reads_total", "badger_v3_disk_writes_total", "badger_v3_gets_total",
"badger_v3_memtable_gets_total", "badger_v3_puts_total", "badger_v3_read_bytes",
"badger_v3_written_bytes",
// The following metrics get exposed after 1 minute from Badger, so
// they're not available in time for this test
// "badger_v3_lsm_size_bytes", "badger_v3_vlog_size_bytes",

// Transaction Metrics
"dgraph_txn_aborts_total", "dgraph_txn_commits_total", "dgraph_txn_discards_total",
Expand Down
8 changes: 4 additions & 4 deletions x/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -490,13 +490,13 @@ func NewBadgerCollector() prometheus.Collector {
"Total number of memtable gets",
nil, nil,
),
"badger_v3_lsm_size": prometheus.NewDesc(
"badger_v3_lsm_size",
"badger_v3_lsm_size_bytes": prometheus.NewDesc(
"badger_v3_lsm_size_bytes",
"Size of the LSM in bytes",
[]string{"dir"}, nil,
),
"badger_v3_vlog_size": prometheus.NewDesc(
"badger_v3_vlog_size",
"badger_v3_vlog_size_bytes": prometheus.NewDesc(
"badger_v3_vlog_size_bytes",
"Size of the value log in bytes",
[]string{"dir"}, nil,
),
Expand Down

0 comments on commit f21ee36

Please sign in to comment.