-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com>
Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com>
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.
What do you think of naming it group
instead of subsystem? Because in the end it is something to group different tasks?
Sounds better, indeed we just want to group by. |
Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com>
Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com>
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>
…bstrate into per_subsystem_task_metrics Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
…system_task_metrics
Synced offline with @bkchr and decided to drop the new trait methods and just add a the group to the existing spawn() methods. |
Signed-off-by: Andrei Sandu <andrei-mihail@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.
Same as paritytech/polkadot#4239 (comment)
You might also need cargo +nightly fmt
.
Yep, this seems odd, there is a version mismatch of some sort. I'll rerun. |
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
- use Option group name in SpawnNamed methods - switch to kebab case - implement default group name - add group name to some tasks Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
pub fn spawn( | ||
&self, | ||
name: &'static str, | ||
group: Option<&'static str>, |
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.
Something like:
enum GroupName {
Default,
Specific(&'static str),
}
impl From<Option<&'static str>> for GroupName {
fn from(name: Option<&'static str>) -> Self {
match name { Some(name) => Self::Specific(name), None => Self::Default }
}
}
impl From<&'static str> for GroupName {
fn from(name: &'static str) -> Self {
Self::Specific(name)
}
}
would have been super cool :P
Because then you could write:
pub fn spawn(.., group: impl Into<GroupName>, ..)
And stuff like spawn(.., "name", ..)
or spawn(.., None, ..)
should work :P
This would maybe be the icing on the top, but no requirement.
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.
Yup, you are right, that's more flexible. I'll implement this as a followup PR, at the moment I'm tackling other things.
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.
Sounds like an easy issue for external contributors :)
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.
Picking the issue up @ordian
bot merge |
Error: Waiting on code owner review from tomusdrw. |
bot merge |
* master: (27 commits) Bump rustversion from 1.0.4 to 1.0.5 (#10243) Kill the light client, CHTs and change tries. (#10080) tuple to struct event variants (#10206) Bump thiserror from 1.0.26 to 1.0.30 (#10240) Warn about usage of pallet collective set members call. (#10156) Bump git2 from 0.13.22 to 0.13.23 (#10238) Add group name in task metrics (#10196) Bump proc-macro-crate from 1.0.0 to 1.1.0 (#10237) Bump parity-util-mem from 0.10.0 to 0.10.2 (#10236) Bump substrate-bip39 from 0.4.2 to 0.4.4 (#10213) Upgrade jsonrpsee to v0.4.1 (#10022) expose substrate-cli service (#10229) Intend to reactivate cargo-unleash check (#10167) CI: build docs with deps (#9884) use CountedMap in pallet-bags-list (#10179) Move all example pallets under `examples` folder. (#10215) Upgrade wasm builder (#10226) upgrade ss58-registry with additional networks. (#10224) move wiki -> docs (#10225) new remote-ext mode: (#10192) ...
* SpawnNamed: add new trait methods Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * Implement new methods Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * cargo fmt Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * SpawnNamed: add new trait methods Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * Implement new methods Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * cargo fmt Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * New approach - spaw() group param Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Update traits: SpawnNamed and SpawnNamed Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Update TaskManager tests Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Update test TaskExecutor Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Fix typo Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * grunt work: fix spawn() calls Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * cargo fmt Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * remove old code Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * cargo fmt - the right version Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Implement review feedback - use Option group name in SpawnNamed methods - switch to kebab case - implement default group name - add group name to some tasks Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
* SpawnNamed: add new trait methods Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * Implement new methods Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * cargo fmt Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * SpawnNamed: add new trait methods Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * Implement new methods Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * cargo fmt Signed-off-by: Andrei Sandu <sandu.andrei@gmail.com> * New approach - spaw() group param Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Update traits: SpawnNamed and SpawnNamed Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Update TaskManager tests Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Update test TaskExecutor Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Fix typo Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * grunt work: fix spawn() calls Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * cargo fmt Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * remove old code Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * cargo fmt - the right version Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Implement review feedback - use Option group name in SpawnNamed methods - switch to kebab case - implement default group name - add group name to some tasks Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
The subsystem name metric label improves observability of task CPU usage in Grafana - paritytech/polkadot#4198
Added two new spawn methods toSpawnNamed
trait. These allow the caller to also specify asubsystem
name when starting a task. While the change doesn't break any existing API, it changes the way metrics are logged by adding an extra label. All code using the original spawn methods will default to having subsystem set tosubstrate-unspecified
.Added optional group parameter to
SpawnNamed::spawn()
andSpawnNamed::spawn_blocking()
methods.Polkadot companion: paritytech/polkadot#4239
skip check-dependent-cumulus