-
Notifications
You must be signed in to change notification settings - Fork 671
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: Prometheus Block Fullness Metrics #3025
Merged
Merged
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
a7c0002
add hooks for promulgating "read"
3b9a805
added other components to the cost
01975a1
try the conversion from u64 to i64
e3fca43
fix build with TryInto
6c41bfe
forgot to format
af311cc
changed the prometheus names
eaa4a3a
saturate the limits
b2700c4
getting block limit into the prometheus thing
4cf99f3
use percentages
7fa6bcb
was failing fullness
fde5901
make prefix stacks_node_last_block_*
ba45e6f
kantai's suggestion for src/chainstate/stacks/db/blocks.rs
gregorycoppola 4be27a3
Merge branch 'develop' into feat/prometheus-fullness
b88d8ce
collapse the "check mempool feature" checks
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,12 +28,14 @@ use crate::{ | |
}, | ||
}; | ||
use burnchains::BurnchainSigner; | ||
use std::convert::TryInto; | ||
use std::error::Error; | ||
use std::sync::atomic::{AtomicUsize, Ordering}; | ||
use std::sync::Mutex; | ||
use util::db::sqlite_open; | ||
use util::db::Error as DatabaseError; | ||
use util::uint::{Uint256, Uint512}; | ||
use vm::costs::ExecutionCost; | ||
|
||
#[cfg(feature = "monitoring_prom")] | ||
mod prometheus; | ||
|
@@ -104,6 +106,28 @@ pub fn increment_btc_blocks_received_counter() { | |
prometheus::BTC_BLOCKS_RECEIVED_COUNTER.inc(); | ||
} | ||
|
||
/// Log `execution_cost` as a ratio of `block_limit`. | ||
#[allow(unused_variables)] | ||
pub fn set_last_execution_cost_observed( | ||
execution_cost: &ExecutionCost, | ||
block_limit: &ExecutionCost, | ||
) { | ||
#[cfg(feature = "monitoring_prom")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a way to just group all of these statements inside a single
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. did this |
||
prometheus::LAST_BLOCK_READ_COUNT | ||
.set(execution_cost.read_count as f64 / block_limit.read_count as f64); | ||
#[cfg(feature = "monitoring_prom")] | ||
prometheus::LAST_BLOCK_WRITE_COUNT | ||
.set(execution_cost.write_count as f64 / block_limit.read_count as f64); | ||
#[cfg(feature = "monitoring_prom")] | ||
prometheus::LAST_BLOCK_READ_LENGTH | ||
.set(execution_cost.read_length as f64 / block_limit.read_length as f64); | ||
#[cfg(feature = "monitoring_prom")] | ||
prometheus::LAST_BLOCK_WRITE_LENGTH | ||
.set(execution_cost.write_length as f64 / block_limit.write_length as f64); | ||
#[cfg(feature = "monitoring_prom")] | ||
prometheus::LAST_BLOCK_RUNTIME.set(execution_cost.runtime as f64 / block_limit.runtime as f64); | ||
} | ||
|
||
pub fn increment_btc_ops_sent_counter() { | ||
#[cfg(feature = "monitoring_prom")] | ||
prometheus::BTC_OPS_SENT_COUNTER.inc(); | ||
|
@@ -397,6 +421,7 @@ pub fn set_burnchain_signer(signer: BurnchainSigner) -> Result<(), SetGlobalBurn | |
Ok(()) | ||
} | ||
|
||
#[allow(unreachable_code)] | ||
pub fn get_burnchain_signer() -> Option<BurnchainSigner> { | ||
#[cfg(feature = "monitoring_prom")] | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Not sure if setting
block_limit
toExecutionCost::max_value()
in the case of an error makes sense...Could we at least add a warn if there is an error here?
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.
hmm... what would it mean if
block_limit()
failed?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.
It would mean that a transaction was currently being evaluated. I don't think it's possible in this code path, but it'd be good to warn --