mirror of
https://github.com/openai/codex.git
synced 2026-10-20 00:18:49 +00:00
Tag Codex home size metrics with compression state (#42043)
## What changed Add a `compression_enabled` attribute to each `codex.app_server.codex_home.size_bytes` sample. The value reflects whether `LocalThreadStoreCompression` is enabled in the effective startup configuration. GitOrigin-RevId: c087d36b4e578245aee6cfe5257075dfd3bdd025
This commit is contained in:
@@ -2,13 +2,15 @@
|
||||
//!
|
||||
//! The background scan sums regular-file lengths, without reading file contents or
|
||||
//! following symlinks. Incomplete scans emit no samples, and shutdown cancels the scan.
|
||||
//! The compression tag reflects the effective startup config, not compression completion.
|
||||
|
||||
use codex_core::config::Config;
|
||||
use codex_features::Feature;
|
||||
use codex_otel::MetricsClient;
|
||||
use codex_rollout::ARCHIVED_SESSIONS_SUBDIR;
|
||||
use codex_rollout::SESSIONS_SUBDIR;
|
||||
use std::io;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use tokio::task::JoinHandle;
|
||||
use tokio_util::sync::CancellationToken;
|
||||
|
||||
@@ -25,10 +27,15 @@ const SIZE_BYTES_BOUNDARIES: &[f64] = &[
|
||||
];
|
||||
|
||||
pub(crate) fn spawn(
|
||||
codex_home: PathBuf,
|
||||
config: &Config,
|
||||
metrics: MetricsClient,
|
||||
shutdown: CancellationToken,
|
||||
) -> JoinHandle<()> {
|
||||
let codex_home = config.codex_home.to_path_buf();
|
||||
let compression_enabled = config
|
||||
.features
|
||||
.enabled(Feature::LocalThreadStoreCompression)
|
||||
.to_string();
|
||||
tokio::task::spawn_blocking(move || {
|
||||
let sizes = match directory_sizes(&codex_home, &shutdown) {
|
||||
Ok(sizes) => sizes,
|
||||
@@ -46,7 +53,10 @@ pub(crate) fn spawn(
|
||||
SIZE_BYTES_METRIC,
|
||||
i64::try_from(bytes).unwrap_or(i64::MAX),
|
||||
SIZE_BYTES_BOUNDARIES,
|
||||
&[("directory", directory)],
|
||||
&[
|
||||
("directory", directory),
|
||||
("compression_enabled", compression_enabled.as_str()),
|
||||
],
|
||||
);
|
||||
}
|
||||
})
|
||||
|
||||
@@ -823,11 +823,7 @@ pub async fn run_main_with_transport_options(
|
||||
|
||||
// Only the standalone server measures its local home, not embedded/cloud runtimes.
|
||||
if let Some(metrics) = otel.as_ref().and_then(codex_otel::OtelProvider::metrics) {
|
||||
codex_home_metrics::spawn(
|
||||
config.codex_home.to_path_buf(),
|
||||
metrics.clone(),
|
||||
transport_shutdown_token.clone(),
|
||||
);
|
||||
codex_home_metrics::spawn(&config, metrics.clone(), transport_shutdown_token.clone());
|
||||
}
|
||||
|
||||
let otel_reloader_handle = otel_reloader::spawn(
|
||||
|
||||
Reference in New Issue
Block a user