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:
@@ -1,20 +1,12 @@
|
||||
//! Exercises global operation buffering across shutdown and rejected configuration changes.
|
||||
//! Exercises global operation buffering across shutdown and replacement installations.
|
||||
|
||||
use codex_http_client::HttpClientFactory;
|
||||
use codex_http_client::OutboundProxyPolicy;
|
||||
use codex_otel::MetricsClient;
|
||||
use codex_otel::MetricsConfig;
|
||||
use codex_otel::OtelExporter;
|
||||
use codex_otel::OtelHttpProtocol;
|
||||
use codex_otel::OtelProvider;
|
||||
use codex_otel::OtelSettings;
|
||||
use codex_otel::install_global_metrics;
|
||||
use codex_otel::record_global_operation;
|
||||
use opentelemetry_sdk::metrics::data::AggregatedMetrics;
|
||||
use opentelemetry_sdk::metrics::data::MetricData;
|
||||
use pretty_assertions::assert_eq;
|
||||
use std::collections::BTreeMap;
|
||||
use std::collections::HashMap;
|
||||
use std::time::Duration;
|
||||
|
||||
fn install() -> MetricsClient {
|
||||
@@ -76,51 +68,3 @@ fn shutdown_buffers_until_replacement_and_preserves_newer_installations() {
|
||||
assert_eq!(totals(&third), (1, 1, 7.0));
|
||||
third.shutdown().unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rejected_opt_out_preserves_recording_and_accepted_opt_out_survives_shutdown() {
|
||||
let metrics = install();
|
||||
let mut settings = OtelSettings {
|
||||
http_client_factory: HttpClientFactory::new(OutboundProxyPolicy::ReqwestDefault),
|
||||
environment: "test".to_string(),
|
||||
service_name: "test".to_string(),
|
||||
service_version: "1".to_string(),
|
||||
codex_home: ".".into(),
|
||||
exporter: OtelExporter::None,
|
||||
trace_exporter: OtelExporter::OtlpHttp {
|
||||
endpoint: "http://127.0.0.1:1/v1/traces".to_string(),
|
||||
headers: Default::default(),
|
||||
protocol: OtelHttpProtocol::Json,
|
||||
tls: None,
|
||||
},
|
||||
metrics_exporter: OtelExporter::None,
|
||||
runtime_metrics: false,
|
||||
span_attributes: HashMap::from([(String::new(), "invalid".to_string())]),
|
||||
tracestate: BTreeMap::new(),
|
||||
};
|
||||
assert_eq!(
|
||||
OtelProvider::try_new(&settings).err().unwrap().to_string(),
|
||||
"configured span attribute key must not be empty"
|
||||
);
|
||||
observe();
|
||||
assert_eq!(totals(&metrics), (1, 1, 7.0));
|
||||
|
||||
metrics.shutdown().unwrap();
|
||||
observe();
|
||||
assert!(OtelProvider::try_new(&settings).is_err());
|
||||
let replacement = install();
|
||||
assert_eq!(totals(&replacement), (1, 1, 7.0));
|
||||
replacement.shutdown().unwrap();
|
||||
|
||||
settings.span_attributes.clear();
|
||||
for trace_exporter in [settings.trace_exporter.clone(), OtelExporter::None] {
|
||||
let metrics = install();
|
||||
settings.trace_exporter = trace_exporter;
|
||||
let _provider = OtelProvider::try_new(&settings).unwrap();
|
||||
metrics.shutdown().unwrap();
|
||||
observe();
|
||||
let replacement = install();
|
||||
assert_eq!(totals(&replacement), (0, 0, 0.0));
|
||||
replacement.shutdown().unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user