pub struct JsonStorage<'a> { /* private fields */ }
Expand description

JsonStorage will collect information about a span when it’s created (new_span handler) or when new records are attached to it (on_record handler) and store it in its extensions for future retrieval from other layers interested in formatting or further enrichment.

We are re-implementing (well, copy-pasting, apart from using an HashMap instead of a BTreeMap) JsonVisitor from tracing-subscriber given that we can’t access/insert/iterate over the underlying BTreeMap using its public API.

For spans, we also store the duration of each span with the elapsed_milliseconds key using the on_exit/on_enter handlers.

Implementations§

Get the set of stored values, as a set of keys and JSON values.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Get a new visitor, with an empty bag of key-value pairs.

Returns the “default value” for a type. Read more

Taken verbatim from tracing-subscriber

Visit a signed 64-bit integer value.

Visit an unsigned 64-bit integer value.

Visit a 64-bit floating point value.

Visit a boolean value.

Visit a string value.

Visit a value implementing fmt::Debug.
Visit a signed 128-bit integer value.
Visit an unsigned 128-bit integer value.
Records a type implementing Error.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more