Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(balances): Support automatic desired balances and alert thresholds based on daily burn approximations #5270

Merged
merged 13 commits into from
Jan 30, 2025

Conversation

Mo-Hussain
Copy link
Contributor

@Mo-Hussain Mo-Hussain commented Jan 23, 2025

Description

  • calculates daily burn based on recent relayer usage, min dollar value targets and a minimum number of tx, check this into monorepo as dailyBurn.json
yarn tsx ./scripts/funding/calculate-relayer-daily-burn.ts
  • Support reading alert thresholds for lowUrgencyKeyFunderBalance, highUrgencyRelayerBalance and writing them to checked in config
yarn tsx ./scripts/funding/read-alert-thresholds.ts -e mainnet3 --alertType highUrgencyRelayerBalance --write
  • Support updating checked in config based on the dailyBurn and multipliers
    image

  • Support writing alert queries to grafana
    image

Note, the configs are not in use at the moment and will be used as we roll this out

Related issues

Backward compatibility

Testing

Manual

@Mo-Hussain Mo-Hussain self-assigned this Jan 23, 2025
Copy link

changeset-bot bot commented Jan 23, 2025

⚠️ No Changeset found

Latest commit: 0bae20d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

codecov bot commented Jan 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.53%. Comparing base (84f886b) to head (0bae20d).
Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5270   +/-   ##
=======================================
  Coverage   77.53%   77.53%           
=======================================
  Files         103      103           
  Lines        2110     2110           
  Branches      190      190           
=======================================
  Hits         1636     1636           
  Misses        453      453           
  Partials       21       21           
Components Coverage Δ
core 87.80% <ø> (ø)
hooks 79.39% <ø> (ø)
isms 83.68% <ø> (ø)
token 91.27% <ø> (ø)
middlewares 79.80% <ø> (ø)

@Mo-Hussain
Copy link
Contributor Author

I have scripts that uses the config to write the alerts into grafana using the API pretty much ready. I wanted to use the opportunity to see how much of a lift it would be to use terraform provisioned alerts. These checked in configs create a nice interface for the grafana API approach vs terraform

Copy link
Collaborator

@tkporter tkporter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As many of the values seem wrong, I think we should have some mechanisms to sanity check them when they're generated, e.g. > 0, ensure that dailyBurn < highUrgencyRelayerBalances < etc

@Mo-Hussain Mo-Hussain force-pushed the mo/balance-threshold-automation branch from 9aac39b to 7cd18a7 Compare January 29, 2025 10:37
Copy link
Contributor

@paulbalaji paulbalaji left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mostly lgtm with some nits / file moving

typescript/infra/config/grafanaAlerts.ts Outdated Show resolved Hide resolved
typescript/infra/scripts/funding/utils/constants.ts Outdated Show resolved Hide resolved
typescript/infra/scripts/funding/utils/grafana.ts Outdated Show resolved Hide resolved
@Mo-Hussain Mo-Hussain force-pushed the mo/balance-threshold-automation branch from 9596932 to 5b47ef3 Compare January 29, 2025 12:52
@Mo-Hussain Mo-Hussain force-pushed the mo/balance-threshold-automation branch from 5b47ef3 to 7570f80 Compare January 29, 2025 12:55
Copy link
Collaborator

@tkporter tkporter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, looking really good - no super huge comments but more trying to understand what to expect after this is merged, like what is the new process for updating an alert atm

@Mo-Hussain Mo-Hussain added this pull request to the merge queue Jan 30, 2025
Merged via the queue into main with commit 57d22cf Jan 30, 2025
44 checks passed
@Mo-Hussain Mo-Hussain deleted the mo/balance-threshold-automation branch January 30, 2025 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants