remove otel.metricIntervalMs and the host-level otel.debug
Both are ignored with a warning through the same shim, now nix/host-modules/hive-options-removed.nix. - otel.metricIntervalMs: claude in every agent and hive-c0re's container-resource exporter run at the 60s default. The agent-level services.hyperhive.agent.otel.metricIntervalMs, set only by the meta render, goes too (warning shim in nix/agent-modules/otel-removed.nix). - otel.debug: services.hyperhive.agent.otel.debug stays, documented and set in an agent's own config; the meta render no longer emits it.
This commit is contained in:
parent
4b5707768c
commit
0a5f35bda3
14 changed files with 136 additions and 152 deletions
|
|
@ -555,10 +555,6 @@ struct OtelConfig {
|
|||
endpoint: String,
|
||||
protocol: String,
|
||||
extra_resource_attributes: Option<String>,
|
||||
metric_interval_ms: Option<u64>,
|
||||
/// `HYPERHIVE_OTEL_DEBUG=1` → `services.hyperhive.agent.otel.debug = true` →
|
||||
/// `CLAUDE_CODE_OTEL_DIAG_STDERR=1` in every agent's env.
|
||||
debug: bool,
|
||||
}
|
||||
|
||||
/// Read the hive-wide OTEL config from env, or `None` when OTEL is off.
|
||||
|
|
@ -578,19 +574,10 @@ fn otel_config() -> Option<OtelConfig> {
|
|||
let extra_resource_attributes = std::env::var("HYPERHIVE_OTEL_EXTRA_RESOURCE_ATTRIBUTES")
|
||||
.ok()
|
||||
.filter(|v| !v.is_empty());
|
||||
let metric_interval_ms = std::env::var("HYPERHIVE_OTEL_METRIC_INTERVAL_MS")
|
||||
.ok()
|
||||
.and_then(|v| v.parse::<u64>().ok())
|
||||
.filter(|v| *v > 0);
|
||||
let debug = std::env::var("HYPERHIVE_OTEL_DEBUG")
|
||||
.ok()
|
||||
.is_some_and(|v| v == "1");
|
||||
Some(OtelConfig {
|
||||
endpoint,
|
||||
protocol,
|
||||
extra_resource_attributes,
|
||||
metric_interval_ms,
|
||||
debug,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -902,17 +889,6 @@ where
|
|||
esc(attrs)
|
||||
);
|
||||
}
|
||||
if let Some(ms) = otel.metric_interval_ms {
|
||||
// Int option — emit a bare numeric literal (no quotes). `ms` is a
|
||||
// parsed u64, so it can't inject anything into the rendered nix.
|
||||
let _ = writeln!(
|
||||
out,
|
||||
" services.hyperhive.agent.otel.metricIntervalMs = {ms};"
|
||||
);
|
||||
}
|
||||
if otel.debug {
|
||||
out.push_str(" services.hyperhive.agent.otel.debug = true;\n");
|
||||
}
|
||||
}
|
||||
// Agent-facing service URLs (`services.hyperhive.agent.forge.url`, `services.hyperhive.agent.matrix.url`):
|
||||
// emit the host's real values as build-time agent config, the same
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ use opentelemetry_sdk::metrics::{PeriodicReader, SdkMeterProvider};
|
|||
use super::container_stats::{self, ContainerResource};
|
||||
use super::warnings;
|
||||
|
||||
/// Default export cadence when `HYPERHIVE_OTEL_METRIC_INTERVAL_MS` is unset.
|
||||
const DEFAULT_INTERVAL: Duration = Duration::from_mins(1);
|
||||
/// Export cadence, and the snapshot refresher's.
|
||||
const EXPORT_INTERVAL: Duration = Duration::from_mins(1);
|
||||
|
||||
/// Latest container-stats snapshot: written by the async refresher, read by
|
||||
/// the sync observable-instrument callbacks.
|
||||
|
|
@ -69,7 +69,7 @@ pub fn spawn_exporter(hyperhive_flake: &str) {
|
|||
let snapshot = SNAPSHOT
|
||||
.get_or_init(|| Arc::new(Mutex::new(Vec::new())))
|
||||
.clone();
|
||||
let interval = interval();
|
||||
let interval = EXPORT_INTERVAL;
|
||||
|
||||
// Async refresher: keep the shared snapshot current for the sync callbacks.
|
||||
let refresh = snapshot.clone();
|
||||
|
|
@ -124,10 +124,9 @@ fn build_provider(
|
|||
.with_protocol(Protocol::HttpJson)
|
||||
.build()
|
||||
.context("build OTLP metric exporter")?;
|
||||
// Drive the reader's export at `interval` so `HYPERHIVE_OTEL_METRIC_INTERVAL_MS`
|
||||
// is the real export cadence (not just the snapshot-refresh cadence). The
|
||||
// refresher runs at the same interval, gather-first, so the snapshot is
|
||||
// populated before the first export.
|
||||
// Drive the reader's export at `interval`, the same cadence as the
|
||||
// refresher. The refresher gathers first, so the snapshot is populated
|
||||
// before the first export.
|
||||
let reader = PeriodicReader::builder(exporter)
|
||||
.with_interval(interval)
|
||||
.build();
|
||||
|
|
@ -400,15 +399,6 @@ fn endpoint() -> Option<String> {
|
|||
.filter(|s| !s.is_empty())
|
||||
}
|
||||
|
||||
/// Export cadence from `HYPERHIVE_OTEL_METRIC_INTERVAL_MS`, else the default.
|
||||
fn interval() -> Duration {
|
||||
std::env::var("HYPERHIVE_OTEL_METRIC_INTERVAL_MS")
|
||||
.ok()
|
||||
.and_then(|s| s.trim().parse::<u64>().ok())
|
||||
.filter(|ms| *ms > 0)
|
||||
.map_or(DEFAULT_INTERVAL, Duration::from_millis)
|
||||
}
|
||||
|
||||
/// Extra resource attributes from `HYPERHIVE_OTEL_EXTRA_RESOURCE_ATTRIBUTES`
|
||||
/// (`key=value,key=value`), same env the agent-side export reads.
|
||||
fn resource_attributes() -> Vec<(String, String)> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue