stacks-network / stacks-core

The Stacks blockchain implementation
https://docs.stacks.co
GNU General Public License v3.0
3.01k stars 667 forks source link

Log analysis tool #4929

Closed obycode closed 1 month ago

obycode commented 3 months ago

From various times debugging issues in our naka-1 testnet, I've found that it could be useful to have a tool to help me comb through the logs to figure out what is going on. This tool would take in a log file (text) and generate a sequence diagram showing the various activities of Bitcoin, the Stacks miner, and the signers. For starters, something like this could be helpful:

sequenceDiagram
    participant bitcoin
    participant miner
    participant signer
    bitcoin->>miner: Burn block 7635, winner commits to 95107
    miner->>signer: Propose block 95107
    miner->>bitcoin: Submit block commit, committing to 95107
    signer->>miner: Request block validation
    miner->>signer: Block validated
    signer-xminer: Block signed
    bitcoin->>miner: Burn block 7636, winner commits to 95107
obycode commented 3 months ago

Most of the useful information is directly in a single log, but some of it would need to be accumulated (e.g. identifying the block that a block-commit is confirming).

obycode commented 3 months ago

This example is using mermaid.

obycode commented 3 months ago

Somehow adding timestamps would be very helpful, both to understand the timing between events, and to map back into the logs.

ASuciuX commented 1 month ago

I have completed the setup of the tool, making it dev-friendly by updating its naming conventions, code structure, and documentation in the README. I believe this issue can be closed. If any specific needs arise in the future, I can make the necessary changes to the tool. Additionally, the steps to follow are straightforward, so others can easily make modifications as needed.

The tool can be found here https://github.com/hirosystems/log-analysis-tool. If there is anything else needed to finish the tool setup, please let me know.

obycode commented 1 month ago

Thanks @ASuciuX.