mirror of
https://github.com/openai/codex.git
synced 2026-09-06 15:29:32 +00:00
Expose global metrics installation in codex-otel (#42603)
## What changed Add `install_global_metrics` as the public entry point for installing an externally managed, non-Statsig `MetricsClient` during single-threaded startup. The returned handle retains ownership of the installed exporter so callers can flush and shut it down. GitOrigin-RevId: 1108a0468588046e5cc8266d2af6143f14456d82
This commit is contained in:
@@ -69,6 +69,15 @@ impl From<AuthMode> for TelemetryAuthMode {
|
||||
}
|
||||
}
|
||||
|
||||
/// Install externally managed, non-Statsig process-global metrics.
|
||||
///
|
||||
/// Call this once during single-threaded startup, before any instruments are
|
||||
/// registered. Keep the returned handle to flush and shut down the exporter
|
||||
/// owned by this installation.
|
||||
pub fn install_global_metrics(metrics: MetricsClient) -> MetricsClient {
|
||||
crate::metrics::install_global(metrics)
|
||||
}
|
||||
|
||||
/// Start a metrics timer using the globally installed metrics client.
|
||||
pub fn start_global_timer(name: &str, tags: &[(&str, &str)]) -> MetricsResult<Timer> {
|
||||
let Some(metrics) = crate::metrics::global() else {
|
||||
|
||||
Reference in New Issue
Block a user