fix(otel): cumulative metric temporality + metricIntervalMs knob (real metrics-export fix)
This commit is contained in:
parent
609438a889
commit
af10a4bfef
3 changed files with 64 additions and 10 deletions
|
|
@ -668,6 +668,7 @@ struct OtelConfig {
|
|||
protocol: String,
|
||||
extra_resource_attributes: Option<String>,
|
||||
headers_credential: Option<String>,
|
||||
metric_interval_ms: Option<u64>,
|
||||
}
|
||||
|
||||
/// Read the hive-wide OTEL config from env, or `None` when OTEL is off.
|
||||
|
|
@ -690,11 +691,16 @@ fn otel_config() -> Option<OtelConfig> {
|
|||
let headers_credential = std::env::var("HYPERHIVE_OTEL_HEADERS_CREDENTIAL")
|
||||
.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);
|
||||
Some(OtelConfig {
|
||||
endpoint,
|
||||
protocol,
|
||||
extra_resource_attributes,
|
||||
headers_credential,
|
||||
metric_interval_ms,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -982,6 +988,11 @@ where
|
|||
esc(cred)
|
||||
);
|
||||
}
|
||||
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, " hyperhive.otel.metricIntervalMs = {ms};");
|
||||
}
|
||||
}
|
||||
out.push_str(
|
||||
r#" # The harness service inside the container runs as a
|
||||
|
|
|
|||
Loading…
Reference in a new issue