-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Conversation
It looks like @mattrutherford signed our Contributor License Agreement. 👍 Many thanks, Parity Technologies CLA Bot |
Just updated this PR to use a different way to create tracing spans, rather than rely on a brittle mechanism of pre-registered spans, this way reserves a special span name |
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.
I don't know that much about how tracing works, but looks good to me if it works :)
It works and while not as pure from the POV of tracing, I think it's a better solution for substrate at the moment. |
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.
Last nitpicks, after that we should be okay.
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Ty for your work! :) |
Thanks all for helping get this one done! Made final check with Polkadot master and should be ready to merge now. Just reiterating that this runtime will be incompatible with earlier versions of the client due to the new host functions utilised by it. (Client upgrade is critical on runtime upgrade.) |
hmm... is there no way to make it compatible assuming we're not using the new runtime functions? i can't really merge this any time with our current need to have some degree of release stability and a fairly regular upgrade schedule across two live chains. |
But what is the problem? We just need to make sure we have a node release before applying the runtime upgrade. |
Just to also clarify that the client is compatible with earlier runtime versions (currently syncing Polkadot CC1 with client based from this branch). |
The problem is that we have two production networks with several hundreds of validators between them, as well as a tendency to do runtime upgrades from |
@gavofyork Would you agree to splitting this PR into two? 1st stage include the new host functions and related features in client (minus CLI options). 2nd stage at some point in future we can then add the runtime features to make use of them, also adding the CLI parameters to enable it. This would allow us to give whatever window seems appropriate to allow everyone to upgrade. |
Perfect. |
closing because of inactivity. |
Add
--wasm-tracing
CLI flag to enable tracing from WASM.This must be used in conjunction with
--tracing-targets
(and optionally--tracing-receiver
).Add 2 new host functions to allow tracing span enter and exit. The tracing API requires span
target
andname
to be const, so it's not possible to create spans directly with the actual target and name; instead all are created with a single pre-defined identifier, with the span's fields containing the actual target and name, which is then patched in the tracing Subscriber in client.Each span is stored in the
TracingProxy
along with it's associated guard until a call to exit is received, at which point it's dropped, triggering a span exit call to the tracing Subscriber.Each host function call can take around 300ns, although only the second call will be included in the measurement. The total cost of a wasm trace that's incorporated into the measurement is potentially around 0.4µs.