AleoNet / snarkOS

A Decentralized Operating System for ZK Applications
http://snarkos.org
Apache License 2.0
4.24k stars 2.59k forks source link

Adding transaction types and aborted transactions/solutions to metrics #3216

Closed miazn closed 3 months ago

miazn commented 3 months ago

Motivation

It's useful to have more granular metrics as to what types of transactions are included in blocks, as well as aborted transactions and solutions.

This pr adds 6 new metrics:

1. Accepted Deploy
2. Accepted Execute
3. Rejected Deploy
4. Rejected Execute
5. Aborted Transactions
6. Aborted Solutions

I did not yet remove the existing confirmed transactions (which we can get by summing the accepted deploys and executes), but that would probably be best to avoid duplicate data (can sum in post processing for analysis).

Test Plan

Screenshot 2024-04-11 at 3 42 45 PM

Still testing to get all types recorded

miazn commented 3 months ago

@ljedrz is there a more optimal way to do the enum matching?

ljedrz commented 3 months ago

Was this found to be slow? Enum matching on its own shouldn't be a big deal, it's the mutable borrows that e.g. disallow parallel processing; if the iteration needs to be faster, the counters can be made atomic, then the _muts can be dropped from the gets, and the iteration can be parallelized with rayon.

miazn commented 3 months ago

after discussing with @iamalwaysuncomfortable , we decided it might make the most sense to move the metrics related functions to the actual metrics crate. This makes it possible to import rayon optionally when metrics is enabled and serial is disabled , as well as the added bonus of cleaning up protocol logic code

howardwu commented 3 months ago

thanks for making the change!