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

@@ -1,17 +1,12 @@
//! Maps OTEL requirements and masks exporter credentials in app-server responses.
//! Maps local-logging OTEL requirements and masks legacy exporter credentials in
//! app-server responses. Telemetry exporters were removed; legacy exporter keys can
//! still appear in user config layers, so their header values stay redacted.
use codex_app_server_protocol::OtelExporter;
use codex_app_server_protocol::OtelHttpProtocol;
use codex_app_server_protocol::OtelRequirements;
use codex_app_server_protocol::OtelTlsConfig;
use codex_app_server_protocol::OtelToolResultLogConfig;
use codex_app_server_protocol::SerdeRedactedString;
use codex_config::OtelRequirementsToml;
use codex_config::types::OtelExporterKind;
use codex_config::types::OtelHttpProtocol as CoreOtelHttpProtocol;
use codex_config::types::OtelTlsConfig as CoreOtelTlsConfig;
use serde_json::Value as JsonValue;
use std::collections::HashMap;
pub(crate) fn map_otel_requirements_to_api(otel: OtelRequirementsToml) -> OtelRequirements {
OtelRequirements {
@@ -20,58 +15,6 @@ pub(crate) fn map_otel_requirements_to_api(otel: OtelRequirementsToml) -> OtelRe
}),
log_sse_deltas: otel.log_sse_deltas,
log_user_prompt: otel.log_user_prompt,
log_agent_responses: otel.log_agent_responses,
log_guardian_assessments: otel.log_guardian_assessments,
environment: otel.environment,
exporter: otel.exporter.map(map_otel_exporter_to_api),
trace_exporter: otel.trace_exporter.map(map_otel_exporter_to_api),
metrics_exporter: otel.metrics_exporter.map(map_otel_exporter_to_api),
span_attributes: otel.span_attributes,
tracestate: otel.tracestate,
}
}
fn map_otel_exporter_to_api(exporter: OtelExporterKind) -> OtelExporter {
let response_headers = |headers: HashMap<String, _>| {
headers
.into_iter()
.map(|(name, value)| (name, SerdeRedactedString::from(value)))
.collect()
};
match exporter {
OtelExporterKind::None => OtelExporter::None,
OtelExporterKind::Statsig => OtelExporter::Statsig,
OtelExporterKind::OtlpHttp {
endpoint,
headers,
protocol,
tls,
} => OtelExporter::OtlpHttp {
endpoint,
headers: response_headers(headers),
protocol: match protocol {
CoreOtelHttpProtocol::Binary => OtelHttpProtocol::Binary,
CoreOtelHttpProtocol::Json => OtelHttpProtocol::Json,
},
tls: tls.map(map_otel_tls_to_api),
},
OtelExporterKind::OtlpGrpc {
endpoint,
headers,
tls,
} => OtelExporter::OtlpGrpc {
endpoint,
headers: response_headers(headers),
tls: tls.map(map_otel_tls_to_api),
},
}
}
fn map_otel_tls_to_api(tls: CoreOtelTlsConfig) -> OtelTlsConfig {
OtelTlsConfig {
ca_certificate: tls.ca_certificate.map(Into::into),
client_certificate: tls.client_certificate.map(Into::into),
client_private_key: tls.client_private_key.map(Into::into),
}
}