forked from cerc-io/plugeth
ethdb, internal/ethapi: support exposing Pebble stats too, beside LevelDB (#28224)
ethdb, internal/ethapi: support exposing Pebble stats too, besinde LevelDB
This commit is contained in:
parent
b9450bfcca
commit
f988b2332e
@ -22,6 +22,7 @@ package leveldb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@ -245,6 +246,11 @@ func (db *Database) NewSnapshot() (ethdb.Snapshot, error) {
|
||||
|
||||
// Stat returns a particular internal stat of the database.
|
||||
func (db *Database) Stat(property string) (string, error) {
|
||||
if property == "" {
|
||||
property = "leveldb.stats"
|
||||
} else if !strings.HasPrefix(property, "leveldb.") {
|
||||
property = "leveldb." + property
|
||||
}
|
||||
return db.db.GetProperty(property)
|
||||
}
|
||||
|
||||
|
@ -379,9 +379,12 @@ func upperBound(prefix []byte) (limit []byte) {
|
||||
return limit
|
||||
}
|
||||
|
||||
// Stat returns a particular internal stat of the database.
|
||||
// Stat returns the internal metrics of Pebble in a text format. It's a developer
|
||||
// method to read everything there is to read independent of Pebble version.
|
||||
//
|
||||
// The property is unused in Pebble as there's only one thing to retrieve.
|
||||
func (d *Database) Stat(property string) (string, error) {
|
||||
return "", nil
|
||||
return d.db.Metrics().String(), nil
|
||||
}
|
||||
|
||||
// Compact flattens the underlying data store for the given key range. In essence,
|
||||
|
@ -2191,11 +2191,6 @@ func (api *DebugAPI) PrintBlock(ctx context.Context, number uint64) (string, err
|
||||
|
||||
// ChaindbProperty returns leveldb properties of the key-value database.
|
||||
func (api *DebugAPI) ChaindbProperty(property string) (string, error) {
|
||||
if property == "" {
|
||||
property = "leveldb.stats"
|
||||
} else if !strings.HasPrefix(property, "leveldb.") {
|
||||
property = "leveldb." + property
|
||||
}
|
||||
return api.b.ChainDb().Stat(property)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user