Skip to content

Try to minify dep graph and feature gate more.#32

Open
dkales wants to merge 4 commits intomainfrom
dk/feature_cleanup
Open

Try to minify dep graph and feature gate more.#32
dkales wants to merge 4 commits intomainfrom
dk/feature_cleanup

Conversation

@dkales
Copy link
Copy Markdown
Member

@dkales dkales commented Apr 22, 2026

  • feat(observability): feature-gate metrics exporters
  • feat(observability): feature-gate datadog tracing
  • build(deps): disable default features for axum, tower, tracing-subscriber
  • build(deps): make tokio/time feature explicit

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, and tracing-subscriber, and nodes-common explicitly enables the minimal axum features it needs and adds tokio's time feature.

nodes-observability now 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-op TracingShutdownHandle type to keep initialize_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.

dkales added 4 commits April 22, 2026 14:48
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.
@dkales dkales requested a review from 0xThemis April 22, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant