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

Add support for wasm runtime metrics try #2 #4483

Merged
merged 67 commits into from
Dec 16, 2021

Conversation

sandreim
Copy link
Contributor

@sandreim sandreim commented Dec 7, 2021

Fixes #4383

Companion for paritytech/substrate#10440

skip check-dependent-cumulus

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
@github-actions github-actions bot added the A3-in_progress Pull request is in progress. No review needed at this stage. label Dec 7, 2021
@sandreim sandreim requested a review from drahnr December 7, 2021 16:46
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.

I like the approach with a second order function 👍

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
node/metrics/src/runtime.rs Outdated Show resolved Hide resolved
cli/src/cli.rs Outdated Show resolved Hide resolved
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
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, a few small nits, but looks good overall. Encapsulating the metrics boilerplate is going to be addressed in a follow up PR.

node/metrics/src/runtime.rs Show resolved Hide resolved
where
F: FnOnce(MutexGuard<'_, HashMap<String, Counter<U64>>>) -> Result<(), PrometheusError>,
{
let _ = self.1.counters.lock().map(do_something).or_else(|error| {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: map_err is a mild improvement

node/metrics/src/tests.rs Show resolved Hide resolved
runtime/parachains/src/paras_inherent/mod.rs Show resolved Hide resolved
runtime/parachains/src/paras_inherent/mod.rs Outdated Show resolved Hide resolved
scripts/gitlab/test_linux_stable.sh Show resolved Hide resolved
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
runtime/parachains/src/paras_inherent/mod.rs Outdated Show resolved Hide resolved
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
@TriplEight TriplEight self-requested a review December 15, 2021 16:23
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
@ordian ordian added the D5-nicetohaveaudit ⚠️ PR contains trivial changes to logic that should be properly reviewed. label Dec 15, 2021
runtime/metrics/src/std.rs Outdated Show resolved Hide resolved
runtime/metrics/src/lib.rs Outdated Show resolved Hide resolved
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
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.

One last nitpick

primitives/src/v1/metrics.rs Show resolved Hide resolved
sandreim and others added 4 commits December 16, 2021 11:08
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
@paritytech-processbot
Copy link

Waiting for commit status.

@paritytech-processbot paritytech-processbot bot merged commit f2802d7 into master Dec 16, 2021
@paritytech-processbot paritytech-processbot bot deleted the sandreim/runtime_metrics_try2 branch December 16, 2021 11:56
drahnr pushed a commit that referenced this pull request Dec 16, 2021
* Add runtime metrics provider

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Runner changes

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Some sample metrics in paras_inherent

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* update cargo toml

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* fmt

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* bug

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* more fmt after merge

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Refactor metric prefix override

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* fmt

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* remove bug comment

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Add runtime metric primitives

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Impl trace event parsing

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Update metrics

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* cargo lock

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* fmt

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Fix target check

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Runtime metrics primitives

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Review feedback

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Runtime metrics crate

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Node side runtime metric changes

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* use runtime CounterVec instead of macro

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* fmt nice

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* remove dead code

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* base58 decoding

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* base58 encoding

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* fix warn

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* typo

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Review feedback

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Finish label support

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* fmt

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* please compile

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* add feature gate

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* fmt

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Comment cargo toml

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Fix cargo toml description

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Update doc.

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* switch to `runtime-metrics` feature

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* fmt

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* cargo toml

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* fix tests

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* fixes

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* better ux

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* from_utf8_unchecked is safe

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* fmt

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Add Counter and refactor

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Fixes

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* review fixes

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* more fixes

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* add integration test

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* dev deps

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* gitlab script update

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* review fixes

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* fix merge damage

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Run tests twice

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* small fix

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* typo

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* cargo lock

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* tests

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* spellcheck happy ?

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* more fixes

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* Guard tracing init

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* missing copyright

Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>

* update lockfile for substrate

Co-authored-by: parity-processbot <>
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. C1-low PR touches the given topic and has a low impact on builders. D5-nicetohaveaudit ⚠️ PR contains trivial changes to logic that should be properly reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

runtime metrics: allow the runtime to provide metrics info
6 participants