cerc-io / go-ethereum

Read-only mirror of https://git.vdb.to/cerc-io/go-ethereum (Statediffing-fork of the official Go implementation of the Ethereum protocol)
https://git.vdb.to/cerc-io/go-ethereum
GNU Lesser General Public License v3.0
13 stars 4 forks source link

Additional statediff metrics and logging. #304

Closed telackey closed 1 year ago

telackey commented 1 year ago

Adds counters and logging for the number of statediff API requests, number of statediffs underway, etc.

We had some fine-grained performance stats related to the indexing of an individual block, which looked like this:

DEBUG[01-12|00:30:41.459] indexer stats for statediff at 79 with hash 0x58ce2c20918b83963bd29cbe2da7a6a4871fa702e7ec762e93012f956152d99b:
time spent waiting for free postgres tx: 1.083651ms:
header processing time: 240.693µs
uncle processing time: 395ns
tx and receipt processing time: 7.131475ms
state, storage, and code storage processing time: 4.819091ms
postgres transaction commit duration: 199.498776ms
 TOTAL PROCESSING DURATION: 217.751966ms

But we lacked a more general information like the number of statediffs performed so far, how many were executing at this moment, and so forth.

Output of the new code looks like:

DEBUG[01-12|00:25:11.148] writeStateDiff BEGIN [underway=1, succeeded=40, failed=0, total_time=47600ms] hash=0x76d921b092b2e6e7d525417263e20e7ec324fdfa26c4eb3a80e32df608ed0a41 number=30
...
DEBUG[01-12|00:25:11.431] writeStateDiff END (duration=282ms, err=false) [underway=0, succeeded=41, failed=0, total_time=47882ms] hash=0x76d921b092b2e6e7d525417263e20e7ec324fdfa26c4eb3a80e32df608ed0a41 number=30

And:

DEBUG[01-12|00:25:06.968] statediff API END (duration=373ms, err=false) [underway=0, requests=12] writeStateDiffAt=1