Skip to main content

Crate gix_trace

Crate gix_trace 

Source
Expand description

A crate providing macros for creating spans in various detail levels. coarse! should be used for top-level operations, whereas detail! should be used in plumbing crates unless their operations are likely to cost a lot of time.

Applications opt in through this crate’s tracing feature or the corresponding feature on gix. Plumbing crates use gix_trace directly, and applications using gix can use its trace reexport. Enable forest to collect and print trace trees; its module documentation explains connecting worker spans to their parent.

§Feature Flags

  • default — There is no default feature: applications opt in through gix or this crate directly.

  • tracing — Implement tracing with the tracing crate, which provides applications with valuable performance details if they opt-in to it.

    Note that this may have overhead as well, thus instrumentations should be used stategically, only providing coarse tracing by default and adding details only where needed while marking them with the appropriate level.

  • tracing-detail — If enabled, detailed tracing is also emitted, which can greatly increase insights but at a cost.

  • forest — Collect spans and events into trees and process or print completed trees synchronously.

  • forest-ansi — Colorize the forest’s pretty-printed output with ANSI escape sequences.

  • forest-cpu-time — Measure user and kernel CPU time in forest spans on Linux, macOS, FreeBSD, and OpenBSD. Sampling adds overhead on span entry and exit. Other platforms report CPU time as unavailable.

Modules§

event
fieldtracing
Span and Event key-value data.
forestforest
Collect related tracing spans and events into trees, then process each completed root.

Macros§

coarse
Create a new coarse span.
debug
Emit a debug event.
detail
Create a new detail span.
error
Emit an error event.
eventtracing
Create an event with the given level.
info
Emit an info event.
spantracing
A macro to create a span.
trace
Emit a trace event.
warn
Emit a warn event.

Structs§

ForestLayerforest
A tracing_subscriber::Layer that collects and processes trace data while preserving contextual coherence.
Spantracing
An entered span which will exit on drop.

Enums§

Level
The level at which the tracing item should be created.

Constants§

MAX_LEVELtracing-detail
The maximum allowed level for tracing items, as compiled in.

Functions§

in_thread
Capture the current span and subscriber, restoring both while the returned closure runs.