diff --git a/examples/self-diagnostics/src/main.rs b/examples/self-diagnostics/src/main.rs index 6a4ebe94fc..63ed117a33 100644 --- a/examples/self-diagnostics/src/main.rs +++ b/examples/self-diagnostics/src/main.rs @@ -1,4 +1,4 @@ -use opentelemetry::global::{self, Error as OtelError}; +use opentelemetry::global; use opentelemetry::KeyValue; use opentelemetry_appender_tracing::layer; use opentelemetry_otlp::{LogExporter, MetricExporter, WithExportConfig}; @@ -7,10 +7,6 @@ use tracing_subscriber::prelude::*; use std::error::Error; -use once_cell::sync::Lazy; -use std::collections::HashSet; -use std::sync::{Arc, Mutex}; - use std::sync::mpsc::channel; fn init_logger_provider() -> opentelemetry_sdk::logs::LoggerProvider { diff --git a/opentelemetry-otlp/examples/basic-otlp-http/src/main.rs b/opentelemetry-otlp/examples/basic-otlp-http/src/main.rs index c67d6b21c5..10365606f0 100644 --- a/opentelemetry-otlp/examples/basic-otlp-http/src/main.rs +++ b/opentelemetry-otlp/examples/basic-otlp-http/src/main.rs @@ -2,7 +2,6 @@ use once_cell::sync::Lazy; use opentelemetry::{ global, - metrics::MetricError, trace::{TraceContextExt, TraceError, Tracer}, InstrumentationScope, KeyValue, }; @@ -11,7 +10,7 @@ use opentelemetry_otlp::WithExportConfig; use opentelemetry_otlp::{LogExporter, MetricExporter, Protocol, SpanExporter}; use opentelemetry_sdk::{ logs::LoggerProvider, - metrics::{PeriodicReader, SdkMeterProvider}, + metrics::{MetricError, PeriodicReader, SdkMeterProvider}, runtime, trace::{self as sdktrace, Config, TracerProvider}, }; @@ -31,7 +30,7 @@ static RESOURCE: Lazy = Lazy::new(|| { )]) }); -fn init_logs() -> Result { +fn init_logs() -> Result { let exporter = LogExporter::builder() .with_http() .with_endpoint("http://localhost:4318/v1/logs") diff --git a/opentelemetry-otlp/examples/basic-otlp/src/main.rs b/opentelemetry-otlp/examples/basic-otlp/src/main.rs index 0f99248bfd..96242458a3 100644 --- a/opentelemetry-otlp/examples/basic-otlp/src/main.rs +++ b/opentelemetry-otlp/examples/basic-otlp/src/main.rs @@ -1,12 +1,12 @@ use once_cell::sync::Lazy; -use opentelemetry::logs::LogError; -use opentelemetry::metrics::MetricError; use opentelemetry::trace::{TraceContextExt, TraceError, Tracer}; use opentelemetry::KeyValue; use opentelemetry::{global, InstrumentationScope}; use opentelemetry_appender_tracing::layer::OpenTelemetryTracingBridge; use opentelemetry_otlp::{LogExporter, MetricExporter, SpanExporter, WithExportConfig}; +use opentelemetry_sdk::logs::LogError; use opentelemetry_sdk::logs::LoggerProvider; +use opentelemetry_sdk::metrics::MetricError; use opentelemetry_sdk::metrics::{PeriodicReader, SdkMeterProvider}; use opentelemetry_sdk::trace::Config; use opentelemetry_sdk::{runtime, trace as sdktrace, Resource}; diff --git a/opentelemetry-otlp/src/lib.rs b/opentelemetry-otlp/src/lib.rs index 4429f6fda9..c8d7c0308a 100644 --- a/opentelemetry-otlp/src/lib.rs +++ b/opentelemetry-otlp/src/lib.rs @@ -391,6 +391,12 @@ impl ExportError for Error { } } +impl opentelemetry::trace::ExportError for Error { + fn exporter_name(&self) -> &'static str { + "otlp" + } +} + /// The communication protocol to use when exporting data. #[cfg_attr(feature = "serialize", derive(Deserialize, Serialize))] #[derive(Clone, Copy, Debug, Eq, PartialEq)] diff --git a/opentelemetry-otlp/tests/integration_test/tests/logs.rs b/opentelemetry-otlp/tests/integration_test/tests/logs.rs index 4e437bb069..c06e7e41ac 100644 --- a/opentelemetry-otlp/tests/integration_test/tests/logs.rs +++ b/opentelemetry-otlp/tests/integration_test/tests/logs.rs @@ -2,10 +2,10 @@ use integration_test_runner::logs_asserter::{read_logs_from_json, LogsAsserter}; use log::{info, Level}; -use opentelemetry::logs::LogError; use opentelemetry::KeyValue; use opentelemetry_appender_log::OpenTelemetryLogBridge; use opentelemetry_otlp::{LogExporter, WithExportConfig}; +use opentelemetry_sdk::logs::LogError; use opentelemetry_sdk::logs::LoggerProvider; use opentelemetry_sdk::{logs as sdklogs, runtime, Resource}; use std::error::Error; diff --git a/opentelemetry-zipkin/src/exporter/mod.rs b/opentelemetry-zipkin/src/exporter/mod.rs index e7466c6a2d..1ddd6c2b5b 100644 --- a/opentelemetry-zipkin/src/exporter/mod.rs +++ b/opentelemetry-zipkin/src/exporter/mod.rs @@ -252,3 +252,9 @@ impl ExportError for Error { "zipkin" } } + +impl opentelemetry::trace::ExportError for Error { + fn exporter_name(&self) -> &'static str { + "zipkin" + } +}