From b28af3cd1f91ed0901f879e6092b7f9b956e29f6 Mon Sep 17 00:00:00 2001 From: atlas Date: Fri, 14 Aug 2026 15:16:04 +0200 Subject: [PATCH 1/2] fix(c0re): stop compiling out the OTLP exporter's own diagnostics `default-features = false` on opentelemetry-otlp was written to trim transports and dropped `internal-logs` with them, so every otel_warn! and otel_debug! inside that crate compiled to nothing. The failure that matters is the one which returns HTTP 200: the collector accepts the request and rejects the data points, and HttpMetricsClient.PartialSuccess is the only place the rejection count and the collector's reason are ever surfaced. The feature is per-crate, not per-workspace: the macros are exported by the opentelemetry API crate but their cfg and CARGO_PKG_NAME resolve in the calling crate, so the API crate and the SDK had internal logs on while the exporter did not. hive-metric keeps the identical declaration on purpose - it installs no tracing subscriber, so the feature would be inert there and would only mislead. Both files now record which side of that they are on, and the stale "same features as hive-metric" comment is corrected. Not sufficient on its own: a hard export failure is logged by the SDK at debug on the compiled timer path, so it stays below the info filter. That needs a level rather than a feature and is left to review. --- hive-c0re/Cargo.toml | 13 ++++++++++--- hive-metric/Cargo.toml | 7 +++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/hive-c0re/Cargo.toml b/hive-c0re/Cargo.toml index 54e97769..4e4159bc 100644 --- a/hive-c0re/Cargo.toml +++ b/hive-c0re/Cargo.toml @@ -20,12 +20,19 @@ clap.workspace = true clap_complete.workspace = true clap-markdown = "0.1" # OTEL SDK for the per-agent container-resource metrics exporter -# (stats/otel_metrics.rs). Same versions/features as hive-metric — the -# blocking OTLP client is deliberate: the metrics SDK's PeriodicReader runs -# on a background thread with no Tokio reactor, where the async client panics. +# (stats/otel_metrics.rs). Same versions as hive-metric, and the same blocking +# OTLP client for the same reason: the metrics SDK's PeriodicReader runs on a +# background thread with no Tokio reactor, where the async client panics. +# Features differ by one — see `internal-logs` below and hive-metric's note. opentelemetry = "0.32" opentelemetry_sdk = { version = "0.32", features = ["metrics"] } opentelemetry-otlp = { version = "0.32", default-features = false, features = [ + # Not a transport — this is the exporter's own diagnostics, and it is in + # `default`, so `default-features = false` drops it unless it is named here. + # Without it every `otel_warn!`/`otel_debug!` *inside this crate* compiles to + # nothing, and the one failure that returns HTTP 200 — the collector accepting + # the request and rejecting the data points — is reported nowhere at all. + "internal-logs", "metrics", "http-json", "reqwest-blocking-client", diff --git a/hive-metric/Cargo.toml b/hive-metric/Cargo.toml index 741d3419..fda8c027 100644 --- a/hive-metric/Cargo.toml +++ b/hive-metric/Cargo.toml @@ -19,6 +19,13 @@ opentelemetry_sdk = { version = "0.32", features = ["metrics"] } # so the async client panics there with "no reactor running". The blocking # client sends on that thread directly — and for a fire-and-forget CLI that # records one point then `shutdown()`s, a synchronous send is exactly right. +# +# Deliberately WITHOUT the `internal-logs` feature that `hive-c0re` names, even +# though the defect is identical: this binary installs no `tracing` subscriber, +# so the SDK's diagnostics would be emitted into a void. Enabling it here would +# read as "hive-metric reports its export failures" while changing nothing at +# all. Giving this CLI somewhere to report is a behaviour change with its own +# decision (does a metrics push print to stderr?) — tracked separately. opentelemetry-otlp = { version = "0.32", default-features = false, features = [ "metrics", "http-json", From 34fed47400182bf6b94a1a0340168f7380c4b403 Mon Sep 17 00:00:00 2001 From: atlas Date: Fri, 14 Aug 2026 16:02:10 +0200 Subject: [PATCH 2/2] cut the comments back to what the code cannot say mara: comments to code ratio too high. It was 16 comment lines for one line of feature. Kept only the fact that stops the feature being trimmed away again - it is not a transport, it is in `default`, so `default-features = false` drops it - and, in hive-metric, the one reason its declaration deliberately differs. Why an HTTP 200 is the failure that matters, and what a stderr-reporting CLI would cost, are the PR's and the follow-up issue's job, not the manifest's. --- hive-c0re/Cargo.toml | 14 +++++--------- hive-metric/Cargo.toml | 9 ++------- 2 files changed, 7 insertions(+), 16 deletions(-) diff --git a/hive-c0re/Cargo.toml b/hive-c0re/Cargo.toml index 4e4159bc..9476a73d 100644 --- a/hive-c0re/Cargo.toml +++ b/hive-c0re/Cargo.toml @@ -20,18 +20,14 @@ clap.workspace = true clap_complete.workspace = true clap-markdown = "0.1" # OTEL SDK for the per-agent container-resource metrics exporter -# (stats/otel_metrics.rs). Same versions as hive-metric, and the same blocking -# OTLP client for the same reason: the metrics SDK's PeriodicReader runs on a -# background thread with no Tokio reactor, where the async client panics. -# Features differ by one — see `internal-logs` below and hive-metric's note. +# (stats/otel_metrics.rs). Same versions as hive-metric — the blocking OTLP +# client is deliberate: the metrics SDK's PeriodicReader runs on a background +# thread with no Tokio reactor, where the async client panics. opentelemetry = "0.32" opentelemetry_sdk = { version = "0.32", features = ["metrics"] } opentelemetry-otlp = { version = "0.32", default-features = false, features = [ - # Not a transport — this is the exporter's own diagnostics, and it is in - # `default`, so `default-features = false` drops it unless it is named here. - # Without it every `otel_warn!`/`otel_debug!` *inside this crate* compiles to - # nothing, and the one failure that returns HTTP 200 — the collector accepting - # the request and rejecting the data points — is reported nowhere at all. + # Not a transport: it is in `default`, so `default-features = false` drops the + # exporter's own diagnostics unless it is named here. "internal-logs", "metrics", "http-json", diff --git a/hive-metric/Cargo.toml b/hive-metric/Cargo.toml index fda8c027..e066970c 100644 --- a/hive-metric/Cargo.toml +++ b/hive-metric/Cargo.toml @@ -19,13 +19,8 @@ opentelemetry_sdk = { version = "0.32", features = ["metrics"] } # so the async client panics there with "no reactor running". The blocking # client sends on that thread directly — and for a fire-and-forget CLI that # records one point then `shutdown()`s, a synchronous send is exactly right. -# -# Deliberately WITHOUT the `internal-logs` feature that `hive-c0re` names, even -# though the defect is identical: this binary installs no `tracing` subscriber, -# so the SDK's diagnostics would be emitted into a void. Enabling it here would -# read as "hive-metric reports its export failures" while changing nothing at -# all. Giving this CLI somewhere to report is a behaviour change with its own -# decision (does a metrics push print to stderr?) — tracked separately. +# No `internal-logs` here, unlike hive-c0re: this binary installs no tracing +# subscriber, so the SDK's diagnostics would have nowhere to go. opentelemetry-otlp = { version = "0.32", default-features = false, features = [ "metrics", "http-json",