Skip to content
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

[WIP] State Tracing #92

Closed
wants to merge 15 commits into from
Closed

[WIP] State Tracing #92

wants to merge 15 commits into from

Conversation

insipx
Copy link
Collaborator

@insipx insipx commented Sep 2, 2020

Preliminary state tracing support for native runtimes

related:
paritytech/substrate#6916
paritytech/substrate#5826
paritytech/substrate#6672

@insipx insipx changed the title State Tracing [WIP] State Tracing Sep 2, 2020
@insipx insipx mentioned this pull request Oct 13, 2020
Copy link
Contributor

@dvdplm dvdplm left a comment

Choose a reason for hiding this comment

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

Left some nitpicks. I have a hard time seeing where this is heading and I could use a better description; it seems like this PR doesn't doesn't store the traces anywhere?
I am also a little concerned about having to fork polkadot for this – what do we need from upstream to reach a stable point? After all our end goal here is to provide a production quality state tracing tool so it's critical that we have a good maintenance story and a stable situation upstream. Can you elaborate a bit on what the plan is?

tempfile = "3.1.0"
async-executor = "0.1.2"
arc-swap = "0.4.7"
sp-database = { git = "https://github.com/paritytech/substrate", package="sp-database" , rev = "35fe3cd1bc4b64cadb0bc6196ae40173db65bb28" }
Copy link
Contributor

Choose a reason for hiding this comment

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

rev 35fe3cd1bc4b64cadb0bc6196ae40173db65bb28 is rather old (Aug 26) – what is stopping us from using master or 2.0, i.e. what motivated the change?

Comment on lines +29 to +31
pub KsmExec,
ksm_rt::api::dispatch,
ksm_rt::native_version,
Copy link
Contributor

Choose a reason for hiding this comment

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

funny whitespace

Comment on lines +226 to +230
v => {
if v? == 0 {
smol::Timer::new(std::time::Duration::from_millis(3600)).await;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can do something like

Ok(v) if v == 0 => { … … },
Ok(_) => {} // but maybe we want to log something here?
Err(FailedLoadingJob) => { … … }

Not sure if it's better, but sometimes explicit is good.

use sc_tracing::{SpanDatum, TraceEvent, TraceHandler, ProfilingSubscriber};
use xtra::prelude::*;

const TRACE_TARGETS: &str = "assets,atomic-swap,aura,authority-discovery,authorship, \
Copy link
Contributor

Choose a reason for hiding this comment

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

How do we obtain this list? Can we do anything smart here? Can we stick them in a toml file at least? Ideally we should have an RPC to ask the node about the supported targets.

Comment on lines +43 to +48
log::info!("Got message");
println!("Outside");
if let Some(a) = self.addr.as_ref() {
println!("Inside");
let _ = a.do_send(SpanMessage(sd));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

funny whitespace and spurious println?

let sub = ProfilingSubscriber::new_with_handler(Box::new(self.clone()), TRACE_TARGETS);
let addr = ctx.address().expect("Actor just started");
self.addr = Some(addr);
tracing::subscriber::set_global_default(sub).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

Use expect

@@ -125,8 +132,8 @@ fn execution_strategies() -> ExecutionStrategies {
ExecutionStrategies {
syncing: ExecutionStrategy::NativeElseWasm,
importing: ExecutionStrategy::NativeElseWasm,
block_construction: ExecutionStrategy::NativeElseWasm,
offchain_worker: ExecutionStrategy::NativeWhenPossible,
block_construction: ExecutionStrategy::NativeWhenPossible,
Copy link
Contributor

Choose a reason for hiding this comment

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

dumb q: how is NativeWhenPossible different from NativeElseWasm?

@insipx insipx mentioned this pull request Nov 18, 2020
5 tasks
@insipx
Copy link
Collaborator Author

insipx commented Nov 18, 2020

Closing in favor of #134

@insipx insipx closed this Nov 18, 2020
@insipx insipx deleted the state-tracing branch June 25, 2021 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants