logo
pub struct TracingSection {
    pub use_color: bool,
    pub force_use_color: bool,
    pub filter: Option<String>,
    pub buffer_limit: usize,
    pub endpoint_addr: Option<SocketAddr>,
    pub flamegraph: Option<PathBuf>,
    pub use_journald: bool,
}
Expand description

Tracing configuration section.

Fields

use_color: bool

Whether to use colored terminal output, if available.

Colored terminal output is automatically disabled if an output stream is connected to a file. (Or another non-terminal device.)

Defaults to true, which automatically enables colored output to terminals.

force_use_color: bool

Whether to force the use of colored terminal output, even if it’s not available.

Will force Zebra to use colored terminal output even if it does not detect that the output is a terminal that supports colors.

Defaults to false, which keeps the behavior of use_color.

filter: Option<String>

The filter used for tracing events.

The filter is used to create a tracing-subscriber EnvFilter, and more details on the syntax can be found there or in the examples below.

If no filter is specified (None), the filter is set to info if the -v flag is given and warn if it is not given.

Examples

warn,zebrad=info,zebra_network=debug sets a global warn level, an info level for the zebrad crate, and a debug level for the zebra_network crate.

[block_verify{height=Some\(block::Height\(.*000\)\)}]=trace

sets trace level for all events occurring in the context of a block_verify span whose height field ends in 000, i.e., traces the verification of every 1000th block.

buffer_limit: usize

The buffer_limit size sets the number of log lines that can be queued by the tracing subscriber to be written to stdout before logs are dropped.

Defaults to 128,000 with a minimum of 100.

endpoint_addr: Option<SocketAddr>

The address used for an ad-hoc RPC endpoint allowing dynamic control of the tracing filter.

Install Zebra using cargo install --features=filter-reload to enable this config.

If this is set to None, the endpoint is disabled.

flamegraph: Option<PathBuf>

Controls whether to write a flamegraph of tracing spans.

Install Zebra using cargo install --features=flamegraph to enable this config.

If this is set to None, flamegraphs are disabled. Otherwise, it specifies an output file path, as described below.

This path is not used verbatim when writing out the flamegraph. This is because the flamegraph is written out as two parts. First the flamegraph is constantly persisted to the disk in a “folded” representation that records collapsed stack traces of the tracing spans that are active. Then, when the application is finished running the destructor will flush the flamegraph output to the folded file and then read that file and generate the final flamegraph from it as an SVG.

The need to create two files means that we will slightly manipulate the path given to us to create the two representations.

Example

Given flamegraph = "flamegraph" we will generate a flamegraph.svg and a flamegraph.folded file in the current directory.

If you provide a path with an extension the extension will be ignored and replaced with .folded and .svg for the respective files.

use_journald: bool

The use_journald flag sends tracing events to systemd-journald, on Linux distributions that use systemd.

Install Zebra using cargo install --features=journald to enable this config.

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
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Borrow this concrete type as a &dyn Any
Borrow this concrete type as a &mut dyn Any
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Load the configuration from the given TOML string
Load the global configuration from the TOML file at the given path. If an error occurs reading or parsing the file, print it out and exit. Read more
Converts self into T using Into<T>. Read more
Causes self to use its Binary implementation when Debug-formatted. Read more
Causes self to use its Display implementation when Debug-formatted. Read more
Causes self to use its LowerExp implementation when Debug-formatted. Read more
Causes self to use its LowerHex implementation when Debug-formatted. Read more
Causes self to use its Octal implementation when Debug-formatted. Read more
Causes self to use its Pointer implementation when Debug-formatted. Read more
Causes self to use its UpperExp implementation when Debug-formatted. Read more
Causes self to use its UpperHex implementation when Debug-formatted. Read more
Formats each item in a sequence. 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
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.

Set the foreground color generically Read more
Set the background color generically. Read more
Change the foreground color to black
Change the background color to black
Change the foreground color to red
Change the background color to red
Change the foreground color to green
Change the background color to green
Change the foreground color to yellow
Change the background color to yellow
Change the foreground color to blue
Change the background color to blue
Change the foreground color to magenta
Change the background color to magenta
Change the foreground color to purple
Change the background color to purple
Change the foreground color to cyan
Change the background color to cyan
Change the foreground color to white
Change the background color to white
Change the foreground color to the terminal default
Change the background color to the terminal default
Change the foreground color to bright black
Change the background color to bright black
Change the foreground color to bright red
Change the background color to bright red
Change the foreground color to bright green
Change the background color to bright green
Change the foreground color to bright yellow
Change the background color to bright yellow
Change the foreground color to bright blue
Change the background color to bright blue
Change the foreground color to bright magenta
Change the background color to bright magenta
Change the foreground color to bright purple
Change the background color to bright purple
Change the foreground color to bright cyan
Change the background color to bright cyan
Change the foreground color to bright white
Change the background color to bright white
Make the text bold
Make the text dim
Make the text italicized
Make the text italicized
Make the text blink
Make the text blink (but fast!)
Swap the foreground and background colors
Hide the text
Cross out the text
Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
Set the foreground color to a specific RGB value.
Set the background color to a specific RGB value.
Sets the foreground color to an RGB value.
Sets the background color to an RGB value.
Apply a runtime-determined style
Pipes by value. This is generally the method you want to use. Read more
Borrows self and passes that borrow into the pipe function. Read more
Mutably borrows self and passes that borrow into the pipe function. Read more
Borrows self, then passes self.borrow() into the pipe function. Read more
Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Borrows self, then passes self.as_ref() into the pipe function.
Mutably borrows self, then passes self.as_mut() into the pipe function. Read more
Borrows self, then passes self.deref() into the pipe function.
Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more
The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Converts the type into a Result that can be sent as a response.
Should always be Self
Immutable access to a value. Read more
Mutable access to a value. Read more
Immutable access to the Borrow<B> of a value. Read more
Mutable access to the BorrowMut<B> of a value. Read more
Immutable access to the AsRef<R> view of a value. Read more
Mutable access to the AsMut<R> view of a value. Read more
Immutable access to the Deref::Target of a value. Read more
Mutable access to the Deref::Target of a value. Read more
Calls .tap() only in debug builds, and is erased in release builds.
Calls .tap_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more
Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref() only in debug builds, and is erased in release builds. Read more
Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref() only in debug builds, and is erased in release builds. Read more
Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more
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
Attempts to convert self into T using TryInto<T>. 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
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