chore: add metrics for profile (#15180)

This commit is contained in:
jif-oai 2026-03-19 15:48:02 +00:00 committed by GitHub
parent dee03da508
commit 2cf4d5ef35
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 0 deletions

View file

@ -9,6 +9,7 @@ use crate::metrics::MetricsError;
use crate::metrics::Result as MetricsResult;
use crate::metrics::names::API_CALL_COUNT_METRIC;
use crate::metrics::names::API_CALL_DURATION_METRIC;
use crate::metrics::names::PROFILE_USAGE_METRIC;
use crate::metrics::names::RESPONSES_API_ENGINE_IAPI_TBT_DURATION_METRIC;
use crate::metrics::names::RESPONSES_API_ENGINE_IAPI_TTFT_DURATION_METRIC;
use crate::metrics::names::RESPONSES_API_ENGINE_SERVICE_TBT_DURATION_METRIC;
@ -321,6 +322,9 @@ impl SessionTelemetry {
mcp_servers: Vec<&str>,
active_profile: Option<String>,
) {
if active_profile.is_some() {
self.counter(PROFILE_USAGE_METRIC, /*inc*/ 1, &[]);
}
log_and_trace_event!(
self,
common: {

View file

@ -25,6 +25,7 @@ pub const TURN_TTFM_DURATION_METRIC: &str = "codex.turn.ttfm.duration_ms";
pub const TURN_NETWORK_PROXY_METRIC: &str = "codex.turn.network_proxy";
pub const TURN_TOOL_CALL_METRIC: &str = "codex.turn.tool.call";
pub const TURN_TOKEN_USAGE_METRIC: &str = "codex.turn.token_usage";
pub const PROFILE_USAGE_METRIC: &str = "codex.profile.usage";
/// Total runtime of a startup prewarm attempt until it completes, tagged by final status.
pub const STARTUP_PREWARM_DURATION_METRIC: &str = "codex.startup_prewarm.duration_ms";
/// Age of the startup prewarm attempt when the first real turn resolves it, tagged by outcome.