aKode fase 2c: eliminato il codice di invio dati (crate analytics, otel-trace-websocket, sentry, esportatori OTLP); /feedback salva solo in locale; chiavi legacy [analytics]/[otel] accettate e ignorate; test di analytics/OTLP/upload rimossi
Some checks failed
blocking-ci / rust-ci (push) Has been cancelled
blocking-ci / sdk (push) Has been cancelled
blocking-ci / CI required (push) Has been cancelled
blocking-ci / Bazel (push) Has been cancelled
blocking-ci / Blob size policy (push) Has been cancelled
blocking-ci / cargo-deny (push) Has been cancelled
blocking-ci / Codespell (push) Has been cancelled
blocking-ci / repo-checks (push) Has been cancelled
postmerge-ci / rust-ci-full (push) Has been cancelled
postmerge-ci / v8-canary (push) Has been cancelled
postmerge-ci / Postmerge CI results (push) Has been cancelled

This commit is contained in:
Andrea
2026-11-09 18:45:41 +01:00
parent 981745ccc8
commit 60532b6337
509 changed files with 2043 additions and 46606 deletions

View File

@@ -0,0 +1,59 @@
//! Turn profile and critical-path summaries, used for local tracing and local metrics only.
//! Missing capture never becomes a zero-duration measurement.
/// Capture coverage for one finalized turn, independent of its completion status.
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub(crate) enum TurnCriticalPath {
#[default]
Disabled,
Incomplete,
Complete(TurnCriticalPathDurations),
}
impl TurnCriticalPath {
pub(crate) fn status(&self) -> &'static str {
match self {
Self::Disabled => "disabled",
Self::Incomplete => "incomplete",
Self::Complete(_) => "complete",
}
}
pub(crate) fn durations(&self) -> Option<&TurnCriticalPathDurations> {
match self {
Self::Complete(durations) => Some(durations),
Self::Disabled | Self::Incomplete => None,
}
}
}
/// Category totals over the server turn interval, truncated to milliseconds.
/// Inference is the compatibility total of sampling and compaction, not another leaf.
#[derive(Clone, Debug, PartialEq, Eq)]
pub(crate) struct TurnCriticalPathDurations {
pub(crate) duration_ms: u64,
pub(crate) inference_ms: u64,
pub(crate) sampling_ms: u64,
pub(crate) compaction_ms: u64,
pub(crate) auto_review_ms: u64,
/// Portion of auto_review_ms outside observed Guardian turn execution; not additive.
pub(crate) auto_review_overhead_ms: Option<u64>,
pub(crate) user_wait_ms: u64,
pub(crate) tools_ms: u64,
pub(crate) overhead_ms: u64,
pub(crate) unknown_ms: u64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub(crate) struct TurnProfile {
pub(crate) critical_path: TurnCriticalPath,
pub(crate) before_first_sampling_ms: u64,
pub(crate) sampling_ms: u64,
pub(crate) compaction_ms: u64,
pub(crate) between_sampling_overhead_ms: u64,
pub(crate) tool_blocking_ms: u64,
pub(crate) after_last_sampling_ms: u64,
pub(crate) sampling_request_count: u32,
pub(crate) sampling_retry_count: u32,
pub(crate) tools_change_count: u32,
}

View File

@@ -1,9 +1,9 @@
//! Report the frozen critical path over the same interval as the turn profile.
use super::TurnCriticalPath;
use super::TurnCriticalPathDurations;
use super::TurnProfileState;
use super::duration_to_u64_ms;
use codex_analytics::TurnCriticalPath;
use codex_analytics::TurnCriticalPathDurations;
use codex_otel::TURN_CRITICAL_PATH_CAPTURE_METRIC;
use codex_otel::TURN_CRITICAL_PATH_COMPONENT_METRIC;
use codex_otel::TURN_CRITICAL_PATH_DURATION_METRIC;
@@ -31,10 +31,7 @@ pub(super) fn completed_critical_path(state: &TurnProfileState, end: Instant) ->
})
}
pub(super) fn record_turn_profile_metrics(
turn: &super::TurnContext,
profile: &codex_analytics::TurnProfile,
) {
pub(super) fn record_turn_profile_metrics(turn: &super::TurnContext, profile: &super::TurnProfile) {
let telemetry = &turn.session_telemetry;
let sku = codex_otel::bounded_product_sku(turn.config.apps_mcp_product_sku.as_deref())
.unwrap_or("unknown");