Watch
0
0
Fork
You've already forked hyperhive
0

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:
atlas 2026-10-16 17:48:24 +02:00 • committed by mara
commit f8960dd501
5 changed files with 22 additions and 53 deletions

View file

@ -13,7 +13,7 @@
//! exporter): blocking OTLP client on the `PeriodicReader`'s own background
//! thread, `service.name` + `HYPERHIVE_OTEL_EXTRA_RESOURCE_ATTRIBUTES` for
//! the resource, `OTEL_EXPORTER_OTLP_ENDPOINT` as the sole enable signal,
//! `HYPERHIVE_OTEL_METRIC_INTERVAL_MS` for cadence. Recording is
//! a fixed 60 s export cadence. Recording is
//! synchronous (`counter.add`, called at the event site) rather than
//! observable/polled — see `hive-agent::otel_turn_metrics`'s doc comment
//! for why an occurrence, unlike a live gauge, has nothing to poll between
@ -29,9 +29,8 @@ use opentelemetry_otlp::{MetricExporter, Protocol, WithExportConfig, WithHttpCon
use opentelemetry_sdk::Resource;
use opentelemetry_sdk::metrics::{PeriodicReader, SdkMeterProvider};
/// Default export cadence when `HYPERHIVE_OTEL_METRIC_INTERVAL_MS` is
/// unset. Matches every other OTEL exporter in this tree.
const DEFAULT_INTERVAL: Duration = Duration::from_mins(1);
/// Export cadence. Matches every other OTEL exporter in this tree.
const EXPORT_INTERVAL: Duration = Duration::from_mins(1);
/// One push delivery, as parsed off the webhook body — just the two fields
/// this module needs, not a full mirror of Forgejo's push-event schema.
@ -86,7 +85,7 @@ pub(super) fn record_push(activity: &PushActivity) {
fn build() -> Option<Instruments> {
let endpoint = endpoint()?;
let interval = interval();
let interval = EXPORT_INTERVAL;
match build_provider(interval) {
Ok(provider) => {
tracing::info!(%endpoint, ?interval, "otel vcs-metrics: exporter enabled");
@ -198,14 +197,6 @@ fn endpoint() -> Option<String> {
.filter(|s| !s.is_empty())
}
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)
}
fn resource_attributes() -> Vec<(String, String)> {
std::env::var("HYPERHIVE_OTEL_EXTRA_RESOURCE_ATTRIBUTES")
.ok()