Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Add prometheus metrics for block authorship#10316

Merged
paritytech-processbot[bot] merged 7 commits intomasterfrom
zeke-add-create-inherent-prom-metric
Nov 19, 2021
Merged

Add prometheus metrics for block authorship#10316
paritytech-processbot[bot] merged 7 commits intomasterfrom
zeke-add-create-inherent-prom-metric

Conversation

@emostov
Copy link
Contributor

@emostov emostov commented Nov 19, 2021

closes paritytech/polkadot#4327

New metrics:

  • proposer_block_proposal_time: Time to create a block for proposal. This is a superset of both proposer_block_constructed and create_inherents_time.
  • proposer_create_inherents_time: Time to create the inherents for the block that is about to be constructed. This is a subset of proposer_block_proposal_time but does not overlap with proposer_block_constructed.

Existing metrics:

  • proposer_block_constructed: Time to construct a block for proposal. This is a subset of proposer_block_proposal_time and does not overlap with propser_create_inherents_time
  • block_verification_time: Time to verify a block (takes place directly prior to importing)
  • block_verification_and_import_time: Time to verify a block and then import a block. A superset of block_verification_time

@github-actions github-actions bot added the A0-please_review Pull request needs code review. label Nov 19, 2021
@emostov emostov changed the title Add prom metrics for block authorship and execution Add prometheus metrics for block authorship Nov 19, 2021
@emostov emostov added B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. labels Nov 19, 2021
self.metrics.report(|metrics| {
metrics
.create_inherents_time
.observe(create_inherents_timer.elapsed().as_secs_f64());
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
.observe(create_inherents_timer.elapsed().as_secs_f64());
.observe(create_inherents_timer.elapsed().as_secs_f64());

Please use saturating_duration_since here and below. We already have seen that calls like this panicked because of some fault timers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in f7ca1df

Copy link
Contributor

@drahnr drahnr left a comment

Choose a reason for hiding this comment

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

LGTM besides the mentioned need to use https://doc.rust-lang.org/std/time/struct.Instant.html#method.saturating_duration_since rather than fn elapsed(..)

Copy link
Member

@bkchr bkchr left a comment

Choose a reason for hiding this comment

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

We need to change the order, otherwise looks good.

emostov and others added 3 commits November 19, 2021 15:23
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
@drahnr
Copy link
Contributor

drahnr commented Nov 19, 2021

bot merge

@paritytech-processbot
Copy link

Waiting for commit status.

@paritytech-processbot paritytech-processbot bot merged commit cdcf872 into master Nov 19, 2021
@paritytech-processbot paritytech-processbot bot deleted the zeke-add-create-inherent-prom-metric branch November 19, 2021 15:14
grishasobol pushed a commit to gear-tech/substrate that referenced this pull request Mar 28, 2022
* Add prom metric  to basic authorship

* Add proposer_block_proposal_time

* +nightly-2021-10-29 fmt

* Use saturating_duration_since, not elasped

* Update client/basic-authorship/src/basic_authorship.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/basic-authorship/src/basic_authorship.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* +nightly-2021-10-29 fmt

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
ark0f pushed a commit to gear-tech/substrate that referenced this pull request Feb 27, 2023
* Add prom metric  to basic authorship

* Add proposer_block_proposal_time

* +nightly-2021-10-29 fmt

* Use saturating_duration_since, not elasped

* Update client/basic-authorship/src/basic_authorship.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/basic-authorship/src/basic_authorship.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* +nightly-2021-10-29 fmt

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create metric for block creation/create_inherent time

3 participants