Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Cargo features

otel-http and otel-logger have no default features. HTTP callers select the helpers they use; Logger itself is available without any feature flags.

otel-http

FeatureAddsEnables
fieldsRequest/header extractiondep:http only
macrosRoot dyn_span! and dyn_event! macrosdep:tracing
httppropagation context extraction and injectionfields, dep:http, dep:opentelemetry, dep:opentelemetry-http
contextCurrent trace/span IDs and remote-parent attachmenthttp, dep:tracing, dep:tracing-opentelemetry
spanShared HTTP server span creationcontext, macros

dep: denotes an optional dependency, not another crate feature. In particular, fields does not enable the http propagation feature.

axum-otel explicitly enables macros and span. Applications importing otel_http themselves must also declare that direct dependency and the features they use. otel-http does not depend on otel-init or otel-logger.

otel-logger

FeatureAddsEnables
envLogger::from_env, init_logger_from_env, init_logging_from_envdep:config

Logger always depends on otel-init with subscriber. The old logger, otel, and implicit opentelemetry-otlp features are removed. Exporter construction in application code requires a direct exporter dependency.

Dependency examples for the upcoming split release:

# Shared HTTP helpers.
otel-http = { version = "0.34", features = ["span"] }

# Code-configured application bootstrap.
otel-logger = "0.34"

For environment configuration, replace the Logger dependency with:

otel-logger = { version = "0.34", features = ["env"] }

Applications using both sets of APIs must declare both crates. Workspace entries do not enable features implicitly; each member selects its own.

otel-init

FeatureAdds
subscriberBoxLayer, init_env_filter, init_tracing_subscriber, and the OpenTelemetry log bridge

Direct subscriber users should explicitly enable subscriber rather than rely on another dependency enabling it through Cargo feature unification.

Contributor checks

Check packages independently so workspace feature unification cannot hide a missing feature:

cargo check -p otel-http --no-default-features
cargo check -p otel-http --no-default-features --features fields
cargo check -p otel-http --no-default-features --features macros
cargo check -p otel-http --no-default-features --features http
cargo check -p otel-http --no-default-features --features context
cargo check -p otel-http --no-default-features --features span
cargo check -p otel-logger --no-default-features
cargo check -p otel-logger --no-default-features --features env