Open
Conversation
Introduce exporter-datadog, exporter-statsd and exporter-prometheus Cargo features (all on by default, so existing consumers keep their builds). Each gates the corresponding MetricsConfig variant and its backing exporter crate; picking a single backend with default-features = false now drops the other two exporter crates (and humantime + secrecy for non-prometheus builds) from the compile graph.
Introduce a `datadog-tracing` feature (on by default) that gates the `telemetry-batteries` dep — the heaviest in the crate, pulling opentelemetry, otlp, tonic and prost — together with the Datadog branch of `initialize_tracing` and its custom panic hook. Consumers that set `default-features = false` and skip this feature drop the entire opentelemetry stack from their build. When `datadog-tracing` is disabled, `TracingShutdownHandle` is re-exported as a zero-sized stub so `initialize_tracing`'s signature (`Option<TracingShutdownHandle>`) stays stable across feature flags; the function bails if `TracingConfig.service_name` is configured without the feature enabled. Also declare `tracing-subscriber` with `features = ["env-filter"]` explicitly. Previously `env-filter` was being pulled in transitively by `telemetry-batteries`; making the latter optional exposed that hidden dependency.
…iber Set `default-features = false` at the workspace level for axum, tower and tracing-subscriber, then re-enable only the features actually used: * `axum` → `http1`, `tokio`, `tracing` (drops `form`, `json`, `query`, `matched-path`, `original-uri`, `tower-log`). Matches what the api module (two plain-text routes) and the web3 test harness actually need. * `tower` → no features (web3 only imports the `Service` and `Layer` traits, both exposed without optional features). * `tracing-subscriber` → `env-filter`, `fmt` (drops `ansi`, `tracing-log`, `smallvec` and associated transitive deps; `std` and `registry` come in via `fmt`). No functional change. Tests pass; all feature combinations lint clean.
`tokio::time::sleep` is used directly in postgres.rs and web3.rs retry loops, but the `time` feature was only pulled in transitively via backon's `tokio-sleep`. Declaring it explicitly removes a hidden dependency — the same class of issue Phase 3 caught in `tracing-subscriber/env-filter` once `telemetry-batteries` became optional.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Medium Risk
Medium risk because it changes Cargo feature flags and disables several dependency default features, which can cause build or runtime telemetry regressions if downstream crates relied on implicit features.
Overview
Reduces the default dependency graph and makes telemetry components opt-in. Workspace deps now disable default features for
axum,tower, andtracing-subscriber, andnodes-commonexplicitly enables the minimalaxumfeatures it needs and addstokio'stimefeature.nodes-observabilitynow feature-gates Datadog tracing and each metrics exporter. Exporter crates and related parsing deps are optional behind new features (datadog-tracing,exporter-datadog,exporter-statsd,exporter-prometheus), with clearer errors when env-config requests a backend that wasn’t compiled in, and a no-opTracingShutdownHandletype to keepinitialize_tracing’s return type stable.Reviewed by Cursor Bugbot for commit e8ea611. Bugbot is set up for automated code reviews on this repo. Configure here.