-
Notifications
You must be signed in to change notification settings - Fork 924
tx/metrics: Add metrics for the RPC v2 transactionWatch_v1_submitAndWatch
#8345
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: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Just quickly looked into this. How to compute the latency between This would require us to know what was transcation lifecycle? (e.g. We have all the intermediate steps, but don't have a way to compute But I am be missing something at the moment, need to have a second look. |
Yep exactly, and since the submitted -> finalized is an important metric, I'll add it as well thanks for the suggestion 🙏 Believe it would be difficult otherwise to create an accurate dashboard if the transaction state switches between inblock <-> retracted multiple times |
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
I think that what we need is time to event (since submission) for every event type. |
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
All GitHub workflows were cancelled due to failure one of the required jobs. |
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
control Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
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.
LGTM!
|
||
impl Metrics { | ||
/// Creates a new [`Metrics`] instance. | ||
pub fn new(registry: &Registry) -> Result<Self, PrometheusError> { |
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.
nit: it would help a tiny bit mentioning the time unit in the metrics descriptions, while reading the code.
let rpc_v2_metrics = if let Some(registry) = config.prometheus_registry() { | ||
Some(sc_rpc_spec_v2::transaction::TransactionMetrics::new(registry)?) | ||
} else { | ||
None | ||
}; |
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.
nit:
let rpc_v2_metrics = if let Some(registry) = config.prometheus_registry() { | |
Some(sc_rpc_spec_v2::transaction::TransactionMetrics::new(registry)?) | |
} else { | |
None | |
}; | |
let rpc_v2_metrics = config.prometheus_registry().map(|registry| sc_rpc_spec_v2::transaction::TransactionMetrics::new(registry)).transpose()?; |
@@ -529,6 +537,7 @@ where | |||
config.blocks_pruning, | |||
backend.clone(), | |||
&*rpc_builder, | |||
rpc_v2_metrics.clone(), |
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.
Do we need the clone?
let event = handle_event(event); | ||
|
||
if let Some(ref event) = event { | ||
metrics.register_event(event); | ||
} |
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.
nit: inspect maybe could be used?
@olliecorbisiero mentioned you would like that some adjustment of buckets maybe required. We can wait with merge to confirm that buckets are fine. |
"rpc_transaction_in_block_time", | ||
"RPC Transaction in block time", | ||
) | ||
.buckets(linear_buckets(0.0, 3.0, 20).expect("Valid buckets; qed")), |
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.
@olliecorbisiero here are new buckets for in-block.
Buckets for internal pool events (they you are using now in dashboard) were exactly the same:
polkadot-sdk/substrate/client/transaction-pool/src/fork_aware_txpool/metrics.rs
Lines 141 to 147 in 23c41b2
in_block: register( | |
Histogram::with_opts(histogram_opts!( | |
"substrate_sub_txpool_timing_event_in_block", | |
"Histogram of timings for reporting InBlock event", | |
linear_buckets(0.0, 3.0, 20).unwrap() | |
))?, | |
registry, |
Let us know what would work for you?
This PR adds metrics for the following RPC subscription: transactionWatch_v1_submitAndWatch
Metrics are exposed in two ways:
initial event
->final event
Part of: #8336
(outdated) PoC Dashboards
Next steps