34 releases (18 stable)

17.0.1 Sep 25, 2024
17.0.0 Apr 8, 2024
16.0.0 Jan 23, 2024
15.0.0 Dec 12, 2023
2.0.0-rc5 Jul 24, 2020

#60 in #substrate

Download history 11021/week @ 2024-07-22 10551/week @ 2024-07-29 10822/week @ 2024-08-05 12326/week @ 2024-08-12 12007/week @ 2024-08-19 11551/week @ 2024-08-26 9886/week @ 2024-09-02 10550/week @ 2024-09-09 44366/week @ 2024-09-16 61936/week @ 2024-09-23 68720/week @ 2024-09-30 67423/week @ 2024-10-07 70937/week @ 2024-10-14 79523/week @ 2024-10-21 62215/week @ 2024-10-28 87665/week @ 2024-11-04

302,309 downloads per month
Used in 791 crates (28 directly)

Apache-2.0

34KB
623 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

Release

Polkadot SDK stable2409


lib.rs:

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

Dependencies

~2.9–4.5MB
~93K SLoC