13 releases (5 stable)

Uses new Rust 2021

5.0.0 Mar 1, 2022
4.0.0 Dec 8, 2021
3.0.0 Feb 10, 2021
2.0.1 Jan 11, 2021
2.0.0-rc5 Jul 24, 2020

#924 in Magic Beans

Download history 2612/week @ 2022-06-04 2219/week @ 2022-06-11 3746/week @ 2022-06-18 3380/week @ 2022-06-25 4319/week @ 2022-07-02 3988/week @ 2022-07-09 4648/week @ 2022-07-16 3792/week @ 2022-07-23 3837/week @ 2022-07-30 5406/week @ 2022-08-06 3694/week @ 2022-08-13 3367/week @ 2022-08-20 3274/week @ 2022-08-27 3418/week @ 2022-09-03 3425/week @ 2022-09-10 2600/week @ 2022-09-17

13,140 downloads per month
Used in 317 crates (8 directly)

Apache-2.0

38KB
746 lines

Substrate tracing primitives and macros.

To trace functions or individual code in Substrate, this crate provides [within_span] and [enter_span]. See the individual docs for how to use these macros.

Note that to allow traces from wasm execution environment there are 2 reserved identifiers for tracing Field recording, stored in the consts: WASM_TARGET_KEY and WASM_NAME_KEY - if you choose to record fields, you must ensure that your identifiers do not clash with either of these.

Additionally, we have a const: WASM_TRACE_IDENTIFIER, which holds a span name used to signal that the 'actual' span name and target should be retrieved instead from the associated Fields mentioned above.

License: Apache-2.0


lib.rs:

Substrate tracing primitives and macros.

To trace functions or invidual code in Substrate, this crate provides [within_span] and [enter_span]. See the individual docs for how to use these macros.

Note that to allow traces from wasm execution environment there are 2 reserved identifiers for tracing Field recording, stored in the consts: WASM_TARGET_KEY and WASM_NAME_KEY - if you choose to record fields, you must ensure that your identifiers do not clash with either of these.

Additionally, we have a const: WASM_TRACE_IDENTIFIER, which holds a span name used to signal that the 'actual' span name and target should be retrieved instead from the associated Fields mentioned above.

Note: The tracing crate requires trace metadata to be static. This does not work for wasm code in substrate, as it is regularly updated with new code from on-chain events. The workaround for this is for the wasm tracing wrappers to put the name and target data in the values map (normally they would be in the static metadata assembled at compile time).

Dependencies

~1.2–2.4MB
~46K SLoC