JsonStorageLayer, to attach contextual information to spans for ease of consumption by downstream
BunyanFormattingLayer`, which emits a bunyan-compatible formatted record upon entering a span, existing a span and event creation.
Important: each span will inherit all fields and properties attached to its parent - this is
currently not the behaviour provided by
use ; use instrument; use info; use Registry; use SubscriberExt;
If you pipe the output in the
The layered approach we have pursued is not necessarily the most efficient,
but it makes it easier to separate different concerns and re-use common logic across multiple
While the current crate has no ambition to provide any sort of general purpose framework on top of
Layer trait, the information collected by
JsonStorageLayer can be leveraged via
its public API by other downstream layers outside of this crate whose main concern is formatting.
It significantly lowers the amount of complexity you have to deal with if you are interested
in implementing your own formatter, for whatever reason or purpose.
You can also add another enrichment layer following the
JsonStorageLayer to collect
additional information about each span and store it in
We could have pursued this compositional approach to add
elapsed_milliseconds to each span
instead of baking it in
You can enable the
arbitrary_precision feature to handle numbers of arbitrary size losslessly. Be aware of a known issue with untagged deserialization.
Currently the tests only support being run sequentially, so the number of threads needs to be restricted:
cargo test -- --test-threads 1