32 releases (15 major breaking)

new 17.0.0 Apr 8, 2024
16.0.0 Jan 23, 2024
15.0.0 Dec 12, 2023
14.0.0 Nov 1, 2023
2.0.0-rc5 Jul 24, 2020

#1051 in Magic Beans

Download history 5062/week @ 2023-12-22 5873/week @ 2023-12-29 11577/week @ 2024-01-05 10572/week @ 2024-01-12 10630/week @ 2024-01-19 10063/week @ 2024-01-26 12368/week @ 2024-02-02 15502/week @ 2024-02-09 11713/week @ 2024-02-16 10902/week @ 2024-02-23 10864/week @ 2024-03-01 12250/week @ 2024-03-08 12008/week @ 2024-03-15 12997/week @ 2024-03-22 13670/week @ 2024-03-29 11260/week @ 2024-04-05

51,550 downloads per month
Used in 725 crates (22 directly)

Apache-2.0

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

~3–11MB
~98K SLoC