-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat(cli): add metrics for download command #19870
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
base: main
Are you sure you want to change the base?
Conversation
Rjected
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think adding metrics for this is reasonable, I have a few suggestions
mattsse
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unsure if we have have a prometheus supported for this command
so we should check this as well
crates/cli/commands/src/download.rs
Outdated
| let metrics = DownloadMetrics::global(); | ||
| let overall_start = Instant::now(); | ||
|
|
||
| metrics.downloads_started_total.increment(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this metric is only useful if we make use of this command a lot?
because this command impl only ever does one download
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep removed both - global static is gone and dropped downloads_started_total since it doesn't make sense here
good point about prometheus though, this command doesn't actually expose metrics (no --metrics flag). so kinda pointless right now?
should i just remove them or add the endpoint like stage run has?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should i just remove them or add the endpoint like stage run has?
if the motivation for this pr is to make them observable via prometheus then we should add support for this via a metrics arg imo and launch the prometheus listener if set
- no more global static, just pass it around - removed unused _started_at field - simplified the blocking_download function (no closure needed) - dropped downloads_started_total metric, doesn't make sense here
We're downloading 2TB+ mainnet snapshots that take 48+ hours but had zero visibility into what's happening.
Before:
Downloading and extracting... 42.31% (904.23 GB / 2.08 TB)That's it. No way to track via Prometheus, no failure stats, nothing.
After:
Can now properly monitor downloads:
rate(cli_download_downloaded_bytes_total[1m]) < 10MB)