diff options
author | Péter Szilágyi <peterke@gmail.com> | 2015-06-23 18:03:33 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2015-06-24 23:34:04 +0800 |
commit | 792b0ddccdf135a8d9c33298bcb20d7bafb79a0b (patch) | |
tree | 0254dbf9674fb0750a1607968ace4a11019aa721 /eth | |
parent | 6260b86c153abfd1d4c96fa558ed20e80c6c0e4b (diff) | |
download | dexon-792b0ddccdf135a8d9c33298bcb20d7bafb79a0b.tar.gz dexon-792b0ddccdf135a8d9c33298bcb20d7bafb79a0b.tar.zst dexon-792b0ddccdf135a8d9c33298bcb20d7bafb79a0b.zip |
core, eth, eth/fetcher, ethdb: polish metrics gathering a bit
Diffstat (limited to 'eth')
-rw-r--r-- | eth/backend.go | 19 | ||||
-rw-r--r-- | eth/fetcher/fetcher.go | 10 |
2 files changed, 24 insertions, 5 deletions
diff --git a/eth/backend.go b/eth/backend.go index 37fe66abf..5969c238c 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -29,6 +29,7 @@ import ( "github.com/ethereum/go-ethereum/p2p/discover" "github.com/ethereum/go-ethereum/p2p/nat" "github.com/ethereum/go-ethereum/whisper" + "github.com/rcrowley/go-metrics" ) const ( @@ -248,14 +249,32 @@ func New(config *Config) (*Ethereum, error) { if err != nil { return nil, fmt.Errorf("blockchain db err: %v", err) } + blockDb.(*ethdb.LDBDatabase).GetMeter = metrics.GetOrRegisterMeter("eth/db/block/Gets", metrics.DefaultRegistry) + blockDb.(*ethdb.LDBDatabase).PutMeter = metrics.GetOrRegisterMeter("eth/db/block/Puts", metrics.DefaultRegistry) + blockDb.(*ethdb.LDBDatabase).DelMeter = metrics.GetOrRegisterMeter("eth/db/block/Dels", metrics.DefaultRegistry) + blockDb.(*ethdb.LDBDatabase).ReadMeter = metrics.GetOrRegisterMeter("eth/db/block/Reads", metrics.DefaultRegistry) + blockDb.(*ethdb.LDBDatabase).WriteMeter = metrics.GetOrRegisterMeter("eth/db/block/Writes", metrics.DefaultRegistry) + stateDb, err := newdb(filepath.Join(config.DataDir, "state")) if err != nil { return nil, fmt.Errorf("state db err: %v", err) } + stateDb.(*ethdb.LDBDatabase).GetMeter = metrics.GetOrRegisterMeter("eth/db/state/Gets", metrics.DefaultRegistry) + stateDb.(*ethdb.LDBDatabase).PutMeter = metrics.GetOrRegisterMeter("eth/db/state/Puts", metrics.DefaultRegistry) + stateDb.(*ethdb.LDBDatabase).DelMeter = metrics.GetOrRegisterMeter("eth/db/state/Dels", metrics.DefaultRegistry) + stateDb.(*ethdb.LDBDatabase).ReadMeter = metrics.GetOrRegisterMeter("eth/db/state/Reads", metrics.DefaultRegistry) + stateDb.(*ethdb.LDBDatabase).WriteMeter = metrics.GetOrRegisterMeter("eth/db/state/Writes", metrics.DefaultRegistry) + extraDb, err := newdb(filepath.Join(config.DataDir, "extra")) if err != nil { return nil, fmt.Errorf("extra db err: %v", err) } + extraDb.(*ethdb.LDBDatabase).GetMeter = metrics.GetOrRegisterMeter("eth/db/extra/Gets", metrics.DefaultRegistry) + extraDb.(*ethdb.LDBDatabase).PutMeter = metrics.GetOrRegisterMeter("eth/db/extra/Puts", metrics.DefaultRegistry) + extraDb.(*ethdb.LDBDatabase).DelMeter = metrics.GetOrRegisterMeter("eth/db/extra/Dels", metrics.DefaultRegistry) + extraDb.(*ethdb.LDBDatabase).ReadMeter = metrics.GetOrRegisterMeter("eth/db/extra/Reads", metrics.DefaultRegistry) + extraDb.(*ethdb.LDBDatabase).WriteMeter = metrics.GetOrRegisterMeter("eth/db/extra/Writes", metrics.DefaultRegistry) + nodeDb := filepath.Join(config.DataDir, "nodes") // Perform database sanity checks diff --git a/eth/fetcher/fetcher.go b/eth/fetcher/fetcher.go index 13c65121b..07a32b9f1 100644 --- a/eth/fetcher/fetcher.go +++ b/eth/fetcher/fetcher.go @@ -126,11 +126,11 @@ func New(getBlock blockRetrievalFn, validateBlock blockValidatorFn, broadcastBlo chainHeight: chainHeight, insertChain: insertChain, dropPeer: dropPeer, - announceMeter: metrics.GetOrRegisterMeter("eth/RemoteAnnounces", metrics.DefaultRegistry), - announceTimer: metrics.GetOrRegisterTimer("eth/LocalAnnounces", metrics.DefaultRegistry), - broadcastMeter: metrics.GetOrRegisterMeter("eth/RemoteBroadcasts", metrics.DefaultRegistry), - broadcastTimer: metrics.GetOrRegisterTimer("eth/LocalBroadcasts", metrics.DefaultRegistry), - discardMeter: metrics.GetOrRegisterMeter("eth/DiscardedBlocks", metrics.DefaultRegistry), + announceMeter: metrics.GetOrRegisterMeter("eth/sync/RemoteAnnounces", metrics.DefaultRegistry), + announceTimer: metrics.GetOrRegisterTimer("eth/sync/LocalAnnounces", metrics.DefaultRegistry), + broadcastMeter: metrics.GetOrRegisterMeter("eth/sync/RemoteBroadcasts", metrics.DefaultRegistry), + broadcastTimer: metrics.GetOrRegisterTimer("eth/sync/LocalBroadcasts", metrics.DefaultRegistry), + discardMeter: metrics.GetOrRegisterMeter("eth/sync/DiscardedBlocks", metrics.DefaultRegistry), } } |