gnosis / etherbalance

Apache License 2.0
0 stars 4 forks source link

Account specific balance alert threshold #11

Closed bh2smith closed 4 years ago

bh2smith commented 4 years ago

Proposal

Allow to specify low balance threshold for each monitored account.

Motivation

We have reached a point where we are attempting to monitor several accounts with this service. Each of these accounts is submitting different types of transactions for several different purposes (i.e. with varying expected transaction fees at varying frequencies).

Example/Use Case

For example solvers submit solutions and spend lots of gas doing so, while the synthetix liquidity provision bot sparsely places orders on an exchange. This implies that that the classification of a "low balance" in one account might be drastically different from that of another. In order to safely ensure a solver is running with sufficient balance over a long weekend we would consider 4 ETH to be a low balance, while a safety net for synthetix bot is 1 ETH.

e00E commented 4 years ago

I agree that this is nice to have. The question is on what level this should happen. Currently etherbalance just retrieves balances and exports them as prometheus metrics. On the prometheus level we turn the balances into alerts. Currently this happens with one query that we have configured with a fixed cutoff. I'd like to keep the alerting layer separate from etherbalance so I am wondering what a small change in etherbalance would be to facilitate that. My first idea is that we could support a customizable "tag" for each address that we monitor. The tag is forwarded to the metrics. Then in the metrics we can have alerting rules based on the tag. Our current rule

(etherbalance_balance / (10^18)) < 4.0

could be turned into two rules

(etherbalance_balance{tag=solver} / (10^18)) < 4.0
(etherbalance_balance{tag=liquidity-bot} / (10^18)) < 0.5
fleupold commented 4 years ago

I think generally it makes sense to annotate the metrics more generously. We are already tagging the metrics with the address, right? So it would be possible even in the current state to filter this alert by address (I agree having it based on tag would be more convenient).