apollo-opentelemetry 0.8.0

OpenTelemetry configuration types for Apollo platform
Documentation
//! Metric reader configuration.
//!
//! See the [OpenTelemetry Metrics SDK specification](https://opentelemetry.io/docs/specs/otel/metrics/sdk/)
//! for details on reader behavior and defaults.

use apollo_configuration::configuration;

use crate::config::MetricExporter;

/// Metric reader configuration.
#[configuration]
pub(crate) enum MetricReader {
    /// Periodic reader that exports metrics at regular intervals.
    Periodic(PeriodicMetricReaderConfig),
    /// Pull-based reader for scrape endpoints (e.g., Prometheus).
    Pull(PullMetricReaderConfig),
}

/// Periodic metric reader configuration.
///
/// Collects and exports metrics at regular intervals. See the
/// [SDK specification](https://opentelemetry.io/docs/specs/otel/metrics/sdk/#periodic-exporting-metricreader)
/// for details.
#[configuration]
pub(crate) struct PeriodicMetricReaderConfig {
    /// Exporter configuration.
    #[config(required)]
    pub(crate) exporter: MetricExporter,

    /// Interval between exports (in milliseconds).
    ///
    /// Default: 60000ms (1 minute) per [SDK specification](https://opentelemetry.io/docs/specs/otel/metrics/sdk/#periodic-exporting-metricreader).
    #[config(default = 60000)]
    pub(crate) interval: u64,

    /// Export timeout (in milliseconds).
    ///
    /// Default: 30000ms per [SDK specification](https://opentelemetry.io/docs/specs/otel/metrics/sdk/#periodic-exporting-metricreader).
    #[config(default = 30000)]
    pub(crate) timeout: u64,
}

/// Pull-based metric reader configuration.
///
/// Used for scrape-based collection (e.g., Prometheus).
#[configuration]
pub(crate) struct PullMetricReaderConfig {
    /// Exporter configuration.
    #[config(required)]
    pub(crate) exporter: MetricExporter,
}