nomad-xyz / nomad-monorepo

Contracts, off-chain agents, and libraries for Nomad
https://nomad.xyz
78 stars 16 forks source link

indexer: num_* metrics should use global counts #164

Closed yourbuddyconner closed 2 years ago

yourbuddyconner commented 2 years ago

How it is: The indexer counts the number of dispatched/processed/updated/relayed messages since the beginning of the process.

How it should be: The indexer records the global number of dispatched/processed/updated/relayed messages.

Ok to do this incrementally, rather than fetching all events each time these values are updated. (be careful to make sure you're not missing or double-counting any messages if updating incrementally)

Alternative idea: Query the DB for this info such that you don't have to calculate it incrementally.

kekonen commented 2 years ago

It actually always keeps a global count and throws them into the metrics, even if u restart the indexer. The point is also to always test the sequence of updates for home and all replicas (rootA -> rootB, rootB -> rootC, ...) and test for missing events. It is also possible to maintain events in the DB and adjust the integrity test, but it will require some work, which is neither in the scope of prioritized tickets (this and #163) nor causing possible problems with Memory (keeping it all in RAM) or taking time on restart (the most of the time-consuming is to collect block data: timestamps and transactions to track the transfer dispatch tx hash and sender, but it is already in the DB). Yet, I created the issue for this https://github.com/nomad-xyz/nomad-monorepo/issues/184

yourbuddyconner commented 2 years ago

Cool thanks @kekonen, closing this issue as a #wontfix