drop the remaining HYPERHIVE_OTEL_METRIC_INTERVAL_MS readers
Nothing sets the variable once otel.metricIntervalMs is gone, so the turn-metrics, jobq-metrics and vcs-metrics exporters export at a fixed 60s, as hive-c0re's container-resource exporter already does. The observability doc and the removal warning now say so.
This commit is contained in:
parent
0a5f35bda3
commit
f8960dd501
5 changed files with 22 additions and 53 deletions
|
|
@ -39,10 +39,9 @@ use opentelemetry_sdk::metrics::{PeriodicReader, SdkMeterProvider};
|
|||
|
||||
use crate::turn_stats::TurnStatRow;
|
||||
|
||||
/// Default export cadence when `HYPERHIVE_OTEL_METRIC_INTERVAL_MS` is unset.
|
||||
/// Matches `hive-c0re`'s container-metrics default so the two exporters
|
||||
/// batch on the same rhythm by default.
|
||||
const DEFAULT_INTERVAL: Duration = Duration::from_mins(1);
|
||||
/// Export cadence. Matches `hive-c0re`'s container-metrics exporter so the
|
||||
/// two batch on the same rhythm.
|
||||
const EXPORT_INTERVAL: Duration = Duration::from_mins(1);
|
||||
|
||||
struct Instruments {
|
||||
/// Kept alive for the process lifetime — the `PeriodicReader` only
|
||||
|
|
@ -177,7 +176,7 @@ fn build() -> Option<Instruments> {
|
|||
tracing::debug!("otel turn-metrics: no endpoint configured, exporter disabled");
|
||||
return None;
|
||||
}
|
||||
let interval = interval();
|
||||
let interval = EXPORT_INTERVAL;
|
||||
match build_provider(interval) {
|
||||
Ok(provider) => {
|
||||
tracing::info!(?interval, "otel turn-metrics: exporter enabled");
|
||||
|
|
@ -254,12 +253,3 @@ fn build_provider(interval: Duration) -> anyhow::Result<SdkMeterProvider> {
|
|||
pub fn enabled() -> bool {
|
||||
std::env::var("OTEL_EXPORTER_OTLP_ENDPOINT").is_ok_and(|s| !s.trim().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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue