Global concerns

Carefully consider level

Event and span level should correspond to the significance of the event as follows:

By default, our OTLP exporter captures DEBUG and higher level events. This means that trace! events will not be exported by default. If you need to capture these events, you can change the level of the exporter using the OTEL_LEVEL env var.

Our log formatter logs at INFO level, so trace! and debug! events will not be visible in the logs. This can be configured with the RUST_LOG env var.

// avoid this
warn!("Connected to database");

// instead do this
info!("Connected to database");

Import from bin-base

We re-export all necessary crates from init4-bin-base. Use those as re-imports, rather than adding them to the local project’s Cargo.toml. This is not super important, but just nice for simplifying our dep trees and avoiding having multiple crate versions at once.

Yes this is more verbose, and we may choose to not like this later.

// avoid this
use tracing::info;

// instead do this
use init4_bin_base::deps::tracing::info;

Spans

Spans represent the duration of a unit of work. They are the primary data structure in tracing, and wrap span events produced by the event macros. Spans should be