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
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:
@@ -36,10 +36,6 @@ use codex_history::RolloutItem;
|
||||
use codex_login::CodexAuth;
|
||||
use codex_mcp::CODEX_APPS_MCP_SERVER_NAME;
|
||||
use codex_models_manager::bundled_models_response;
|
||||
use codex_otel::OtelExporter;
|
||||
use codex_otel::OtelHttpProtocol;
|
||||
use codex_otel::OtelProvider;
|
||||
use codex_otel::OtelSettings;
|
||||
use codex_otel::THREAD_SKILLS_KEPT_TOTAL_METRIC;
|
||||
use codex_protocol::capabilities::CapabilityRootLocation;
|
||||
use codex_protocol::capabilities::SelectedCapabilityRoot;
|
||||
@@ -120,16 +116,13 @@ use opentelemetry_sdk::metrics::data::MetricData;
|
||||
use pretty_assertions::assert_eq;
|
||||
use serde_json::Value;
|
||||
use serde_json::json;
|
||||
use sha1::Digest;
|
||||
use tempfile::TempDir;
|
||||
use test_case::test_case;
|
||||
use tokio::time::Duration;
|
||||
use tokio::time::Instant;
|
||||
use toml::toml;
|
||||
use tracing::Level;
|
||||
use tracing_subscriber::fmt::format::FmtSpan;
|
||||
use tracing_test::internal::MockWriter;
|
||||
use wiremock::MockServer;
|
||||
|
||||
#[path = "skills_extension/cloud_skill_tests.rs"]
|
||||
mod cloud_skill_tests;
|
||||
@@ -381,25 +374,6 @@ fn catalog_extensions(
|
||||
(Arc::new(extensions.build()), event_rx)
|
||||
}
|
||||
|
||||
async fn wait_for_analytics_events(
|
||||
server: &MockServer,
|
||||
event_type: &str,
|
||||
expected_count: usize,
|
||||
) -> Vec<Value> {
|
||||
let deadline = Instant::now() + Duration::from_secs(10);
|
||||
loop {
|
||||
let events = responses::received_analytics_events(server, event_type).await;
|
||||
if events.len() >= expected_count {
|
||||
return events;
|
||||
}
|
||||
assert!(
|
||||
Instant::now() < deadline,
|
||||
"timed out waiting for {event_type} analytics"
|
||||
);
|
||||
tokio::time::sleep(Duration::from_millis(50)).await;
|
||||
}
|
||||
}
|
||||
|
||||
fn configure_catalog_test(config: &mut Config) {
|
||||
config.include_skill_instructions = true;
|
||||
config
|
||||
@@ -2562,15 +2536,6 @@ async fn executor_skill_invocation_is_environment_scoped_and_deduplicated() -> R
|
||||
);
|
||||
}
|
||||
|
||||
let events = wait_for_analytics_events(&server, "skill_invocation", /*expected_count*/ 1).await;
|
||||
assert_eq!(events.len(), 1, "executor skill should be counted once");
|
||||
assert_eq!(events[0]["skill_name"], "selected-environment-skill");
|
||||
assert_eq!(
|
||||
events[0]["skill_id"],
|
||||
format!("{:x}", sha1::Sha1::digest(SELECTED_RESOURCE.as_bytes()))
|
||||
);
|
||||
assert_eq!(events[0]["event_params"]["invoke_type"], "implicit");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -2732,27 +2697,16 @@ async fn assert_catalog_model_switch(max_context_tokens: Option<usize>) -> Resul
|
||||
)
|
||||
.await;
|
||||
let codex_home = Arc::new(TempDir::new()?);
|
||||
// Use the normal metrics sink to verify core's model attribution.
|
||||
let telemetry = OtelProvider::try_new(&OtelSettings {
|
||||
http_client_factory: codex_core::test_support::default_http_client_factory(),
|
||||
environment: "test".to_string(),
|
||||
service_name: "skills-model-switch".to_string(),
|
||||
service_version: env!("CARGO_PKG_VERSION").to_string(),
|
||||
codex_home: codex_home.path().to_path_buf(),
|
||||
exporter: OtelExporter::None,
|
||||
trace_exporter: OtelExporter::None,
|
||||
metrics_exporter: OtelExporter::OtlpHttp {
|
||||
endpoint: format!("{}/metrics", server.uri()),
|
||||
headers: Default::default(),
|
||||
protocol: OtelHttpProtocol::Json,
|
||||
tls: None,
|
||||
},
|
||||
runtime_metrics: true,
|
||||
span_attributes: Default::default(),
|
||||
tracestate: Default::default(),
|
||||
})
|
||||
.map_err(|error| anyhow::anyhow!("{error}"))?
|
||||
.expect("metrics provider");
|
||||
// Use the process-global local metrics sink to verify core's model attribution.
|
||||
let telemetry = codex_otel::install_global_metrics(codex_otel::MetricsClient::new(
|
||||
codex_otel::MetricsConfig::in_memory(
|
||||
"test",
|
||||
"skills-model-switch",
|
||||
env!("CARGO_PKG_VERSION"),
|
||||
opentelemetry_sdk::metrics::InMemoryMetricExporter::default(),
|
||||
)
|
||||
.with_runtime_reader(),
|
||||
)?);
|
||||
let skill_count = 800;
|
||||
let catalog = SkillCatalog {
|
||||
is_partial: false,
|
||||
@@ -2932,7 +2886,7 @@ async fn assert_catalog_model_switch(max_context_tokens: Option<usize>) -> Resul
|
||||
expected_warnings.dedup();
|
||||
assert_eq!(warnings, expected_warnings);
|
||||
|
||||
let snapshot = telemetry.metrics().expect("metrics client").snapshot()?;
|
||||
let snapshot = telemetry.snapshot()?;
|
||||
let metric = snapshot
|
||||
.scope_metrics()
|
||||
.flat_map(opentelemetry_sdk::metrics::data::ScopeMetrics::metrics)
|
||||
@@ -2964,9 +2918,7 @@ async fn assert_catalog_model_switch(max_context_tokens: Option<usize>) -> Resul
|
||||
(MODEL_B.to_string(), 1, included_counts[1] as f64),
|
||||
]
|
||||
);
|
||||
telemetry
|
||||
.shutdown_with_timeout(Duration::from_secs(/*secs*/ 5))
|
||||
.await?;
|
||||
telemetry.shutdown()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -3261,17 +3213,6 @@ async fn production_turn_uses_provider_host_catalog_and_core_snapshot_injection(
|
||||
let user_text = request.message_input_texts("user").join("\n");
|
||||
assert!(user_text.contains(&snapshot_contents));
|
||||
assert!(!user_text.contains(provider_contents));
|
||||
let app_mentioned_events =
|
||||
wait_for_analytics_events(&server, "codex_app_mentioned", /*expected_count*/ 1).await;
|
||||
let app_mentioned_event = &app_mentioned_events[0];
|
||||
assert_eq!(
|
||||
app_mentioned_event["event_params"]["connector_id"],
|
||||
"calendar"
|
||||
);
|
||||
assert_eq!(
|
||||
app_mentioned_event["event_params"]["invoke_type"],
|
||||
"explicit"
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user