otel-kit
otel-kit is the repository for four Rust crates that cover
different observability boundaries:
otel-initinitializes OpenTelemetry providers and tracing subscribers;otel-httpprovides shared inbound HTTP server spans and context propagation;otel-loggerprovides application logging and bootstrap for one process;axum-oteladapts the shared HTTP span behavior to Axum andtower-http::TraceLayer.
Choose the smallest crate that owns the behavior your application needs. An
Axum application can use axum-otel with its own subscriber, while an
application that wants the repository’s complete logging setup can combine it
with otel-logger, adding env for environment configuration. Provider-only
users can depend directly on otel-init.
The workspace version is 0.34.0; the package split is for the upcoming release.
Cargo.toml declares Rust 1.96.0 as the minimum supported Rust version. The repository toolchain may
pin a newer compiler for local development.
Where to start
- Getting started — install the right crates and build a minimal application.
- Crates — choose the smallest crate for each observability responsibility.
- Cargo features — keep optional dependencies and capabilities explicit.
- Comparison with
axum-tracing-opentelemetry— choose between focused request middleware and this workspace’s broader observability setup. - OTLP export and lifecycle — configure exporters and shut providers down safely.
- HTTP span attributes — understand emitted fields before writing dashboards or alerts.
The complete type-level references are on
docs.rs for otel-http,
docs.rs for otel-logger,
docs.rs for otel-init, and
docs.rs for axum-otel.
The new crate references become available when the split packages are published.
Getting started
The workspace version is 0.34.0. The otel-http / otel-logger split is
for the upcoming release; the dependency snippets describe that target.
Logger is available without features; HTTP helpers require explicit features.
Application logging
Use otel-logger for code-based configuration:
[dependencies]
otel-logger = "0.34"
anyhow = "1"
tracing = "0.1"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
use otel_logger::{LogFormat, Logger};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let _guard = Logger::new("inventory-api")
.with_format(LogFormat::Json)
.with_ansi(false)
.init()?;
tracing::info!(component = "startup", "service ready");
Ok(())
}
Keep the returned LoggerGuard alive for the whole application. Dropping it
shuts down the OpenTelemetry providers and then releases any non-blocking file
writer guard.
Set OTEL_SERVICE_NAME=inventory-api to name the resource. The argument to
Logger::new(...) only names the tracer’s instrumentation scope; resource
attributes otherwise use SDK defaults.
Environment-based configuration
Enable env when Logger configuration should come from environment variables:
[dependencies]
otel-logger = { version = "0.34", features = ["env"] }
#![allow(unused)]
fn main() {
use otel_logger::Logger;
fn run() -> anyhow::Result<()> {
let _guard = Logger::from_env(Some("LOG"))?.init()?;
Ok(())
}
}
With the LOG prefix, fields map to names such as LOG_SERVICE_NAME,
LOG_FORMAT, and LOG_CONSOLE_ENABLED. See Logger configuration for
the complete mapping used by the repository.
Axum middleware
axum-otel supplies the request-span callbacks; it does not replace subscriber
initialization:
[dependencies]
axum-otel = "0.34"
otel-logger = "0.34"
anyhow = "1"
axum = "0.8"
tokio = { version = "1", features = ["macros", "net", "rt-multi-thread"] }
tower-http = { version = "0.6", features = ["trace"] }
Continue with Axum request tracing for a complete layer setup.
Crates
otel-kit is the repository for four crates, not an all-inclusive package.
| Crate | Responsibility | Use it when |
|---|---|---|
otel-init | Resources, OTLP providers, subscriber setup, and provider shutdown | You own the subscriber or need provider-level initialization |
otel-http | Shared inbound HTTP server spans, fields, context propagation, and dynamic macros | You need framework-independent HTTP helpers |
otel-logger | Application logging and bootstrap for one process | You want the opinionated Logger facade |
axum-otel | Axum-specific TraceLayer callbacks | You need inbound Axum request spans |
The dependency direction is:
axum-otel -> otel-http
applications -> otel-logger -> otel-init
otel-http depends on neither otel-init nor otel-logger. Logger depends on
otel-init with subscriber, and does not depend on otel-http. Applications
can combine the crates or supply their own subscriber.
Public entry points
otel-init
get_resourceinit_tracer_provider,init_meter_provider,init_logger_providerOtelGuardBoxLayer,init_env_filter,init_tracing_subscriberwithsubscriber- Existing
opentelemetry,opentelemetry_sdk,tracing_opentelemetryre-exports
otel-http
fields,propagation,context,spanmodules at the crate root- Root
dyn_span!anddyn_event!macros, with themacrosfeature - No nested
httpmodule orextractaliases
otel-logger
Logger,LoggerGuard,LoggerFileAppender,LogFormat,LogRollingRotationFmtSpan,defaultinit_logging,init_tracing_from_logger,setup_tracing,init_layer- Explicit
OtelGuard,BoxLayer,init_env_filterre-exports fromotel-init Logger::from_env,init_logger_from_env,init_logging_from_envwithenv
These entries are at the crate root. There is no nested logger or otel
module and no blanket forwarding of otel-init or SDK crates.
axum-otel
AxumOtelSpanCreatorAxumOtelOnResponseAxumOtelOnFailureLevelre-export fromtracing
See features for dependency choices and migration for the upcoming package split.
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
| Feature | Adds | Enables |
|---|---|---|
fields | Request/header extraction | dep:http only |
macros | Root dyn_span! and dyn_event! macros | dep:tracing |
http | propagation context extraction and injection | fields, dep:http, dep:opentelemetry, dep:opentelemetry-http |
context | Current trace/span IDs and remote-parent attachment | http, dep:tracing, dep:tracing-opentelemetry |
span | Shared HTTP server span creation | context, 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
| Feature | Adds | Enables |
|---|---|---|
env | Logger::from_env, init_logger_from_env, init_logging_from_env | dep: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
| Feature | Adds |
|---|---|
subscriber | BoxLayer, 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
Logger configuration
otel_logger::Logger is the opinionated application bootstrap. It creates the
configured console and file layers, initializes trace and metric providers,
optionally initializes an OpenTelemetry log provider, and installs the global
tracing subscriber.
Builder configuration
#![allow(unused)]
fn main() {
use tracing::Level;
use otel_logger::{LogFormat, Logger};
fn run() -> anyhow::Result<()> {
let _guard = Logger::new("payments-api")
.with_format(LogFormat::Json)
.with_level(Level::INFO)
.with_ansi(false)
.with_console_enabled(true)
.init()?;
Ok(())
}
}
Logger::default() uses instrumentation scope otel_logger, compact output,
ANSI enabled, INFO, console output
enabled, no file appender, and OpenTelemetry log export disabled. Sampling and
metric intervals use SDK environment settings or SDK defaults
(parentbased_always_on and 60 seconds). Environment deserialization
uses false for an omitted LOG_ANSI, so set it explicitly when switching
between builder and environment configuration. RUST_LOG, when valid, takes
precedence over the logger level because subscriber setup reads the standard
environment filter first.
Environment mapping
Logger::from_env(Some("LOG")) uses LOG as the prefix. Passing None also
defaults to LOG.
| Environment variable | Logger field | Example |
|---|---|---|
LOG_SERVICE_NAME | service_name (tracer instrumentation scope) | orders-api |
LOG_FORMAT | format | compact, pretty, or json |
LOG_SPAN_EVENTS | span_events | `FMT::NEW |
LOG_ANSI | ansi | false |
LOG_LEVEL | level | info |
LOG_ATTRIBUTES | resource attributes | deployment.environment=prod |
LOG_CONSOLE_ENABLED | console layer | true |
LOG_OTEL_LOGS_ENABLED | OTLP log provider/layer | true |
File settings use the LOG_FILE prefix:
| Environment variable | Meaning |
|---|---|
LOG_FILE_ENABLE | Enable the file layer |
LOG_FILE_NON_BLOCKING | Use the non-blocking writer |
LOG_FILE_LEVEL | Optional file-specific level |
LOG_FILE_ANSI | ANSI in file output |
LOG_FILE_FORMAT | Optional file-specific format |
LOG_FILE_ROTATION | minutely, hourly, daily, or never |
LOG_FILE_DIR | Output directory |
LOG_FILE_FILENAME_PREFIX | Filename prefix |
LOG_FILE_FILENAME_SUFFIX | Filename suffix |
LOG_FILE_MAX_LOG_FILES | Maximum retained files |
Environment-based configuration requires the env feature. Calling
Logger::new(...) does not read LOG_*; use Logger::from_env(...) or
init_logging_from_env(...) when those variables should apply.
Sampling uses only native OTEL_TRACES_SAMPLER / OTEL_TRACES_SAMPLER_ARG, or
the SDK default parentbased_always_on. Metrics use OTEL_METRIC_EXPORT_INTERVAL
in milliseconds, defaulting to 60 seconds. Neither setting has a Logger field or
LOG_* fallback. Logger::service_name and LOG_SERVICE_NAME only configure
the tracer’s instrumentation scope. Resource service.name uses SDK defaults;
set OTEL_SERVICE_NAME or provide explicit resource attributes to configure it.
These native settings also work without the env feature. See
precedence details.
OTLP export and lifecycle
otel-init creates trace, metric, and log providers. Export is opt-in through
an endpoint environment variable.
# Enable all configured signals.
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
Signal-specific endpoints can enable only one signal or override the shared endpoint for that signal:
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:4318/v1/traces
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf
The corresponding metric and log names are
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT / _PROTOCOL and
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT / _PROTOCOL. Supported protocol values in
this workspace are grpc, http/protobuf, and http/json, ignoring ASCII
case but without trimming surrounding whitespace. Native exporter builders
resolve the signal-specific protocol first, then OTEL_EXPORTER_OTLP_PROTOCOL,
then the SDK feature default; invalid values fall through to the next source.
With the enabled features, the default is http/json. For a gRPC receiver,
set OTEL_EXPORTER_OTLP_PROTOCOL=grpc explicitly.
When neither the signal-specific endpoint nor the shared endpoint contains a
non-blank value, that provider remains local-only. It can still create trace
IDs, but it does not construct an exporter or attempt a connection to
localhost:4317.
Logger always initializes trace and metric providers. It initializes the log
provider only when otel_logs_enabled is true, for example with
LOG_OTEL_LOGS_ENABLED=true through the env feature.
Environment variable precedence
The OTLP exporters read standard endpoint, header, and timeout variables from
the process environment. The metric exporter also reads
OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE (cumulative, delta, or
lowmemory); when unset, the SDK default is cumulative.
Sampling, metric intervals, and resource detection use SDK defaults. Explicit resource attributes are merged after detected attributes:
| SDK environment variable | Behavior in this library |
|---|---|
OTEL_TRACES_SAMPLER, OTEL_TRACES_SAMPLER_ARG | Configured entirely by the SDK. The default is parentbased_always_on: sample root spans and honor the parent’s sampling decision for child spans. Setting only the argument does not select a sampler. |
OTEL_METRIC_EXPORT_INTERVAL | Configured entirely by the SDK, in milliseconds. The default is 60000 (60 seconds). |
OTEL_SERVICE_NAME, OTEL_RESOURCE_ATTRIBUTES | Detected by Resource::builder(). Explicit resource attributes override detected values, including service.name. With no configured service name, the SDK uses unknown_service:<executable>. |
RUST_LOG | Read by tracing-subscriber::EnvFilter; a missing or invalid value falls back to the configured log level. |
For example:
export OTEL_SERVICE_NAME=orders-api
export OTEL_TRACES_SAMPLER=parentbased_traceidratio
export OTEL_TRACES_SAMPLER_ARG=0.1
export OTEL_METRIC_EXPORT_INTERVAL=30000
In SDK 0.33, Resource::builder() runs SdkProvidedResourceDetector,
TelemetryResourceDetector, then EnvResourceDetector; later values override
earlier ones. Consequently, service.name in OTEL_RESOURCE_ATTRIBUTES
overrides OTEL_SERVICE_NAME when both are set. This library adds no custom
service-name precedence. Logger::attributes (or LOG_ATTRIBUTES) are merged
last and can override either environment setting.
An empty or invalid sampler setting is handled by the SDK, which falls back to
parentbased_always_on. An empty or non-numeric metric interval uses the SDK’s
60-second default. These settings apply when providers are initialized, not
dynamically. Logger::service_name and LOG_SERVICE_NAME only identify the
tracer’s instrumentation scope; they do not set resource service.name.
LOG_* variables configure this library’s Logger, including console output,
formatting, and file rotation. They require the env feature and
Logger::from_env(None) (or init_logging_from_env(None)). The OpenTelemetry
SDK does not replace this configuration layer.
Environment support does not load a .env file. The examples call
dotenv::dotenv() before initialization to load that file into the process
environment.
Shutdown order
Keep LoggerGuard or OtelGuard alive until application shutdown. Explicit
shutdown is available when the application needs to surface provider shutdown
errors:
#![allow(unused)]
fn main() {
use otel_logger::Logger;
fn run() -> anyhow::Result<()> {
let guard = Logger::new("worker").init()?;
tracing::info!("draining work");
guard.shutdown()?;
Ok(())
}
}
LoggerGuard shuts down telemetry providers before releasing its optional
non-blocking file writer guard. Dropping a guard also performs cleanup, but an
explicit shutdown() is the path that returns provider shutdown errors.
Axum request tracing
axum-otel supplies three callbacks for tower-http::TraceLayer:
AxumOtelSpanCreatorcreates and enriches the request span;AxumOtelOnResponserecords the response status and emits the completion event;AxumOtelOnFailuremarks classified server failures as OpenTelemetry errors.
use axum::{Router, routing::get};
use axum_otel::{
AxumOtelOnFailure, AxumOtelOnResponse, AxumOtelSpanCreator, Level,
};
use tower_http::trace::TraceLayer;
use otel_logger::Logger;
async fn health() -> &'static str {
"OK"
}
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let _guard = Logger::new("web-api").init()?;
let app = Router::new().route("/health", get(health)).layer(
TraceLayer::new_for_http()
.make_span_with(AxumOtelSpanCreator::new().level(Level::INFO))
.on_response(AxumOtelOnResponse::new().level(Level::INFO))
.on_failure(AxumOtelOnFailure::new().level(Level::ERROR)),
);
let listener = tokio::net::TcpListener::bind("127.0.0.1:3000").await?;
axum::serve(listener, app).await?;
Ok(())
}
The span creator delegates shared HTTP attributes and remote-parent extraction
to otel-http. It owns only Axum-specific enrichment: matched route,
transport peer from ConnectInfo<SocketAddr>, span name, and server span kind.
To record client.address, serve the router with Axum connect information:
axum::serve(listener, app.into_make_service_with_connect_info::<SocketAddr>())
.await?;
The value comes from the socket peer, not Forwarded or X-Forwarded-For.
Deployments behind a proxy should interpret it accordingly.
The defaults are TRACE for span creation, DEBUG for response events, and
ERROR for failure events. Ensure the subscriber filter enables the selected
levels; otherwise expected events or spans can be filtered out.
Comparison with axum-tracing-opentelemetry
Both axum-otel and axum-tracing-opentelemetry help Axum applications create
OpenTelemetry-aware HTTP request spans. The difference is mainly the intended
scope.
axum-tracing-opentelemetry
axum-tracing-opentelemetry is a focused choice when you:
- want request tracing and context propagation with a small middleware surface;
- already own the
tracingsubscriber, exporters, metrics, and logging setup; - prefer to assemble the observability stack from independent components.
For applications with an established observability bootstrap, that narrower scope can be exactly what is needed.
axum-otel and this workspace
axum-otel itself stays focused on three tower-http::TraceLayer callbacks:
AxumOtelSpanCreatorcreates and enriches request spans;AxumOtelOnResponserecords response status and emits completion events;AxumOtelOnFailuremarks classified server failures as OpenTelemetry errors.
The broader, opinionated setup comes from composing it with the other workspace
crates. otel-http owns the shared HTTP span helpers. otel-logger adds
structured console/file logging and application bootstrap. otel-init adds
trace, metric, and optional log providers plus RAII lifecycle management.
Choosing between them
Choose axum-tracing-opentelemetry when you primarily need focused middleware
and already own the rest of the stack.
Choose this workspace when you want the same HTTP tracing boundary plus reusable HTTP span helpers or a cohesive tracing, metrics, logging, and shutdown setup.
The distinction is about composition and ownership, not a claim that
axum-otel alone provides every capability in the workspace.
HTTP span attributes
otel_http::span::make_request_span records shared HTTP server
attributes. axum-otel adds framework-specific values before the remote parent
context is applied.
| Attribute | Source |
|---|---|
http.request.method | Request method |
server.address | Host header |
network.protocol.name | HTTP protocol family |
network.protocol.version | HTTP version |
url.path | URI path |
url.query | URI query |
url.scheme | URI scheme or forwarding field used by the shared extractor |
user_agent.original | User-Agent header |
request_id | X-Request-Id, then Request-Id |
trace_id | Active OpenTelemetry trace context |
http.route | Axum matched route |
client.address | Axum ConnectInfo<SocketAddr> peer IP |
otel.name | Method plus matched route when available |
otel.kind | OpenTelemetry server span kind |
http.response.status_code | Integer response status recorded on response |
otel.status_code / otel.status_description | Response/failure callbacks |
The names follow the OpenTelemetry HTTP span semantic conventions where applicable. The library does not promise to emit every attribute in that specification; values are recorded only when the request or framework adapter provides them.
Attribute migration
Recent releases replaced older field names:
| Previous attribute | Current attribute |
|---|---|
http.host | server.address |
http.user_agent | user_agent.original |
http.client_ip | client.address |
Update dashboards, alerts, queries, and sampling rules together with the
library upgrade. http.response.status_code is recorded as an integer.
Adapter authors can call make_request_span(level, request, callback). The
callback runs exactly once before remote-parent application. Record
adapter-owned otel.name and otel.kind inside that callback because the
OpenTelemetry span is materialized when the parent is applied.
Examples
The workspace contains runnable examples rather than embedding a second copy of their source in this book.
Basic Axum service
examples/otel initializes Logger from LOG_*, adds request ID middleware,
and composes the three axum-otel callbacks.
cargo run -p axum-otel-demo
Without an OTLP endpoint, providers stay local-only. To export all supported signals to a local collector:
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
cargo run -p axum-otel-demo
The service listens on 0.0.0.0:8080; call /hello for an instrumented route
or /health for the simple health route.
Microservices demonstration
examples/microservices contains users and articles services, outbound
Reqwest tracing, request ID propagation, and a Grafana/Loki/Tempo-oriented
Docker setup. Follow its README and architecture guide when validating full
cross-service propagation.
These examples are integration demonstrations, not additional public APIs. Use the crate-specific docs.rs pages for type and method details.
Migration guide
Splitting tracing-otel
The upcoming release replaces tracing-otel with otel-http and otel-logger.
There is no compatibility crate under the old name. The following 0.34
requirements describe the workspace target, not an already published split.
# Before: Logger plus direct HTTP helpers.
tracing-otel = { version = "0.34", features = ["env", "span"] }
# After: declare only the crates your source imports.
otel-logger = { version = "0.34", features = ["env"] }
otel-http = { version = "0.34", features = ["span"] }
Logger requires no feature for code configuration; use otel-logger = "0.34".
The three workspace examples use otel-logger with env. Axum callers that only
use the callbacks need axum-otel; direct HTTP helper imports additionally need
an explicit otel-http dependency. Its fields, macros, http, context, and
span features retain their dependency relationships and have no defaults.
Remove the old logger, otel, and implicit opentelemetry-otlp feature flags.
For provider-only initialization, depend on otel-init. For direct subscriber
setup, explicitly enable its feature:
otel-init = { version = "0.34", features = ["subscriber"] }
Public paths
| Before | After |
|---|---|
tracing_otel::http::{fields, propagation, context, span} | otel_http::{fields, propagation, context, span} |
tracing_otel::extract::{fields, context, span} | Corresponding root modules in otel_http |
tracing_otel::extract::http::* | otel_http::propagation::* |
tracing_otel::{dyn_span, dyn_event} | otel_http::{dyn_span, dyn_event} |
tracing_otel::macros | otel_http::macros; macros themselves remain exported at the root |
Root or logger:: Logger types, FmtSpan, init_logging | Corresponding root entries in otel_logger |
tracing_otel::logger::{init_tracing_from_logger, setup_tracing, init_layer} | Corresponding root functions in otel_logger |
tracing_otel::logger::default::* | otel_logger::default::* |
Root or logger:: environment helpers | Corresponding root functions in otel_logger, with env |
Root, otel::, or logger:: init_env_filter | otel_logger::init_env_filter, or otel_init::init_env_filter with subscriber |
Root or otel:: OtelGuard, BoxLayer | Root entries in otel_logger, or otel_init (BoxLayer needs subscriber) |
Root or otel:: resource/provider initialization functions | Corresponding functions in otel_init |
Root or otel:: init_tracing_subscriber | otel_init::init_tracing_subscriber, with subscriber |
Root or otel:: opentelemetry, opentelemetry_sdk, tracing_opentelemetry | Direct crate imports, or existing otel_init re-exports |
There is no otel_http::http, otel_http::extract, otel_logger::logger, or
otel_logger::otel compatibility module. The public default module retains all
nine helpers: service_name, max_log_files, log_level, dir,
filename_prefix, filename_suffix, span_events, rotation, and
console_enabled.
setup_tracing and init_layer remain public, with unchanged signatures.
OtelGuard and BoxLayer are explicitly re-exported by otel-logger;
opentelemetry::KeyValue needs the native API dependency (currently 0.33) or
an import through otel-init. No SDK-wide re-export remains in otel-logger.
Default instrumentation scope
The crate-name default changes from tracing_otel to otel_logger for
Logger::default() and deserialization without a service name. This affects the
instrumentation scope, not resource service.name. For a stable scope, set it
with Logger::new(...), with_service_name(...), or LOG_SERVICE_NAME when
using environment configuration. Other Logger defaults, HTTP span attributes,
and callback order are unchanged by the split.
Native SDK resource configuration
Replace get_resource("my-service", attributes) with get_resource(attributes).
Resource detection now uses SDK defaults, with explicit attributes merged last.
Set OTEL_SERVICE_NAME=my-service or an explicit service.name attribute to
name the resource. Logger::service_name, with_service_name, and
LOG_SERVICE_NAME only name the tracer’s instrumentation scope and no longer
provide a resource service-name fallback. Without a configured resource service
name, the SDK uses unknown_service:<executable>.
See resource configuration for the SDK’s environment merge order and explicit attribute overrides.
OpenTelemetry 0.33
The next release uses OpenTelemetry 0.33 and tracing-opentelemetry 0.34.
Align direct dependencies on the API, SDK, HTTP helpers, and exporters with
these versions when passing OpenTelemetry types to this library. Dependency
requirements allow compatible patch releases; applications control resolution
through their own Cargo.lock.
The OTLP tls feature alias has been replaced with tls-ring. OTLP 0.33 enables
exporter retries by default and tightens endpoint validation. Check export
failure and shutdown behavior, and use explicit http:// or https:// endpoint
schemes. Local-only operation without a configured endpoint remains unchanged.
Protocol selection now uses SDK defaults; set OTEL_EXPORTER_OTLP_PROTOCOL=grpc
explicitly for a gRPC receiver. See OTLP configuration.
The microservices example enables reqwest-tracing’s opentelemetry_0_33 feature
from upstream commit 75197ef573cc5f9aec9b0c934e3114950c5cf1e4. Its client span
and context propagation use the same OpenTelemetry generation as the server.
The three reqwest middleware crates share this Git revision so their internal
path dependencies resolve to the same source. Switch them back to compatible
crates.io releases once OpenTelemetry 0.33 support is published.
Migrating from 0.33.0
Version 0.33.1 introduced new crates.io package names. Cargo package names do
not migrate automatically.
# Before
tracing-otel-extra = "0.33.0"
tracing-opentelemetry-extra = "0.33.0"
# After
tracing-otel = "0.33.1"
otel-init = "0.33.1"
Update Rust import paths at the same time:
// Before
use tracing_otel_extra::Logger;
use tracing_opentelemetry_extra::OtelGuard;
// After
use tracing_otel::Logger;
use otel_init::OtelGuard;
axum-otel kept its package and import name; version 0.33.1 depended on
tracing-otel internally.
For that historical migration, verify explicit tracing-otel features. That crate has no default
features: use logger for code-based Logger, env for Logger::from_env, or
the narrower HTTP features listed in Cargo features.
If the application is upgrading from an older HTTP-span release, migrate dashboard and alert field names using the table in HTTP span attributes.