metrics(app): add app_block_gas_wanted and app_block_gas_wanted_ratio histograms (PLT-354)#3479
Conversation
PR SummaryLow Risk Overview Emits these metrics from Reviewed by Cursor Bugbot for commit 051930a. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3479 +/- ##
==========================================
+ Coverage 59.11% 59.14% +0.02%
==========================================
Files 2187 2186 -1
Lines 182237 181999 -238
==========================================
- Hits 107730 107635 -95
+ Misses 64851 64718 -133
+ Partials 9656 9646 -10
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
| metric.WithUnit("{count}"), | ||
| )), | ||
|
|
||
| blockGasWanted: must(meter.Float64Histogram( |
There was a problem hiding this comment.
nit: does this need to be a float?
There was a problem hiding this comment.
Good point. I will convert to Int64Histogram for better semantics.
bdchatham
left a comment
There was a problem hiding this comment.
Seems like the PR description is slightly stale
Summary
Adds two OTel histogram instruments to make per-block gas utilisation observable — answering "how close are blocks getting to the
MaxGasWantedcap in practice" without offline block parsing.app_block_gas_wanted(Int64Histogram, unit{gas}) — absolutetotalGasWantedsummed across all transactions in an accepted proposalapp_block_gas_wanted_ratio(Float64Histogram, unit1) —totalGasWanted / MaxGasWanted, stays meaningful if the cap is raised via governanceBoth are emitted in
checkTotalBlockGas(app/app.go) on the success path only — the function already short-circuits withreturn falsewhen the sum exceeds the cap, so only complete, accepted totals are recorded. The existingapp_failed_total_gas_wanted_checkcounter covers rejection events.Bucket boundaries:
Closes PLT-354.
Test plan
app_block_gas_wanted_bucketandapp_block_gas_wanted_ratio_bucketappear in the Prometheus scrape. Can use this p50 query in Grafana by runninghistogram_quantile(0.5, rate({__name__="sei-chain_app_block_gas_wanted_ratio_bucket"}[10m]))