mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
## Summary - add SQLite init, backfill-gate, and fallback telemetry without introducing a cross-cutting state-db access wrapper - install one process-scoped telemetry sink after OTEL startup and let low-level state/rollout paths emit through it directly - add process-start metrics for the process owners that initialize SQLite --------- Co-authored-by: Owen Lin <owen@openai.com>
42 lines
1.2 KiB
Rust
42 lines
1.2 KiB
Rust
mod client;
|
|
mod config;
|
|
mod error;
|
|
pub(crate) mod names;
|
|
mod process;
|
|
pub(crate) mod runtime_metrics;
|
|
pub(crate) mod tags;
|
|
pub(crate) mod timer;
|
|
pub(crate) mod validation;
|
|
|
|
use crate::config::StatsigMetricsSettings;
|
|
pub use crate::metrics::client::MetricsClient;
|
|
pub use crate::metrics::config::MetricsConfig;
|
|
pub use crate::metrics::config::MetricsExporter;
|
|
pub use crate::metrics::error::MetricsError;
|
|
pub use crate::metrics::error::Result;
|
|
pub use crate::metrics::process::record_process_start_once;
|
|
pub use names::*;
|
|
use std::sync::OnceLock;
|
|
pub use tags::ORIGINATOR_TAG;
|
|
pub use tags::SessionMetricTagValues;
|
|
pub use tags::bounded_originator_tag_value;
|
|
|
|
static GLOBAL_METRICS: OnceLock<MetricsClient> = OnceLock::new();
|
|
static GLOBAL_STATSIG_METRICS_SETTINGS: OnceLock<StatsigMetricsSettings> = OnceLock::new();
|
|
|
|
pub(crate) fn install_global(metrics: MetricsClient) {
|
|
let _ = GLOBAL_METRICS.set(metrics);
|
|
}
|
|
|
|
pub fn global() -> Option<MetricsClient> {
|
|
GLOBAL_METRICS.get().cloned()
|
|
}
|
|
|
|
pub(crate) fn install_global_statsig_settings(settings: StatsigMetricsSettings) {
|
|
let _ = GLOBAL_STATSIG_METRICS_SETTINGS.set(settings);
|
|
}
|
|
|
|
pub(crate) fn global_statsig_settings() -> Option<StatsigMetricsSettings> {
|
|
GLOBAL_STATSIG_METRICS_SETTINGS.get().cloned()
|
|
}
|