35 releases (19 stable)

17.1.0 Apr 2, 2025
17.0.1 Sep 25, 2024
17.0.0 Apr 8, 2024
16.0.0 Jan 23, 2024
2.0.0-rc5 Jul 24, 2020

#8 in #execution-environment

Download history 47820/week @ 2025-03-25 37391/week @ 2025-04-01 40249/week @ 2025-04-08 31393/week @ 2025-04-15 49758/week @ 2025-04-22 40002/week @ 2025-04-29 34011/week @ 2025-05-06 39500/week @ 2025-05-13 36718/week @ 2025-05-20 40737/week @ 2025-05-27 33988/week @ 2025-06-03 36434/week @ 2025-06-10 36115/week @ 2025-06-17 46208/week @ 2025-06-24 42939/week @ 2025-07-01 39493/week @ 2025-07-08

170,797 downloads per month
Used in 879 crates (28 directly)

Apache-2.0

43KB
705 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.

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).


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

Dependencies

~3–5MB
~101K SLoC