diff --git a/opentelemetry-api/src/baggage.rs b/opentelemetry-api/src/baggage.rs index 9b7aef89d6..dc8de3914d 100644 --- a/opentelemetry-api/src/baggage.rs +++ b/opentelemetry-api/src/baggage.rs @@ -70,7 +70,7 @@ impl Baggage { /// # Examples /// /// ``` - /// use opentelemetry_api::{baggage::Baggage, Value}; + /// use opentelemetry::{baggage::Baggage, Value}; /// /// let mut cc = Baggage::new(); /// let _ = cc.insert("my-name", "my-value"); @@ -85,7 +85,7 @@ impl Baggage { /// /// # Examples /// ``` - /// use opentelemetry_api::{baggage::{Baggage, BaggageMetadata}, Value}; + /// use opentelemetry::{baggage::{Baggage, BaggageMetadata}, Value}; /// /// let mut cc = Baggage::new(); /// let _ = cc.insert("my-name", "my-value"); @@ -105,7 +105,7 @@ impl Baggage { /// # Examples /// /// ``` - /// use opentelemetry_api::{baggage::Baggage, Value}; + /// use opentelemetry::{baggage::Baggage, Value}; /// /// let mut cc = Baggage::new(); /// let _ = cc.insert("my-name", "my-value"); @@ -129,7 +129,7 @@ impl Baggage { /// # Examples /// /// ``` - /// use opentelemetry_api::{baggage::{Baggage, BaggageMetadata}, Value}; + /// use opentelemetry::{baggage::{Baggage, BaggageMetadata}, Value}; /// /// let mut cc = Baggage::new(); /// let _ = cc.insert_with_metadata("my-name", "my-value", "test"); @@ -306,7 +306,7 @@ pub trait BaggageExt { /// # Examples /// /// ``` - /// use opentelemetry_api::{baggage::BaggageExt, Context, KeyValue, Value}; + /// use opentelemetry::{baggage::BaggageExt, Context, KeyValue, Value}; /// /// let cx = Context::map_current(|cx| { /// cx.with_baggage(vec![KeyValue::new("my-name", "my-value")]) @@ -327,7 +327,7 @@ pub trait BaggageExt { /// # Examples /// /// ``` - /// use opentelemetry_api::{baggage::BaggageExt, Context, KeyValue, Value}; + /// use opentelemetry::{baggage::BaggageExt, Context, KeyValue, Value}; /// /// let cx = Context::current_with_baggage(vec![KeyValue::new("my-name", "my-value")]); /// @@ -345,7 +345,7 @@ pub trait BaggageExt { /// # Examples /// /// ``` - /// use opentelemetry_api::{baggage::BaggageExt, Context, KeyValue, Value}; + /// use opentelemetry::{baggage::BaggageExt, Context, KeyValue, Value}; /// /// let cx = Context::map_current(|cx| cx.with_cleared_baggage()); /// diff --git a/opentelemetry-api/src/common.rs b/opentelemetry-api/src/common.rs index 675852c2b9..13949a89f5 100644 --- a/opentelemetry-api/src/common.rs +++ b/opentelemetry-api/src/common.rs @@ -16,7 +16,7 @@ impl Key { /// # Examples /// /// ``` - /// use opentelemetry_api::Key; + /// use opentelemetry::Key; /// use std::sync::Arc; /// /// let key1 = Key::new("my_static_str"); @@ -449,7 +449,7 @@ pub struct InstrumentationLibrary { /// # Examples /// /// ``` - /// let library = opentelemetry_api::InstrumentationLibrary::new( + /// let library = opentelemetry::InstrumentationLibrary::new( /// "my-crate", /// Some(env!("CARGO_PKG_VERSION")), /// Some("https://opentelemetry.io/schemas/1.17.0"), diff --git a/opentelemetry-api/src/context.rs b/opentelemetry-api/src/context.rs index 698602891b..065d240d8a 100644 --- a/opentelemetry-api/src/context.rs +++ b/opentelemetry-api/src/context.rs @@ -44,7 +44,7 @@ thread_local! { /// # Examples /// /// ``` -/// use opentelemetry_api::Context; +/// use opentelemetry::Context; /// /// // Application-specific `a` and `b` values /// #[derive(Debug, PartialEq)] @@ -93,7 +93,7 @@ impl Context { /// # Examples /// /// ``` - /// use opentelemetry_api::Context; + /// use opentelemetry::Context; /// /// #[derive(Debug, PartialEq)] /// struct ValueA(&'static str); @@ -129,7 +129,7 @@ impl Context { /// # Examples /// /// ``` - /// use opentelemetry_api::Context; + /// use opentelemetry::Context; /// /// // Given some value types defined in your application /// #[derive(Debug, PartialEq)] @@ -161,7 +161,7 @@ impl Context { /// # Examples /// /// ``` - /// use opentelemetry_api::Context; + /// use opentelemetry::Context; /// /// // Given some value types defined in your application /// #[derive(Debug, PartialEq)] @@ -188,7 +188,7 @@ impl Context { /// # Examples /// /// ``` - /// use opentelemetry_api::Context; + /// use opentelemetry::Context; /// /// // Given some value types defined in your application /// #[derive(Debug, PartialEq)] @@ -228,7 +228,7 @@ impl Context { /// # Examples /// /// ``` - /// use opentelemetry_api::Context; + /// use opentelemetry::Context; /// /// #[derive(Debug, PartialEq)] /// struct ValueA(&'static str); @@ -247,7 +247,7 @@ impl Context { /// Guards do not need to be explicitly dropped: /// /// ``` - /// use opentelemetry_api::Context; + /// use opentelemetry::Context; /// /// #[derive(Debug, PartialEq)] /// struct ValueA(&'static str); @@ -274,7 +274,7 @@ impl Context { /// entered: /// /// ``` - /// use opentelemetry_api::Context; + /// use opentelemetry::Context; /// /// #[derive(Debug, PartialEq)] /// struct ValueA(&'static str); diff --git a/opentelemetry-api/src/global/metrics.rs b/opentelemetry-api/src/global/metrics.rs index 31edcf983b..549a4fc24c 100644 --- a/opentelemetry-api/src/global/metrics.rs +++ b/opentelemetry-api/src/global/metrics.rs @@ -135,8 +135,8 @@ pub fn meter(name: impl Into>) -> Meter { /// # Example /// /// ``` -/// use opentelemetry_api::global::meter_with_version; -/// use opentelemetry_api::KeyValue; +/// use opentelemetry::global::meter_with_version; +/// use opentelemetry::KeyValue; /// /// let meter = meter_with_version( /// "io.opentelemetry", diff --git a/opentelemetry-api/src/global/mod.rs b/opentelemetry-api/src/global/mod.rs index 423565aea7..790343968c 100644 --- a/opentelemetry-api/src/global/mod.rs +++ b/opentelemetry-api/src/global/mod.rs @@ -18,8 +18,8 @@ //! ``` //! # #[cfg(feature="trace")] //! # { -//! use opentelemetry_api::trace::{Tracer, noop::NoopTracerProvider}; -//! use opentelemetry_api::global; +//! use opentelemetry::trace::{Tracer, noop::NoopTracerProvider}; +//! use opentelemetry::global; //! //! fn init_tracer() { //! // Swap this no-op provider for your tracing service of choice (jaeger, zipkin, etc) @@ -50,8 +50,8 @@ //! ``` //! # #[cfg(feature="trace")] //! # { -//! use opentelemetry_api::trace::{Tracer, TracerProvider}; -//! use opentelemetry_api::global; +//! use opentelemetry::trace::{Tracer, TracerProvider}; +//! use opentelemetry::global; //! //! pub fn my_traced_library_function() { //! // End users of your library will configure their global tracer provider @@ -91,8 +91,8 @@ //! ``` //! # #[cfg(feature="metrics")] //! # { -//! use opentelemetry_api::metrics::{Meter, noop::NoopMeterProvider}; -//! use opentelemetry_api::{global, KeyValue}; +//! use opentelemetry::metrics::{Meter, noop::NoopMeterProvider}; +//! use opentelemetry::{global, KeyValue}; //! //! fn init_meter() { //! let provider = NoopMeterProvider::new(); @@ -122,7 +122,7 @@ //! ``` //! # #[cfg(feature="metrics")] //! # { -//! use opentelemetry_api::{global, KeyValue}; +//! use opentelemetry::{global, KeyValue}; //! //! pub fn my_traced_library_function() { //! // End users of your library will configure their global meter provider diff --git a/opentelemetry-api/src/logs/logger.rs b/opentelemetry-api/src/logs/logger.rs index e7b06dd6ef..b9321e348d 100644 --- a/opentelemetry-api/src/logs/logger.rs +++ b/opentelemetry-api/src/logs/logger.rs @@ -47,7 +47,7 @@ pub trait LoggerProvider { /// # Examples /// /// ``` - /// use opentelemetry_api::{global, InstrumentationLibrary, logs::LoggerProvider}; + /// use opentelemetry::{global, InstrumentationLibrary, logs::LoggerProvider}; /// /// let provider = global::logger_provider(); /// diff --git a/opentelemetry-api/src/metrics/meter.rs b/opentelemetry-api/src/metrics/meter.rs index 2dce2ef0ec..a126c95f76 100644 --- a/opentelemetry-api/src/metrics/meter.rs +++ b/opentelemetry-api/src/metrics/meter.rs @@ -26,8 +26,8 @@ pub trait MeterProvider { /// # Examples /// /// ``` - /// use opentelemetry_api::{global, metrics::MeterProvider}; - /// use opentelemetry_api::KeyValue; + /// use opentelemetry::{global, metrics::MeterProvider}; + /// use opentelemetry::KeyValue; /// /// let provider = global::meter_provider(); /// @@ -69,7 +69,7 @@ pub trait MeterProvider { /// Provides access to instrument instances for recording metrics. /// /// ``` -/// use opentelemetry_api::{global, KeyValue}; +/// use opentelemetry::{global, KeyValue}; /// /// let meter = global::meter("my-meter"); /// diff --git a/opentelemetry-api/src/trace/context.rs b/opentelemetry-api/src/trace/context.rs index 6f7581d609..b27cf52ddb 100644 --- a/opentelemetry-api/src/trace/context.rs +++ b/opentelemetry-api/src/trace/context.rs @@ -181,7 +181,7 @@ pub trait TraceContextExt { /// # Examples /// /// ``` - /// use opentelemetry_api::{global, trace::{TraceContextExt, Tracer}, Context}; + /// use opentelemetry::{global, trace::{TraceContextExt, Tracer}, Context}; /// /// let tracer = global::tracer("example"); /// @@ -202,7 +202,7 @@ pub trait TraceContextExt { /// # Examples /// /// ``` - /// use opentelemetry_api::{global, trace::{TraceContextExt, Tracer}, Context}; + /// use opentelemetry::{global, trace::{TraceContextExt, Tracer}, Context}; /// /// fn fn_with_passed_in_context(cx: &Context) { /// let tracer = global::tracer("example"); @@ -226,7 +226,7 @@ pub trait TraceContextExt { /// # Examples /// /// ``` - /// use opentelemetry_api::{trace::TraceContextExt, Context}; + /// use opentelemetry::{trace::TraceContextExt, Context}; /// /// // Add an event to the currently active span /// Context::map_current(|cx| cx.span().add_event("An event!", vec![])); @@ -238,7 +238,7 @@ pub trait TraceContextExt { /// # Examples /// /// ``` - /// use opentelemetry_api::{trace::TraceContextExt, Context}; + /// use opentelemetry::{trace::TraceContextExt, Context}; /// /// assert!(!Context::map_current(|cx| cx.has_active_span())); /// ``` @@ -296,8 +296,8 @@ impl TraceContextExt for Context { /// # Examples /// /// ``` -/// use opentelemetry_api::{global, trace::{Span, Tracer}, KeyValue}; -/// use opentelemetry_api::trace::{get_active_span, mark_span_as_active}; +/// use opentelemetry::{global, trace::{Span, Tracer}, KeyValue}; +/// use opentelemetry::trace::{get_active_span, mark_span_as_active}; /// /// fn my_function() { /// let tracer = global::tracer("my-component-a"); @@ -326,8 +326,8 @@ pub fn mark_span_as_active(span: /// # Examples /// /// ``` -/// use opentelemetry_api::{global, trace::{Span, Tracer}, KeyValue}; -/// use opentelemetry_api::trace::get_active_span; +/// use opentelemetry::{global, trace::{Span, Tracer}, KeyValue}; +/// use opentelemetry::trace::get_active_span; /// /// fn my_function() { /// // start an active span in one function diff --git a/opentelemetry-api/src/trace/mod.rs b/opentelemetry-api/src/trace/mod.rs index e5db344df9..b27fcd3aa5 100644 --- a/opentelemetry-api/src/trace/mod.rs +++ b/opentelemetry-api/src/trace/mod.rs @@ -14,8 +14,8 @@ //! In application code: //! //! ``` -//! use opentelemetry_api::trace::{Tracer, noop::NoopTracerProvider}; -//! use opentelemetry_api::global; +//! use opentelemetry::trace::{Tracer, noop::NoopTracerProvider}; +//! use opentelemetry::global; //! //! fn init_tracer() { //! // Swap this no-op provider for your tracing service of choice (jaeger, zipkin, etc) @@ -43,7 +43,7 @@ //! In library code: //! //! ``` -//! use opentelemetry_api::{global, trace::{Span, Tracer, TracerProvider}}; +//! use opentelemetry::{global, trace::{Span, Tracer, TracerProvider}}; //! //! fn my_library_function() { //! // Use the global tracer provider to get access to the user-specified @@ -100,7 +100,7 @@ //! [`Context`]: crate::Context //! //! ``` -//! use opentelemetry_api::{global, trace::{self, Span, Status, Tracer, TracerProvider}}; +//! use opentelemetry::{global, trace::{self, Span, Status, Tracer, TracerProvider}}; //! //! fn may_error(rand: f32) { //! if rand < 0.5 { @@ -131,7 +131,7 @@ //! managing the parent context. //! //! ``` -//! use opentelemetry_api::{global, trace::Tracer}; +//! use opentelemetry::{global, trace::Tracer}; //! //! // Get a tracer //! let tracer = global::tracer("my_tracer"); @@ -148,7 +148,7 @@ //! Async spans can be propagated with [`TraceContextExt`] and [`FutureExt`]. //! //! ``` -//! use opentelemetry_api::{Context, global, trace::{FutureExt, TraceContextExt, Tracer}}; +//! use opentelemetry::{Context, global, trace::{FutureExt, TraceContextExt, Tracer}}; //! //! async fn some_work() { } //! diff --git a/opentelemetry-api/src/trace/span.rs b/opentelemetry-api/src/trace/span.rs index ac2532f766..0d101b84bd 100644 --- a/opentelemetry-api/src/trace/span.rs +++ b/opentelemetry-api/src/trace/span.rs @@ -283,7 +283,7 @@ impl Status { /// # Examples /// /// ``` - /// use opentelemetry_api::trace::Status; + /// use opentelemetry::trace::Status; /// /// // record error with `str` description /// let error_status = Status::error("something went wrong"); diff --git a/opentelemetry-api/src/trace/span_context.rs b/opentelemetry-api/src/trace/span_context.rs index 812f6343e5..b29995df87 100644 --- a/opentelemetry-api/src/trace/span_context.rs +++ b/opentelemetry-api/src/trace/span_context.rs @@ -108,7 +108,7 @@ impl TraceId { /// # Examples /// /// ``` - /// use opentelemetry_api::trace::TraceId; + /// use opentelemetry::trace::TraceId; /// /// assert!(TraceId::from_hex("42").is_ok()); /// assert!(TraceId::from_hex("58406520a006649127e371903a2de979").is_ok()); @@ -169,7 +169,7 @@ impl SpanId { /// # Examples /// /// ``` - /// use opentelemetry_api::trace::SpanId; + /// use opentelemetry::trace::SpanId; /// /// assert!(SpanId::from_hex("42").is_ok()); /// assert!(SpanId::from_hex("58406520a0066491").is_ok()); @@ -264,7 +264,7 @@ impl TraceState { /// # Examples /// /// ``` - /// use opentelemetry_api::trace::TraceState; + /// use opentelemetry::trace::TraceState; /// /// let kvs = vec![("foo", "bar"), ("apple", "banana")]; /// let trace_state = TraceState::from_key_value(kvs); diff --git a/opentelemetry-api/src/trace/tracer.rs b/opentelemetry-api/src/trace/tracer.rs index c46704944e..1b88de4cea 100644 --- a/opentelemetry-api/src/trace/tracer.rs +++ b/opentelemetry-api/src/trace/tracer.rs @@ -13,7 +13,7 @@ use std::time::SystemTime; /// Spans can be created and nested manually: /// /// ``` -/// use opentelemetry_api::{global, trace::{Span, Tracer, TraceContextExt}, Context}; +/// use opentelemetry::{global, trace::{Span, Tracer, TraceContextExt}, Context}; /// /// let tracer = global::tracer("my-component"); /// @@ -30,7 +30,7 @@ use std::time::SystemTime; /// Spans can also use the current thread's [`Context`] to track which span is active: /// /// ``` -/// use opentelemetry_api::{global, trace::{SpanKind, Tracer}}; +/// use opentelemetry::{global, trace::{SpanKind, Tracer}}; /// /// let tracer = global::tracer("my-component"); /// @@ -49,7 +49,7 @@ use std::time::SystemTime; /// greater control over when the span is no longer considered active. /// /// ``` -/// use opentelemetry_api::{global, trace::{Span, Tracer, mark_span_as_active}}; +/// use opentelemetry::{global, trace::{Span, Tracer, mark_span_as_active}}; /// let tracer = global::tracer("my-component"); /// /// let parent_span = tracer.start("foo"); @@ -78,7 +78,7 @@ use std::time::SystemTime; /// the following example _will not_ work: /// /// ```no_run -/// # use opentelemetry_api::{global, trace::{Tracer, mark_span_as_active}}; +/// # use opentelemetry::{global, trace::{Tracer, mark_span_as_active}}; /// # let tracer = global::tracer("foo"); /// # let span = tracer.start("foo-span"); /// async { @@ -99,7 +99,7 @@ use std::time::SystemTime; /// /// ``` /// # async fn run() -> Result<(), ()> { -/// use opentelemetry_api::{trace::FutureExt, Context}; +/// use opentelemetry::{trace::FutureExt, Context}; /// let cx = Context::current(); /// /// let my_future = async { @@ -185,7 +185,7 @@ pub trait Tracer { /// # Examples /// /// ``` - /// use opentelemetry_api::{global, trace::{Span, Tracer, get_active_span}, KeyValue}; + /// use opentelemetry::{global, trace::{Span, Tracer, get_active_span}, KeyValue}; /// /// fn my_function() { /// // start an active span in one function @@ -219,7 +219,7 @@ pub trait Tracer { /// has started. /// /// ``` -/// use opentelemetry_api::{ +/// use opentelemetry::{ /// global, /// trace::{TracerProvider, SpanBuilder, SpanKind, Tracer}, /// }; diff --git a/opentelemetry-api/src/trace/tracer_provider.rs b/opentelemetry-api/src/trace/tracer_provider.rs index 90792f4859..5f18264be1 100644 --- a/opentelemetry-api/src/trace/tracer_provider.rs +++ b/opentelemetry-api/src/trace/tracer_provider.rs @@ -20,8 +20,8 @@ pub trait TracerProvider { /// # Examples /// /// ``` - /// use opentelemetry_api::{global, trace::TracerProvider}; - /// use opentelemetry_api::KeyValue; + /// use opentelemetry::{global, trace::TracerProvider}; + /// use opentelemetry::KeyValue; /// /// let provider = global::tracer_provider(); /// @@ -54,7 +54,7 @@ pub trait TracerProvider { /// # Examples /// /// ``` - /// use opentelemetry_api::{global, trace::TracerProvider}; + /// use opentelemetry::{global, trace::TracerProvider}; /// /// let provider = global::tracer_provider(); /// @@ -86,7 +86,7 @@ pub trait TracerProvider { /// # Examples /// /// ``` - /// use opentelemetry_api::{global, InstrumentationLibrary, trace::TracerProvider}; + /// use opentelemetry::{global, InstrumentationLibrary, trace::TracerProvider}; /// /// let provider = global::tracer_provider(); /// diff --git a/opentelemetry-otlp/Cargo.toml b/opentelemetry-otlp/Cargo.toml index 7d275f201f..22e20766d6 100644 --- a/opentelemetry-otlp/Cargo.toml +++ b/opentelemetry-otlp/Cargo.toml @@ -30,7 +30,7 @@ async-trait = "0.1" futures-core = "0.3" opentelemetry-proto = { version = "0.3", path = "../opentelemetry-proto", default-features = false } grpcio = { version = "0.12", optional = true } -opentelemetry_api = { version = "0.20", default-features = false, path = "../opentelemetry-api" } +opentelemetry = { version = "0.21", default-features = false, path = "../opentelemetry" } opentelemetry_sdk = { version = "0.20", default-features = false, path = "../opentelemetry-sdk" } opentelemetry-http = { version = "0.9", path = "../opentelemetry-http", optional = true } opentelemetry-semantic-conventions = { version = "0.12", path = "../opentelemetry-semantic-conventions" } @@ -55,9 +55,9 @@ futures = { version = "0.3", default-features = false, features = ["std"] } [features] # telemetry pillars and functions -trace = ["opentelemetry_api/trace", "opentelemetry_sdk/trace", "opentelemetry-proto/trace"] -metrics = ["opentelemetry_api/metrics", "opentelemetry_sdk/metrics", "opentelemetry-proto/metrics"] -logs = ["opentelemetry_api/logs", "opentelemetry_sdk/logs", "opentelemetry-proto/logs"] +trace = ["opentelemetry/trace", "opentelemetry_sdk/trace", "opentelemetry-proto/trace"] +metrics = ["opentelemetry/metrics", "opentelemetry_sdk/metrics", "opentelemetry-proto/metrics"] +logs = ["opentelemetry/logs", "opentelemetry_sdk/logs", "opentelemetry-proto/logs"] # add ons serialize = ["serde"] diff --git a/opentelemetry-otlp/src/exporter/grpcio/logs.rs b/opentelemetry-otlp/src/exporter/grpcio/logs.rs index e3d214d7f7..1c33d53df8 100644 --- a/opentelemetry-otlp/src/exporter/grpcio/logs.rs +++ b/opentelemetry-otlp/src/exporter/grpcio/logs.rs @@ -3,7 +3,7 @@ use std::{collections::HashMap, time::Duration}; use async_trait::async_trait; use grpcio::CallOption; -use opentelemetry_api::logs::{LogError, LogResult}; +use opentelemetry::logs::{LogError, LogResult}; use opentelemetry_proto::grpcio::collector::logs::v1::{ ExportLogsServiceRequest, LogsServiceClient, }; diff --git a/opentelemetry-otlp/src/exporter/grpcio/metrics.rs b/opentelemetry-otlp/src/exporter/grpcio/metrics.rs index 2b82aacd84..0206da80d7 100644 --- a/opentelemetry-otlp/src/exporter/grpcio/metrics.rs +++ b/opentelemetry-otlp/src/exporter/grpcio/metrics.rs @@ -3,7 +3,7 @@ use std::{collections::HashMap, sync::Mutex, time::Duration}; use async_trait::async_trait; use grpcio::CallOption; -use opentelemetry_api::metrics::{MetricsError, Result}; +use opentelemetry::metrics::{MetricsError, Result}; use opentelemetry_proto::grpcio::collector::metrics::v1::{ ExportMetricsServiceRequest, MetricsServiceClient, }; diff --git a/opentelemetry-otlp/src/exporter/grpcio/mod.rs b/opentelemetry-otlp/src/exporter/grpcio/mod.rs index 5e34708fe5..4d81446ff0 100644 --- a/opentelemetry-otlp/src/exporter/grpcio/mod.rs +++ b/opentelemetry-otlp/src/exporter/grpcio/mod.rs @@ -180,7 +180,7 @@ impl GrpcioExporterBuilder { #[cfg(feature = "trace")] pub fn build_span_exporter( mut self, - ) -> Result { + ) -> Result { use opentelemetry_proto::grpcio::collector::trace::v1::TraceServiceClient; use self::trace::GrpcioTraceClient; @@ -200,7 +200,7 @@ impl GrpcioExporterBuilder { /// Builds a new log exporter with the given configuration pub fn build_log_exporter( mut self, - ) -> Result { + ) -> Result { use self::logs::GrpcioLogsClient; use opentelemetry_proto::grpcio::collector::logs::v1::LogsServiceClient; @@ -221,7 +221,7 @@ impl GrpcioExporterBuilder { mut self, aggregation_selector: Box, temporality_selector: Box, - ) -> opentelemetry_api::metrics::Result { + ) -> opentelemetry::metrics::Result { use self::metrics::GrpcioMetricsClient; use opentelemetry_proto::grpcio::collector::metrics::v1::MetricsServiceClient; diff --git a/opentelemetry-otlp/src/exporter/grpcio/trace.rs b/opentelemetry-otlp/src/exporter/grpcio/trace.rs index f8d48be1e8..bfd6624c1c 100644 --- a/opentelemetry-otlp/src/exporter/grpcio/trace.rs +++ b/opentelemetry-otlp/src/exporter/grpcio/trace.rs @@ -3,7 +3,7 @@ use std::{collections::HashMap, time::Duration}; use futures_core::future::BoxFuture; use grpcio::CallOption; -use opentelemetry_api::trace::TraceError; +use opentelemetry::trace::TraceError; use opentelemetry_proto::grpcio::collector::trace::v1::{ ExportTraceServiceRequest, TraceServiceClient, }; diff --git a/opentelemetry-otlp/src/exporter/http/logs.rs b/opentelemetry-otlp/src/exporter/http/logs.rs index 309b65cb2d..8f358c977d 100644 --- a/opentelemetry-otlp/src/exporter/http/logs.rs +++ b/opentelemetry-otlp/src/exporter/http/logs.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use async_trait::async_trait; use http::{header::CONTENT_TYPE, Method}; -use opentelemetry_api::logs::{LogError, LogResult}; +use opentelemetry::logs::{LogError, LogResult}; use opentelemetry_sdk::export::logs::{LogData, LogExporter}; use super::OtlpHttpClient; diff --git a/opentelemetry-otlp/src/exporter/http/metrics.rs b/opentelemetry-otlp/src/exporter/http/metrics.rs index 82d6b9739b..b5ec92eb63 100644 --- a/opentelemetry-otlp/src/exporter/http/metrics.rs +++ b/opentelemetry-otlp/src/exporter/http/metrics.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use async_trait::async_trait; use http::{header::CONTENT_TYPE, Method}; -use opentelemetry_api::metrics::{MetricsError, Result}; +use opentelemetry::metrics::{MetricsError, Result}; use opentelemetry_sdk::metrics::data::ResourceMetrics; use crate::{metric::MetricsClient, Error}; diff --git a/opentelemetry-otlp/src/exporter/http/mod.rs b/opentelemetry-otlp/src/exporter/http/mod.rs index 0d83ebfd39..3c7428cb43 100644 --- a/opentelemetry-otlp/src/exporter/http/mod.rs +++ b/opentelemetry-otlp/src/exporter/http/mod.rs @@ -192,7 +192,7 @@ impl HttpExporterBuilder { #[cfg(feature = "trace")] pub fn build_span_exporter( mut self, - ) -> Result { + ) -> Result { use crate::{OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, OTEL_EXPORTER_OTLP_TRACES_TIMEOUT}; let client = self.build_client( @@ -206,7 +206,7 @@ impl HttpExporterBuilder { /// Create a log exporter with the current configuration #[cfg(feature = "logs")] - pub fn build_log_exporter(mut self) -> opentelemetry_api::logs::LogResult { + pub fn build_log_exporter(mut self) -> opentelemetry::logs::LogResult { use crate::{OTEL_EXPORTER_OTLP_LOGS_ENDPOINT, OTEL_EXPORTER_OTLP_LOGS_TIMEOUT}; let client = self.build_client( @@ -224,7 +224,7 @@ impl HttpExporterBuilder { mut self, aggregation_selector: Box, temporality_selector: Box, - ) -> opentelemetry_api::metrics::Result { + ) -> opentelemetry::metrics::Result { use crate::{OTEL_EXPORTER_OTLP_METRICS_ENDPOINT, OTEL_EXPORTER_OTLP_METRICS_TIMEOUT}; let client = self.build_client( diff --git a/opentelemetry-otlp/src/exporter/http/trace.rs b/opentelemetry-otlp/src/exporter/http/trace.rs index 320d7f95aa..cb368e1e72 100644 --- a/opentelemetry-otlp/src/exporter/http/trace.rs +++ b/opentelemetry-otlp/src/exporter/http/trace.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use futures_core::future::BoxFuture; use http::{header::CONTENT_TYPE, Method}; -use opentelemetry_api::trace::{TraceError, TraceResult}; +use opentelemetry::trace::{TraceError, TraceResult}; use opentelemetry_sdk::export::trace::{ExportResult, SpanData, SpanExporter}; use super::OtlpHttpClient; diff --git a/opentelemetry-otlp/src/exporter/tonic/logs.rs b/opentelemetry-otlp/src/exporter/tonic/logs.rs index 7d9876f6f2..0d792bcfed 100644 --- a/opentelemetry-otlp/src/exporter/tonic/logs.rs +++ b/opentelemetry-otlp/src/exporter/tonic/logs.rs @@ -1,7 +1,7 @@ use core::fmt; use async_trait::async_trait; -use opentelemetry_api::logs::{LogError, LogResult}; +use opentelemetry::logs::{LogError, LogResult}; use opentelemetry_proto::tonic::collector::logs::v1::{ logs_service_client::LogsServiceClient, ExportLogsServiceRequest, }; diff --git a/opentelemetry-otlp/src/exporter/tonic/metrics.rs b/opentelemetry-otlp/src/exporter/tonic/metrics.rs index 982b09a507..abcc42701d 100644 --- a/opentelemetry-otlp/src/exporter/tonic/metrics.rs +++ b/opentelemetry-otlp/src/exporter/tonic/metrics.rs @@ -2,7 +2,7 @@ use core::fmt; use std::sync::Mutex; use async_trait::async_trait; -use opentelemetry_api::metrics::{MetricsError, Result}; +use opentelemetry::metrics::{MetricsError, Result}; use opentelemetry_proto::tonic::collector::metrics::v1::{ metrics_service_client::MetricsServiceClient, ExportMetricsServiceRequest, }; diff --git a/opentelemetry-otlp/src/exporter/tonic/mod.rs b/opentelemetry-otlp/src/exporter/tonic/mod.rs index 87836862f3..8c462a0913 100644 --- a/opentelemetry-otlp/src/exporter/tonic/mod.rs +++ b/opentelemetry-otlp/src/exporter/tonic/mod.rs @@ -279,7 +279,7 @@ impl TonicExporterBuilder { #[cfg(feature = "logs")] pub fn build_log_exporter( mut self, - ) -> Result { + ) -> Result { use crate::exporter::tonic::logs::TonicLogsClient; let (channel, interceptor, compression) = self.build_channel( @@ -300,7 +300,7 @@ impl TonicExporterBuilder { mut self, aggregation_selector: Box, temporality_selector: Box, - ) -> opentelemetry_api::metrics::Result { + ) -> opentelemetry::metrics::Result { use crate::MetricsExporter; use metrics::TonicMetricsClient; @@ -324,7 +324,7 @@ impl TonicExporterBuilder { #[cfg(feature = "trace")] pub fn build_span_exporter( mut self, - ) -> Result { + ) -> Result { use crate::exporter::tonic::trace::TonicTracesClient; let (channel, interceptor, compression) = self.build_channel( diff --git a/opentelemetry-otlp/src/exporter/tonic/trace.rs b/opentelemetry-otlp/src/exporter/tonic/trace.rs index 70c0c43c55..6b43c5e974 100644 --- a/opentelemetry-otlp/src/exporter/tonic/trace.rs +++ b/opentelemetry-otlp/src/exporter/tonic/trace.rs @@ -1,7 +1,7 @@ use core::fmt; use futures_core::future::BoxFuture; -use opentelemetry_api::trace::TraceError; +use opentelemetry::trace::TraceError; use opentelemetry_proto::tonic::collector::trace::v1::{ trace_service_client::TraceServiceClient, ExportTraceServiceRequest, }; diff --git a/opentelemetry-otlp/src/lib.rs b/opentelemetry-otlp/src/lib.rs index 6b9a343020..3295abc932 100644 --- a/opentelemetry-otlp/src/lib.rs +++ b/opentelemetry-otlp/src/lib.rs @@ -30,7 +30,7 @@ //! ```no_run //! # #[cfg(all(feature = "trace", feature = "grpc-tonic"))] //! # { -//! use opentelemetry_api::trace::Tracer; +//! use opentelemetry::trace::Tracer; //! //! fn main() -> Result<(), Box> { //! // First, create a OTLP exporter builder. Configure it as you need. @@ -67,7 +67,7 @@ //! ```no_run //! # #[cfg(all(feature = "trace", feature = "grpc-tonic"))] //! # { -//! # fn main() -> Result<(), opentelemetry_api::trace::TraceError> { +//! # fn main() -> Result<(), opentelemetry::trace::TraceError> { //! let tracer = opentelemetry_otlp::new_pipeline() //! .tracing() //! .with_exporter(opentelemetry_otlp::new_exporter().tonic()) @@ -91,7 +91,7 @@ //! on the choice of exporters. //! //! ```no_run -//! use opentelemetry_api::{KeyValue, trace::Tracer}; +//! use opentelemetry::{KeyValue, trace::Tracer}; //! use opentelemetry_sdk::{trace::{self, RandomIdGenerator, Sampler}, Resource}; //! # #[cfg(feature = "metrics")] //! use opentelemetry_sdk::metrics::reader::{DefaultAggregationSelector, DefaultTemporalitySelector}; diff --git a/opentelemetry-otlp/src/logs.rs b/opentelemetry-otlp/src/logs.rs index f26893dc1c..44177c3aff 100644 --- a/opentelemetry-otlp/src/logs.rs +++ b/opentelemetry-otlp/src/logs.rs @@ -15,7 +15,7 @@ use crate::OtlpPipeline; use async_trait::async_trait; use std::{borrow::Cow, fmt::Debug}; -use opentelemetry_api::{ +use opentelemetry::{ global, logs::{LogError, LoggerProvider}, }; @@ -114,7 +114,7 @@ impl LogExporter { #[async_trait] impl opentelemetry_sdk::export::logs::LogExporter for LogExporter { - async fn export(&mut self, batch: Vec) -> opentelemetry_api::logs::LogResult<()> { + async fn export(&mut self, batch: Vec) -> opentelemetry::logs::LogResult<()> { self.client.export(batch).await } } diff --git a/opentelemetry-otlp/src/metric.rs b/opentelemetry-otlp/src/metric.rs index 7674e9a5dc..7f20457c92 100644 --- a/opentelemetry-otlp/src/metric.rs +++ b/opentelemetry-otlp/src/metric.rs @@ -7,7 +7,7 @@ use crate::{Error, OtlpPipeline}; use async_trait::async_trait; use core::fmt; -use opentelemetry_api::{global, metrics::Result}; +use opentelemetry::{global, metrics::Result}; #[cfg(feature = "grpc-tonic")] use crate::exporter::tonic::TonicExporterBuilder; @@ -104,7 +104,7 @@ impl MetricsExporterBuilder { MetricsExporterBuilder::Unconfigured => { drop(temporality_selector); drop(aggregation_selector); - Err(opentelemetry_api::metrics::MetricsError::Other( + Err(opentelemetry::metrics::MetricsError::Other( "no configured metrics exporter, enable `http-proto`, `grpc-sys` or `grpc-tonic` feature to configure a metrics exporter".into(), )) } diff --git a/opentelemetry-otlp/src/span.rs b/opentelemetry-otlp/src/span.rs index 8e3ba73566..fd028f29b7 100644 --- a/opentelemetry-otlp/src/span.rs +++ b/opentelemetry-otlp/src/span.rs @@ -5,7 +5,7 @@ use std::fmt::Debug; use futures_core::future::BoxFuture; -use opentelemetry_api::{ +use opentelemetry::{ global, trace::{TraceError, TracerProvider}, }; @@ -87,7 +87,7 @@ impl OtlpTracePipeline { /// /// Returns a [`Tracer`] with the name `opentelemetry-otlp` and current crate version. /// - /// [`Tracer`]: opentelemetry_api::trace::Tracer + /// [`Tracer`]: opentelemetry::trace::Tracer pub fn install_simple(self) -> Result { Ok(build_simple_with_exporter( self.exporter_builder @@ -104,7 +104,7 @@ impl OtlpTracePipeline { /// /// `install_batch` will panic if not called within a tokio runtime /// - /// [`Tracer`]: opentelemetry_api::trace::Tracer + /// [`Tracer`]: opentelemetry::trace::Tracer pub fn install_batch>( self, runtime: R, diff --git a/opentelemetry-otlp/tests/smoke.rs b/opentelemetry-otlp/tests/smoke.rs index 278d61df0b..45c3b7c45f 100644 --- a/opentelemetry-otlp/tests/smoke.rs +++ b/opentelemetry-otlp/tests/smoke.rs @@ -1,6 +1,6 @@ use futures::StreamExt; -use opentelemetry_api::global::shutdown_tracer_provider; -use opentelemetry_api::trace::{Span, SpanKind, Tracer}; +use opentelemetry::global::shutdown_tracer_provider; +use opentelemetry::trace::{Span, SpanKind, Tracer}; use opentelemetry_otlp::WithExportConfig; use opentelemetry_proto::tonic::collector::trace::v1::{ trace_service_server::{TraceService, TraceServiceServer}, diff --git a/opentelemetry-proto/Cargo.toml b/opentelemetry-proto/Cargo.toml index b6156bcca1..bdb2e19506 100644 --- a/opentelemetry-proto/Cargo.toml +++ b/opentelemetry-proto/Cargo.toml @@ -34,9 +34,9 @@ gen-tonic-messages = ["tonic", "prost"] gen-grpcio = ["grpcio", "prost"] # telemetry pillars and functions -trace = ["opentelemetry_api/trace", "opentelemetry_sdk/trace"] -metrics = ["opentelemetry_api/metrics", "opentelemetry_sdk/metrics"] -logs = ["opentelemetry_api/logs", "opentelemetry_sdk/logs"] +trace = ["opentelemetry/trace", "opentelemetry_sdk/trace"] +metrics = ["opentelemetry/metrics", "opentelemetry_sdk/metrics"] +logs = ["opentelemetry/logs", "opentelemetry_sdk/logs"] zpages = ["trace"] # add ons @@ -46,7 +46,7 @@ with-serde = ["serde"] grpcio = { version = "0.12", optional = true, features = ["prost-codec"] } tonic = { version = "0.9.0", default-features = false, optional = true, features = ["codegen", "prost"] } prost = { version = "0.11.0", optional = true } -opentelemetry_api = { version = "0.20", default-features = false, path = "../opentelemetry-api" } +opentelemetry = { version = "0.21", default-features = false, path = "../opentelemetry" } opentelemetry_sdk = { version = "0.20", default-features = false, path = "../opentelemetry-sdk" } serde = { version = "1.0", optional = true, features = ["serde_derive"] } diff --git a/opentelemetry-proto/src/transform/common.rs b/opentelemetry-proto/src/transform/common.rs index 0da9f5d1ca..6b22ef58a4 100644 --- a/opentelemetry-proto/src/transform/common.rs +++ b/opentelemetry-proto/src/transform/common.rs @@ -19,7 +19,7 @@ pub mod tonic { use crate::proto::tonic::common::v1::{ any_value, AnyValue, ArrayValue, InstrumentationScope, KeyValue, }; - use opentelemetry_api::{Array, Value}; + use opentelemetry::{Array, Value}; use std::borrow::Cow; #[cfg(any(feature = "trace", feature = "logs"))] @@ -70,8 +70,8 @@ pub mod tonic { } } - impl From> for Attributes { - fn from(kvs: Vec) -> Self { + impl From> for Attributes { + fn from(kvs: Vec) -> Self { Attributes( kvs.into_iter() .map(|api_kv| KeyValue { @@ -132,7 +132,7 @@ pub mod tonic { pub(crate) fn resource_attributes(resource: &Resource) -> Attributes { resource .iter() - .map(|(k, v)| opentelemetry_api::KeyValue::new(k.clone(), v.clone())) + .map(|(k, v)| opentelemetry::KeyValue::new(k.clone(), v.clone())) .collect::>() .into() } @@ -143,7 +143,7 @@ pub mod grpcio { use crate::proto::grpcio::common::v1::{ any_value, AnyValue, ArrayValue, InstrumentationScope, KeyValue, }; - use opentelemetry_api::{Array, Value}; + use opentelemetry::{Array, Value}; use std::borrow::Cow; #[cfg(any(feature = "trace", feature = "logs"))] @@ -194,8 +194,8 @@ pub mod grpcio { } } - impl From> for Attributes { - fn from(kvs: Vec) -> Self { + impl From> for Attributes { + fn from(kvs: Vec) -> Self { Attributes( kvs.into_iter() .map(|api_kv| KeyValue { @@ -256,7 +256,7 @@ pub mod grpcio { pub(crate) fn resource_attributes(resource: &Resource) -> Attributes { resource .iter() - .map(|(k, v)| opentelemetry_api::KeyValue::new(k.clone(), v.clone())) + .map(|(k, v)| opentelemetry::KeyValue::new(k.clone(), v.clone())) .collect::>() .into() } diff --git a/opentelemetry-proto/src/transform/logs.rs b/opentelemetry-proto/src/transform/logs.rs index c426da1b6b..181f04c903 100644 --- a/opentelemetry-proto/src/transform/logs.rs +++ b/opentelemetry-proto/src/transform/logs.rs @@ -9,7 +9,7 @@ pub mod tonic { }, transform::common::{to_nanos, tonic::resource_attributes}, }; - use opentelemetry_api::logs::{AnyValue as LogsAnyValue, Severity}; + use opentelemetry::logs::{AnyValue as LogsAnyValue, Severity}; impl From for AnyValue { fn from(value: LogsAnyValue) -> Self { @@ -50,8 +50,8 @@ pub mod tonic { } } - impl From for LogRecord { - fn from(log_record: opentelemetry_api::logs::LogRecord) -> Self { + impl From for LogRecord { + fn from(log_record: opentelemetry::logs::LogRecord) -> Self { let trace_context = log_record.trace_context.as_ref(); let severity_number = match log_record.severity_number { Some(Severity::Trace) => SeverityNumber::Trace, @@ -148,7 +148,7 @@ pub mod grpcio { }, transform::common::{grpcio::resource_attributes, to_nanos}, }; - use opentelemetry_api::logs::{AnyValue as LogsAnyValue, Severity}; + use opentelemetry::logs::{AnyValue as LogsAnyValue, Severity}; impl From for AnyValue { fn from(value: LogsAnyValue) -> Self { @@ -189,8 +189,8 @@ pub mod grpcio { } } - impl From for LogRecord { - fn from(log_record: opentelemetry_api::logs::LogRecord) -> Self { + impl From for LogRecord { + fn from(log_record: opentelemetry::logs::LogRecord) -> Self { let trace_context = log_record.trace_context.as_ref(); let severity_number = match log_record.severity_number { Some(Severity::Trace) => SeverityNumber::Trace, diff --git a/opentelemetry-proto/src/transform/metrics.rs b/opentelemetry-proto/src/transform/metrics.rs index a3ba0e4717..9b51bd080e 100644 --- a/opentelemetry-proto/src/transform/metrics.rs +++ b/opentelemetry-proto/src/transform/metrics.rs @@ -8,7 +8,7 @@ pub mod tonic { use std::any::Any; use std::fmt; - use opentelemetry_api::{global, metrics::MetricsError, Key, Value}; + use opentelemetry::{global, metrics::MetricsError, Key, Value}; use opentelemetry_sdk::metrics::data::{ self, Exemplar as SdkExemplar, Gauge as SdkGauge, Histogram as SdkHistogram, Metric as SdkMetric, ScopeMetrics as SdkScopeMetrics, Sum as SdkSum, Temporality, @@ -77,8 +77,8 @@ pub mod tonic { } } - impl From<&opentelemetry_api::KeyValue> for KeyValue { - fn from(kv: &opentelemetry_api::KeyValue) -> Self { + impl From<&opentelemetry::KeyValue> for KeyValue { + fn from(kv: &opentelemetry::KeyValue) -> Self { KeyValue { key: kv.key.to_string(), value: Some(kv.value.clone().into()), @@ -92,7 +92,7 @@ pub mod tonic { Temporality::Cumulative => AggregationTemporality::Cumulative, Temporality::Delta => AggregationTemporality::Delta, other => { - opentelemetry_api::global::handle_error(MetricsError::Other(format!( + opentelemetry::global::handle_error(MetricsError::Other(format!( "Unknown temporality {:?}, using default instead.", other ))); @@ -300,7 +300,7 @@ pub mod grpcio { use std::any::Any; use std::fmt; - use opentelemetry_api::{global, metrics::MetricsError, Key, Value}; + use opentelemetry::{global, metrics::MetricsError, Key, Value}; use opentelemetry_sdk::metrics::data::{ self, Exemplar as SdkExemplar, Gauge as SdkGauge, Histogram as SdkHistogram, Metric as SdkMetric, ScopeMetrics as SdkScopeMetrics, Sum as SdkSum, Temporality, @@ -369,8 +369,8 @@ pub mod grpcio { } } - impl From<&opentelemetry_api::KeyValue> for KeyValue { - fn from(kv: &opentelemetry_api::KeyValue) -> Self { + impl From<&opentelemetry::KeyValue> for KeyValue { + fn from(kv: &opentelemetry::KeyValue) -> Self { KeyValue { key: kv.key.to_string(), value: Some(kv.value.clone().into()), @@ -384,7 +384,7 @@ pub mod grpcio { Temporality::Cumulative => AggregationTemporality::Cumulative, Temporality::Delta => AggregationTemporality::Delta, other => { - opentelemetry_api::global::handle_error(MetricsError::Other(format!( + opentelemetry::global::handle_error(MetricsError::Other(format!( "Unknown temporality {:?}, using default instead.", other ))); diff --git a/opentelemetry-proto/src/transform/trace.rs b/opentelemetry-proto/src/transform/trace.rs index 65edb35b45..59f66670f7 100644 --- a/opentelemetry-proto/src/transform/trace.rs +++ b/opentelemetry-proto/src/transform/trace.rs @@ -6,8 +6,8 @@ pub mod tonic { to_nanos, tonic::{resource_attributes, Attributes}, }; - use opentelemetry_api::trace; - use opentelemetry_api::trace::{Link, SpanId, SpanKind}; + use opentelemetry::trace; + use opentelemetry::trace::{Link, SpanId, SpanKind}; use opentelemetry_sdk::export::trace::SpanData; impl From for span::SpanKind { @@ -117,8 +117,8 @@ pub mod grpcio { grpcio::{resource_attributes, Attributes}, to_nanos, }; - use opentelemetry_api::trace; - use opentelemetry_api::trace::{Link, SpanId, SpanKind}; + use opentelemetry::trace; + use opentelemetry::trace::{Link, SpanId, SpanKind}; use opentelemetry_sdk::export::trace::SpanData; impl From for span::SpanKind { diff --git a/opentelemetry-proto/src/transform/tracez.rs b/opentelemetry-proto/src/transform/tracez.rs index 994c3945b1..99b95fe11b 100644 --- a/opentelemetry-proto/src/transform/tracez.rs +++ b/opentelemetry-proto/src/transform/tracez.rs @@ -1,6 +1,6 @@ #[cfg(all(feature = "gen-tonic-messages", feature = "zpages"))] mod grpcio { - use opentelemetry_api::trace::{Event, Status}; + use opentelemetry::trace::{Event, Status}; use opentelemetry_sdk::export::trace::SpanData; use crate::proto::tonic::{ diff --git a/opentelemetry-sdk/Cargo.toml b/opentelemetry-sdk/Cargo.toml index 907f3c095c..aa8d125c19 100644 --- a/opentelemetry-sdk/Cargo.toml +++ b/opentelemetry-sdk/Cargo.toml @@ -10,7 +10,7 @@ edition = "2021" rust-version = "1.64" [dependencies] -opentelemetry_api = { version = "0.20", path = "../opentelemetry-api/" } +opentelemetry = { version = "0.21", path = "../opentelemetry/" } opentelemetry-http = { version = "0.9", path = "../opentelemetry-http", optional = true } async-std = { version = "1.6", features = ["unstable"], optional = true } async-trait = { version = "0.1", optional = true } @@ -43,12 +43,12 @@ pprof = { version = "0.12", features = ["flamegraph", "criterion"] } [features] default = ["trace"] -trace = ["opentelemetry_api/trace", "crossbeam-channel", "rand", "async-trait", "percent-encoding"] +trace = ["opentelemetry/trace", "crossbeam-channel", "rand", "async-trait", "percent-encoding"] jaeger_remote_sampler = ["trace", "opentelemetry-http", "http", "serde", "serde_json", "url"] -logs = ["opentelemetry_api/logs", "crossbeam-channel", "async-trait", "serde_json"] -logs_level_enabled = ["logs", "opentelemetry_api/logs_level_enabled"] -metrics = ["opentelemetry_api/metrics", "regex", "async-trait"] -testing = ["opentelemetry_api/testing", "trace", "metrics", "logs", "rt-async-std", "rt-tokio", "rt-tokio-current-thread", "tokio/macros", "tokio/rt-multi-thread"] +logs = ["opentelemetry/logs", "crossbeam-channel", "async-trait", "serde_json"] +logs_level_enabled = ["logs", "opentelemetry/logs_level_enabled"] +metrics = ["opentelemetry/metrics", "regex", "async-trait"] +testing = ["opentelemetry/testing", "trace", "metrics", "logs", "rt-async-std", "rt-tokio", "rt-tokio-current-thread", "tokio/macros", "tokio/rt-multi-thread"] rt-tokio = ["tokio", "tokio-stream"] rt-tokio-current-thread = ["tokio", "tokio-stream"] rt-async-std = ["async-std"] diff --git a/opentelemetry-sdk/benches/batch_span_processor.rs b/opentelemetry-sdk/benches/batch_span_processor.rs index cab62a5413..17e74b1711 100644 --- a/opentelemetry-sdk/benches/batch_span_processor.rs +++ b/opentelemetry-sdk/benches/batch_span_processor.rs @@ -1,5 +1,5 @@ use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; -use opentelemetry_api::trace::{ +use opentelemetry::trace::{ SpanContext, SpanId, SpanKind, Status, TraceFlags, TraceId, TraceState, }; use opentelemetry_sdk::export::trace::SpanData; diff --git a/opentelemetry-sdk/benches/context.rs b/opentelemetry-sdk/benches/context.rs index 7ee4e8a076..9e4d5dddb5 100644 --- a/opentelemetry-sdk/benches/context.rs +++ b/opentelemetry-sdk/benches/context.rs @@ -2,7 +2,7 @@ use std::fmt::Display; use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; use futures_util::future::BoxFuture; -use opentelemetry_api::{ +use opentelemetry::{ trace::{TraceContextExt, Tracer, TracerProvider}, Context, }; diff --git a/opentelemetry-sdk/benches/key_value_map.rs b/opentelemetry-sdk/benches/key_value_map.rs index 4deb1c4872..feff473702 100644 --- a/opentelemetry-sdk/benches/key_value_map.rs +++ b/opentelemetry-sdk/benches/key_value_map.rs @@ -2,7 +2,7 @@ use criterion::{ black_box, criterion_group, criterion_main, BatchSize::SmallInput, BenchmarkId, Criterion, }; use indexmap::IndexMap; -use opentelemetry_api::{Key, KeyValue, Value}; +use opentelemetry::{Key, KeyValue, Value}; use opentelemetry_sdk::trace::EvictedHashMap; #[cfg(not(target_os = "windows"))] use pprof::criterion::{Output, PProfProfiler}; diff --git a/opentelemetry-sdk/benches/metric.rs b/opentelemetry-sdk/benches/metric.rs index d5ca0b9160..8d5e4451de 100644 --- a/opentelemetry-sdk/benches/metric.rs +++ b/opentelemetry-sdk/benches/metric.rs @@ -2,7 +2,7 @@ use rand::Rng; use std::sync::{Arc, Weak}; use criterion::{criterion_group, criterion_main, Bencher, Criterion}; -use opentelemetry_api::{ +use opentelemetry::{ metrics::{Counter, Histogram, MeterProvider as _, Result}, Context, Key, KeyValue, }; diff --git a/opentelemetry-sdk/benches/span_builder.rs b/opentelemetry-sdk/benches/span_builder.rs index d38485dca8..3ed995790f 100644 --- a/opentelemetry-sdk/benches/span_builder.rs +++ b/opentelemetry-sdk/benches/span_builder.rs @@ -1,6 +1,6 @@ use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; use futures_util::future::BoxFuture; -use opentelemetry_api::{ +use opentelemetry::{ trace::{OrderMap, Span, Tracer, TracerProvider}, KeyValue, }; diff --git a/opentelemetry-sdk/benches/trace.rs b/opentelemetry-sdk/benches/trace.rs index 7f0e793746..93bdf3859a 100644 --- a/opentelemetry-sdk/benches/trace.rs +++ b/opentelemetry-sdk/benches/trace.rs @@ -1,6 +1,6 @@ use criterion::{criterion_group, criterion_main, Criterion}; use futures_util::future::BoxFuture; -use opentelemetry_api::{ +use opentelemetry::{ trace::{Span, Tracer, TracerProvider}, Key, }; diff --git a/opentelemetry-sdk/src/attributes/set.rs b/opentelemetry-sdk/src/attributes/set.rs index df52b4b6d1..790ddc4e9f 100644 --- a/opentelemetry-sdk/src/attributes/set.rs +++ b/opentelemetry-sdk/src/attributes/set.rs @@ -4,7 +4,7 @@ use std::{ hash::{Hash, Hasher}, }; -use opentelemetry_api::{Array, Key, KeyValue, Value}; +use opentelemetry::{Array, Key, KeyValue, Value}; use ordered_float::OrderedFloat; use crate::Resource; diff --git a/opentelemetry-sdk/src/export/logs/mod.rs b/opentelemetry-sdk/src/export/logs/mod.rs index bbcf7c07cb..e8c3dcc1b0 100644 --- a/opentelemetry-sdk/src/export/logs/mod.rs +++ b/opentelemetry-sdk/src/export/logs/mod.rs @@ -2,8 +2,8 @@ use crate::Resource; use async_trait::async_trait; #[cfg(feature = "logs_level_enabled")] -use opentelemetry_api::logs::Severity; -use opentelemetry_api::{ +use opentelemetry::logs::Severity; +use opentelemetry::{ logs::{LogError, LogRecord, LogResult}, InstrumentationLibrary, }; diff --git a/opentelemetry-sdk/src/export/mod.rs b/opentelemetry-sdk/src/export/mod.rs index 8622bda739..c59a7028a5 100644 --- a/opentelemetry-sdk/src/export/mod.rs +++ b/opentelemetry-sdk/src/export/mod.rs @@ -8,4 +8,4 @@ pub mod logs; #[cfg_attr(docsrs, doc(cfg(feature = "trace")))] pub mod trace; -pub use opentelemetry_api::ExportError; +pub use opentelemetry::ExportError; diff --git a/opentelemetry-sdk/src/export/trace.rs b/opentelemetry-sdk/src/export/trace.rs index 7ad1513b57..0a04aa019c 100644 --- a/opentelemetry-sdk/src/export/trace.rs +++ b/opentelemetry-sdk/src/export/trace.rs @@ -1,7 +1,7 @@ //! Trace exporters use crate::Resource; use futures_util::future::BoxFuture; -use opentelemetry_api::trace::{Event, Link, SpanContext, SpanId, SpanKind, Status, TraceError}; +use opentelemetry::trace::{Event, Link, SpanContext, SpanId, SpanKind, Status, TraceError}; use std::borrow::Cow; use std::fmt::Debug; use std::time::SystemTime; diff --git a/opentelemetry-sdk/src/instrumentation.rs b/opentelemetry-sdk/src/instrumentation.rs index ca0947e62f..75a74efa73 100644 --- a/opentelemetry-sdk/src/instrumentation.rs +++ b/opentelemetry-sdk/src/instrumentation.rs @@ -1,4 +1,4 @@ -pub use opentelemetry_api::InstrumentationLibrary; +pub use opentelemetry::InstrumentationLibrary; /// A logical unit of the application code with which the emitted telemetry can /// be associated. diff --git a/opentelemetry-sdk/src/lib.rs b/opentelemetry-sdk/src/lib.rs index 2d39d26619..c59cbb5589 100644 --- a/opentelemetry-sdk/src/lib.rs +++ b/opentelemetry-sdk/src/lib.rs @@ -7,7 +7,7 @@ //! ```no_run //! # #[cfg(feature = "trace")] //! # { -//! use opentelemetry_api::{global, trace::{Tracer, TracerProvider as _}}; +//! use opentelemetry::{global, trace::{Tracer, TracerProvider as _}}; //! use opentelemetry_sdk::trace::TracerProvider; //! //! fn main() { @@ -38,7 +38,7 @@ //! spans. //! //! [examples]: https://github.com/open-telemetry/opentelemetry-rust/tree/main/examples -//! [`trace`]: https://docs.rs/opentelemetry_api/latest/opentelemetry_api/trace/index.html +//! [`trace`]: https://docs.rs/opentelemetry/latest/opentelemetry/trace/index.html //! //! # Metrics (Beta) //! @@ -50,7 +50,7 @@ //! ``` //! # #[cfg(feature = "metrics")] //! # { -//! use opentelemetry_api::{global, KeyValue}; +//! use opentelemetry::{global, KeyValue}; //! //! // get a meter from a provider //! let meter = global::meter("my_service"); @@ -69,7 +69,7 @@ //! managing instruments. //! //! [examples]: https://github.com/open-telemetry/opentelemetry-rust/tree/main/examples -//! [`metrics`]: https://docs.rs/opentelemetry_api/latest/opentelemetry_api/metrics/index.html +//! [`metrics`]: https://docs.rs/opentelemetry/latest/opentelemetry/metrics/index.html //! //! ## Crate Feature Flags //! diff --git a/opentelemetry-sdk/src/logs/log_emitter.rs b/opentelemetry-sdk/src/logs/log_emitter.rs index ab208fafb2..ee15ae47c2 100644 --- a/opentelemetry-sdk/src/logs/log_emitter.rs +++ b/opentelemetry-sdk/src/logs/log_emitter.rs @@ -3,7 +3,7 @@ use crate::{ export::logs::{LogData, LogExporter}, runtime::RuntimeChannel, }; -use opentelemetry_api::{ +use opentelemetry::{ global::{self}, logs::{LogRecord, LogResult, TraceContext}, trace::TraceContextExt, @@ -11,7 +11,7 @@ use opentelemetry_api::{ }; #[cfg(feature = "logs_level_enabled")] -use opentelemetry_api::logs::Severity; +use opentelemetry::logs::Severity; use std::{ borrow::Cow, @@ -27,7 +27,7 @@ pub struct LoggerProvider { /// Default logger name if empty string is provided. const DEFAULT_COMPONENT_NAME: &str = "rust.opentelemetry.io/sdk/logger"; -impl opentelemetry_api::logs::LoggerProvider for LoggerProvider { +impl opentelemetry::logs::LoggerProvider for LoggerProvider { type Logger = Logger; /// Create a new versioned `Logger` instance. @@ -36,7 +36,7 @@ impl opentelemetry_api::logs::LoggerProvider for LoggerProvider { name: impl Into>, version: Option>, schema_url: Option>, - attributes: Option>, + attributes: Option>, ) -> Logger { let name = name.into(); @@ -176,7 +176,7 @@ impl Builder { #[derive(Debug)] /// The object for emitting [`LogRecord`]s. /// -/// [`LogRecord`]: opentelemetry_api::logs::LogRecord +/// [`LogRecord`]: opentelemetry::logs::LogRecord pub struct Logger { instrumentation_lib: Arc, provider: Weak, @@ -204,7 +204,7 @@ impl Logger { } } -impl opentelemetry_api::logs::Logger for Logger { +impl opentelemetry::logs::Logger for Logger { /// Emit a `LogRecord`. fn emit(&self, record: LogRecord) { let provider = match self.provider() { diff --git a/opentelemetry-sdk/src/logs/log_processor.rs b/opentelemetry-sdk/src/logs/log_processor.rs index d951c9f399..6bac467a5b 100644 --- a/opentelemetry-sdk/src/logs/log_processor.rs +++ b/opentelemetry-sdk/src/logs/log_processor.rs @@ -8,8 +8,8 @@ use futures_util::{ {pin_mut, stream, StreamExt as _}, }; #[cfg(feature = "logs_level_enabled")] -use opentelemetry_api::logs::Severity; -use opentelemetry_api::{ +use opentelemetry::logs::Severity; +use opentelemetry::{ global, logs::{LogError, LogResult}, }; diff --git a/opentelemetry-sdk/src/metrics/aggregation.rs b/opentelemetry-sdk/src/metrics/aggregation.rs index 861c4e82b3..a92db0bab2 100644 --- a/opentelemetry-sdk/src/metrics/aggregation.rs +++ b/opentelemetry-sdk/src/metrics/aggregation.rs @@ -1,6 +1,6 @@ use std::fmt; -use opentelemetry_api::metrics::{MetricsError, Result}; +use opentelemetry::metrics::{MetricsError, Result}; /// The way recorded measurements are summarized. #[derive(Clone, Debug, PartialEq)] diff --git a/opentelemetry-sdk/src/metrics/data/mod.rs b/opentelemetry-sdk/src/metrics/data/mod.rs index 3cea3d7bb6..0a5c25a00f 100644 --- a/opentelemetry-sdk/src/metrics/data/mod.rs +++ b/opentelemetry-sdk/src/metrics/data/mod.rs @@ -2,7 +2,7 @@ use std::{any, borrow::Cow, fmt, time::SystemTime}; -use opentelemetry_api::{metrics::Unit, KeyValue}; +use opentelemetry::{metrics::Unit, KeyValue}; use crate::{attributes::AttributeSet, instrumentation::Scope, Resource}; diff --git a/opentelemetry-sdk/src/metrics/exporter.rs b/opentelemetry-sdk/src/metrics/exporter.rs index 2fa6f60d50..fbe8003fa2 100644 --- a/opentelemetry-sdk/src/metrics/exporter.rs +++ b/opentelemetry-sdk/src/metrics/exporter.rs @@ -1,7 +1,7 @@ //! Interfaces for exporting metrics use async_trait::async_trait; -use opentelemetry_api::metrics::Result; +use opentelemetry::metrics::Result; use crate::metrics::{ data::ResourceMetrics, diff --git a/opentelemetry-sdk/src/metrics/instrument.rs b/opentelemetry-sdk/src/metrics/instrument.rs index 75bd31ace5..cf9947a87e 100644 --- a/opentelemetry-sdk/src/metrics/instrument.rs +++ b/opentelemetry-sdk/src/metrics/instrument.rs @@ -1,6 +1,6 @@ use std::{any::Any, borrow::Cow, collections::HashSet, hash::Hash, marker, sync::Arc}; -use opentelemetry_api::{ +use opentelemetry::{ metrics::{ AsyncInstrument, MetricsError, Result, SyncCounter, SyncHistogram, SyncUpDownCounter, Unit, }, diff --git a/opentelemetry-sdk/src/metrics/internal/aggregator.rs b/opentelemetry-sdk/src/metrics/internal/aggregator.rs index 54f2419d96..84c3c3de90 100644 --- a/opentelemetry-sdk/src/metrics/internal/aggregator.rs +++ b/opentelemetry-sdk/src/metrics/internal/aggregator.rs @@ -1,6 +1,6 @@ use crate::{attributes::AttributeSet, metrics::data::Aggregation}; use once_cell::sync::Lazy; -use opentelemetry_api::KeyValue; +use opentelemetry::KeyValue; use std::sync::Arc; const STREAM_CARDINALITY_LIMIT: u32 = 2000; diff --git a/opentelemetry-sdk/src/metrics/internal/filter.rs b/opentelemetry-sdk/src/metrics/internal/filter.rs index 1f0f90740f..669b522528 100644 --- a/opentelemetry-sdk/src/metrics/internal/filter.rs +++ b/opentelemetry-sdk/src/metrics/internal/filter.rs @@ -1,6 +1,6 @@ use std::sync::Arc; -use opentelemetry_api::KeyValue; +use opentelemetry::KeyValue; use crate::{attributes::AttributeSet, metrics::data::Aggregation}; diff --git a/opentelemetry-sdk/src/metrics/internal/histogram.rs b/opentelemetry-sdk/src/metrics/internal/histogram.rs index 8da87e5194..a8bc38ba3a 100644 --- a/opentelemetry-sdk/src/metrics/internal/histogram.rs +++ b/opentelemetry-sdk/src/metrics/internal/histogram.rs @@ -9,7 +9,7 @@ use crate::metrics::{ aggregation, data::{self, Aggregation}, }; -use opentelemetry_api::{global, metrics::MetricsError}; +use opentelemetry::{global, metrics::MetricsError}; use super::{aggregator::STREAM_OVERFLOW_ATTRIBUTE_SET, Aggregator, Number}; diff --git a/opentelemetry-sdk/src/metrics/internal/last_value.rs b/opentelemetry-sdk/src/metrics/internal/last_value.rs index 35e072e030..555fc485b4 100644 --- a/opentelemetry-sdk/src/metrics/internal/last_value.rs +++ b/opentelemetry-sdk/src/metrics/internal/last_value.rs @@ -6,7 +6,7 @@ use std::{ use crate::attributes::AttributeSet; use crate::metrics::data::{self, Gauge}; -use opentelemetry_api::{global, metrics::MetricsError}; +use opentelemetry::{global, metrics::MetricsError}; use super::{aggregator::STREAM_OVERFLOW_ATTRIBUTE_SET, Aggregator, Number}; diff --git a/opentelemetry-sdk/src/metrics/internal/sum.rs b/opentelemetry-sdk/src/metrics/internal/sum.rs index 85b2f3e885..c53d3fcba8 100644 --- a/opentelemetry-sdk/src/metrics/internal/sum.rs +++ b/opentelemetry-sdk/src/metrics/internal/sum.rs @@ -6,7 +6,7 @@ use std::{ use crate::attributes::AttributeSet; use crate::metrics::data::{self, Aggregation, DataPoint, Temporality}; -use opentelemetry_api::{global, metrics::MetricsError}; +use opentelemetry::{global, metrics::MetricsError}; use super::{ aggregator::{PrecomputeAggregator, STREAM_OVERFLOW_ATTRIBUTE_SET}, diff --git a/opentelemetry-sdk/src/metrics/manual_reader.rs b/opentelemetry-sdk/src/metrics/manual_reader.rs index 14c4fbaee6..a02b28978d 100644 --- a/opentelemetry-sdk/src/metrics/manual_reader.rs +++ b/opentelemetry-sdk/src/metrics/manual_reader.rs @@ -3,7 +3,7 @@ use std::{ sync::{Mutex, Weak}, }; -use opentelemetry_api::{ +use opentelemetry::{ global, metrics::{MetricsError, Result}, Context, diff --git a/opentelemetry-sdk/src/metrics/meter.rs b/opentelemetry-sdk/src/metrics/meter.rs index c806b4e699..7fecee1784 100644 --- a/opentelemetry-sdk/src/metrics/meter.rs +++ b/opentelemetry-sdk/src/metrics/meter.rs @@ -6,7 +6,7 @@ use std::{ sync::{Arc, Mutex}, }; -use opentelemetry_api::{ +use opentelemetry::{ global, metrics::{ noop::{NoopAsyncInstrument, NoopRegistration}, @@ -35,7 +35,7 @@ use crate::metrics::{ /// /// See the [Meter API] docs for usage. /// -/// [Meter API]: opentelemetry_api::metrics::Meter +/// [Meter API]: opentelemetry::metrics::Meter pub struct Meter { scope: Scope, pipes: Arc, diff --git a/opentelemetry-sdk/src/metrics/meter_provider.rs b/opentelemetry-sdk/src/metrics/meter_provider.rs index 701aee474e..b1559a250c 100644 --- a/opentelemetry-sdk/src/metrics/meter_provider.rs +++ b/opentelemetry-sdk/src/metrics/meter_provider.rs @@ -7,7 +7,7 @@ use std::{ }, }; -use opentelemetry_api::{ +use opentelemetry::{ metrics::{noop::NoopMeterCore, InstrumentProvider, Meter as ApiMeter, MetricsError, Result}, Context, KeyValue, }; @@ -114,7 +114,7 @@ impl MeterProvider { } } -impl opentelemetry_api::metrics::MeterProvider for MeterProvider { +impl opentelemetry::metrics::MeterProvider for MeterProvider { fn versioned_meter( &self, name: impl Into>, diff --git a/opentelemetry-sdk/src/metrics/mod.rs b/opentelemetry-sdk/src/metrics/mod.rs index 00bf5a159b..ece677ca42 100644 --- a/opentelemetry-sdk/src/metrics/mod.rs +++ b/opentelemetry-sdk/src/metrics/mod.rs @@ -9,7 +9,7 @@ //! ### Example //! //! ``` -//! use opentelemetry_api::{ +//! use opentelemetry::{ //! metrics::{MeterProvider as _, Unit}, //! KeyValue, //! }; diff --git a/opentelemetry-sdk/src/metrics/periodic_reader.rs b/opentelemetry-sdk/src/metrics/periodic_reader.rs index e391b2eeb8..066c0025a6 100644 --- a/opentelemetry-sdk/src/metrics/periodic_reader.rs +++ b/opentelemetry-sdk/src/metrics/periodic_reader.rs @@ -11,7 +11,7 @@ use futures_util::{ stream::{self, FusedStream}, Stream, StreamExt, }; -use opentelemetry_api::{ +use opentelemetry::{ global, metrics::{MetricsError, Result}, Context, diff --git a/opentelemetry-sdk/src/metrics/pipeline.rs b/opentelemetry-sdk/src/metrics/pipeline.rs index 962acc0635..322210671d 100644 --- a/opentelemetry-sdk/src/metrics/pipeline.rs +++ b/opentelemetry-sdk/src/metrics/pipeline.rs @@ -5,7 +5,7 @@ use std::{ sync::{Arc, Mutex}, }; -use opentelemetry_api::{ +use opentelemetry::{ global, metrics::{CallbackRegistration, MetricsError, Result, Unit}, Context, diff --git a/opentelemetry-sdk/src/metrics/reader.rs b/opentelemetry-sdk/src/metrics/reader.rs index 7f17552c71..fbc8b755ff 100644 --- a/opentelemetry-sdk/src/metrics/reader.rs +++ b/opentelemetry-sdk/src/metrics/reader.rs @@ -1,7 +1,7 @@ //! Interfaces for reading and producing metrics use std::{fmt, sync::Weak}; -use opentelemetry_api::{metrics::Result, Context}; +use opentelemetry::{metrics::Result, Context}; use super::{ aggregation::Aggregation, diff --git a/opentelemetry-sdk/src/metrics/view.rs b/opentelemetry-sdk/src/metrics/view.rs index 2b6e4c069a..d56d8b7067 100644 --- a/opentelemetry-sdk/src/metrics/view.rs +++ b/opentelemetry-sdk/src/metrics/view.rs @@ -1,4 +1,4 @@ -use opentelemetry_api::{ +use opentelemetry::{ global, metrics::{MetricsError, Result}, }; diff --git a/opentelemetry-sdk/src/propagation/baggage.rs b/opentelemetry-sdk/src/propagation/baggage.rs index 6fd6600c2f..ee7cf285d6 100644 --- a/opentelemetry-sdk/src/propagation/baggage.rs +++ b/opentelemetry-sdk/src/propagation/baggage.rs @@ -7,13 +7,13 @@ //! `Baggage`s are serialized according to the editor's draft of //! the [W3C Baggage] specification. //! -//! [`Baggage`]: opentelemetry_api::baggage::Baggage +//! [`Baggage`]: opentelemetry::baggage::Baggage //! [W3C Baggage]: https://w3c.github.io/baggage/ //! //! # Examples //! //! ``` -//! use opentelemetry_api::{baggage::BaggageExt, Key, propagation::TextMapPropagator}; +//! use opentelemetry::{baggage::BaggageExt, Key, propagation::TextMapPropagator}; //! use opentelemetry_sdk::propagation::BaggagePropagator; //! use std::collections::HashMap; //! @@ -41,7 +41,7 @@ //! assert!(header_value.contains("server_id=42"), "contains new name-value pair"); //! ``` use once_cell::sync::Lazy; -use opentelemetry_api::{ +use opentelemetry::{ baggage::{BaggageExt, KeyValueMetadata}, propagation::{text_map_propagator::FieldIter, Extractor, Injector, TextMapPropagator}, Context, @@ -65,7 +65,7 @@ static BAGGAGE_FIELDS: Lazy<[String; 1]> = Lazy::new(|| [BAGGAGE_HEADER.to_owned /// # Examples /// /// ``` -/// use opentelemetry_api::{baggage::BaggageExt, Key, propagation::TextMapPropagator}; +/// use opentelemetry::{baggage::BaggageExt, Key, propagation::TextMapPropagator}; /// use opentelemetry_sdk::propagation::BaggagePropagator; /// use std::collections::HashMap; /// @@ -94,7 +94,7 @@ static BAGGAGE_FIELDS: Lazy<[String; 1]> = Lazy::new(|| [BAGGAGE_HEADER.to_owned /// ``` /// /// [W3C Baggage]: https://w3c.github.io/baggage -/// [`Baggage`]: opentelemetry_api::baggage::Baggage +/// [`Baggage`]: opentelemetry::baggage::Baggage #[derive(Debug, Default)] pub struct BaggagePropagator { _private: (), @@ -181,7 +181,7 @@ impl TextMapPropagator for BaggagePropagator { #[cfg(test)] mod tests { use super::*; - use opentelemetry_api::{ + use opentelemetry::{ baggage::BaggageMetadata, propagation::TextMapPropagator, Key, KeyValue, StringValue, Value, }; use std::collections::HashMap; diff --git a/opentelemetry-sdk/src/propagation/composite.rs b/opentelemetry-sdk/src/propagation/composite.rs index cddd6c934c..218b5399ae 100644 --- a/opentelemetry-sdk/src/propagation/composite.rs +++ b/opentelemetry-sdk/src/propagation/composite.rs @@ -1,4 +1,4 @@ -use opentelemetry_api::{ +use opentelemetry::{ propagation::{text_map_propagator::FieldIter, Extractor, Injector, TextMapPropagator}, Context, }; @@ -12,12 +12,12 @@ use std::collections::HashSet; /// Injection and extraction from this propagator will preserve the order of the /// injectors and extractors passed in during initialization. /// -/// [`TextMapPropagator`]: opentelemetry_api::propagation::TextMapPropagator +/// [`TextMapPropagator`]: opentelemetry::propagation::TextMapPropagator /// /// # Examples /// /// ``` -/// use opentelemetry_api::{ +/// use opentelemetry::{ /// baggage::BaggageExt, /// propagation::TextMapPropagator, /// trace::{TraceContextExt, Tracer, TracerProvider}, @@ -67,7 +67,7 @@ pub struct TextMapCompositePropagator { impl TextMapCompositePropagator { /// Constructs a new propagator out of instances of [`TextMapPropagator`]. /// - /// [`TextMapPropagator`]: opentelemetry_api::propagation::TextMapPropagator + /// [`TextMapPropagator`]: opentelemetry::propagation::TextMapPropagator pub fn new(propagators: Vec>) -> Self { let mut fields = HashSet::new(); for propagator in &propagators { @@ -111,7 +111,7 @@ impl TextMapPropagator for TextMapCompositePropagator { mod tests { use crate::propagation::{TextMapCompositePropagator, TraceContextPropagator}; use crate::testing::trace::TestSpan; - use opentelemetry_api::{ + use opentelemetry::{ propagation::{text_map_propagator::FieldIter, Extractor, Injector, TextMapPropagator}, trace::{SpanContext, SpanId, TraceContextExt, TraceFlags, TraceId, TraceState}, Context, diff --git a/opentelemetry-sdk/src/propagation/trace_context.rs b/opentelemetry-sdk/src/propagation/trace_context.rs index e3d570ebf2..05a315677c 100644 --- a/opentelemetry-sdk/src/propagation/trace_context.rs +++ b/opentelemetry-sdk/src/propagation/trace_context.rs @@ -18,7 +18,7 @@ //! //! [w3c trace-context docs]: https://w3c.github.io/trace-context/ use once_cell::sync::Lazy; -use opentelemetry_api::{ +use opentelemetry::{ propagation::{text_map_propagator::FieldIter, Extractor, Injector, TextMapPropagator}, trace::{SpanContext, SpanId, TraceContextExt, TraceFlags, TraceId, TraceState}, Context, @@ -144,7 +144,7 @@ impl TextMapPropagator for TraceContextPropagator { mod tests { use super::*; use crate::testing::trace::TestSpan; - use opentelemetry_api::{ + use opentelemetry::{ propagation::{Extractor, Injector, TextMapPropagator}, trace::{SpanContext, SpanId, TraceId}, }; diff --git a/opentelemetry-sdk/src/resource/env.rs b/opentelemetry-sdk/src/resource/env.rs index fd87ccbd91..15cc31cd24 100644 --- a/opentelemetry-sdk/src/resource/env.rs +++ b/opentelemetry-sdk/src/resource/env.rs @@ -3,7 +3,7 @@ //! Implementation of `ResourceDetector` to extract a `Resource` from environment //! variables. use crate::resource::{Resource, ResourceDetector}; -use opentelemetry_api::{Key, KeyValue, Value}; +use opentelemetry::{Key, KeyValue, Value}; use std::env; use std::time::Duration; @@ -97,7 +97,7 @@ mod tests { SdkProvidedResourceDetector, OTEL_RESOURCE_ATTRIBUTES, OTEL_SERVICE_NAME, }; use crate::resource::{EnvResourceDetector, Resource, ResourceDetector}; - use opentelemetry_api::{Key, KeyValue, Value}; + use opentelemetry::{Key, KeyValue, Value}; use std::time::Duration; use std::{env, time}; diff --git a/opentelemetry-sdk/src/resource/mod.rs b/opentelemetry-sdk/src/resource/mod.rs index bb9d19f78a..46808cefd3 100644 --- a/opentelemetry-sdk/src/resource/mod.rs +++ b/opentelemetry-sdk/src/resource/mod.rs @@ -30,7 +30,7 @@ pub use os::OsResourceDetector; pub use process::ProcessResourceDetector; pub use telemetry::TelemetryResourceDetector; -use opentelemetry_api::{Key, KeyValue, Value}; +use opentelemetry::{Key, KeyValue, Value}; use std::borrow::Cow; use std::collections::{hash_map, HashMap}; use std::ops::Deref; diff --git a/opentelemetry-sdk/src/resource/os.rs b/opentelemetry-sdk/src/resource/os.rs index 74b0b2bd4e..6009ce6cb8 100644 --- a/opentelemetry-sdk/src/resource/os.rs +++ b/opentelemetry-sdk/src/resource/os.rs @@ -3,7 +3,7 @@ //! Detect the runtime operating system type. use crate::resource::ResourceDetector; use crate::Resource; -use opentelemetry_api::KeyValue; +use opentelemetry::KeyValue; use std::env::consts::OS; use std::time::Duration; @@ -28,7 +28,7 @@ impl ResourceDetector for OsResourceDetector { mod tests { use crate::resource::os::OsResourceDetector; use crate::resource::ResourceDetector; - use opentelemetry_api::Key; + use opentelemetry::Key; use std::time::Duration; #[test] diff --git a/opentelemetry-sdk/src/resource/process.rs b/opentelemetry-sdk/src/resource/process.rs index 1c1a8d7154..7c1e22d09d 100644 --- a/opentelemetry-sdk/src/resource/process.rs +++ b/opentelemetry-sdk/src/resource/process.rs @@ -4,7 +4,7 @@ use crate::resource::ResourceDetector; use crate::Resource; -use opentelemetry_api::{KeyValue, StringValue, Value}; +use opentelemetry::{KeyValue, StringValue, Value}; use std::env::args_os; use std::process::id; use std::time::Duration; diff --git a/opentelemetry-sdk/src/resource/telemetry.rs b/opentelemetry-sdk/src/resource/telemetry.rs index d29db229bc..9948f2953b 100644 --- a/opentelemetry-sdk/src/resource/telemetry.rs +++ b/opentelemetry-sdk/src/resource/telemetry.rs @@ -1,6 +1,6 @@ use crate::resource::ResourceDetector; use crate::Resource; -use opentelemetry_api::KeyValue; +use opentelemetry::KeyValue; use std::time::Duration; /// Detect the telemetry SDK information used to capture data recorded by the instrumentation libraries. diff --git a/opentelemetry-sdk/src/testing/metrics/in_memory_exporter.rs b/opentelemetry-sdk/src/testing/metrics/in_memory_exporter.rs index 7cacd49015..e99124731b 100644 --- a/opentelemetry-sdk/src/testing/metrics/in_memory_exporter.rs +++ b/opentelemetry-sdk/src/testing/metrics/in_memory_exporter.rs @@ -6,8 +6,8 @@ use crate::metrics::reader::{ }; use crate::metrics::{data, Aggregation, InstrumentKind}; use async_trait::async_trait; -use opentelemetry_api::metrics::MetricsError; -use opentelemetry_api::metrics::Result; +use opentelemetry::metrics::MetricsError; +use opentelemetry::metrics::Result; use std::collections::VecDeque; use std::fmt; use std::sync::{Arc, Mutex}; @@ -28,8 +28,8 @@ use std::sync::{Arc, Mutex}; /// /// ``` ///# use opentelemetry_sdk::{metrics, runtime}; -///# use opentelemetry_api::{Context, KeyValue}; -///# use opentelemetry_api::metrics::MeterProvider; +///# use opentelemetry::{Context, KeyValue}; +///# use opentelemetry::metrics::MeterProvider; ///# use opentelemetry_sdk::testing::metrics::InMemoryMetricsExporter; ///# use opentelemetry_sdk::metrics::PeriodicReader; /// diff --git a/opentelemetry-sdk/src/testing/trace.rs b/opentelemetry-sdk/src/testing/trace.rs index b8d6f42507..8c6980e152 100644 --- a/opentelemetry-sdk/src/testing/trace.rs +++ b/opentelemetry-sdk/src/testing/trace.rs @@ -8,8 +8,8 @@ use crate::{ }; use async_trait::async_trait; use futures_util::future::BoxFuture; -pub use opentelemetry_api::testing::trace::TestSpan; -use opentelemetry_api::trace::{ +pub use opentelemetry::testing::trace::TestSpan; +use opentelemetry::trace::{ SpanContext, SpanId, SpanKind, Status, TraceFlags, TraceId, TraceState, }; use std::fmt::{Display, Formatter}; @@ -28,8 +28,8 @@ pub fn new_test_export_span_data() -> SpanData { parent_span_id: SpanId::INVALID, span_kind: SpanKind::Internal, name: "opentelemetry".into(), - start_time: opentelemetry_api::time::now(), - end_time: opentelemetry_api::time::now(), + start_time: opentelemetry::time::now(), + end_time: opentelemetry::time::now(), attributes: EvictedHashMap::new(config.span_limits.max_attributes_per_span, 0), events: EvictedQueue::new(config.span_limits.max_events_per_span), links: EvictedQueue::new(config.span_limits.max_links_per_span), diff --git a/opentelemetry-sdk/src/trace/config.rs b/opentelemetry-sdk/src/trace/config.rs index 17e8bdf43b..88aa925286 100644 --- a/opentelemetry-sdk/src/trace/config.rs +++ b/opentelemetry-sdk/src/trace/config.rs @@ -4,7 +4,7 @@ //! can be set for the default OpenTelemetry limits and Sampler. use crate::trace::{span_limit::SpanLimits, IdGenerator, RandomIdGenerator, Sampler, ShouldSample}; use crate::Resource; -use opentelemetry_api::global::{handle_error, Error}; +use opentelemetry::global::{handle_error, Error}; use std::borrow::Cow; use std::env; use std::str::FromStr; diff --git a/opentelemetry-sdk/src/trace/evicted_hash_map.rs b/opentelemetry-sdk/src/trace/evicted_hash_map.rs index d766b14136..46c84de62c 100644 --- a/opentelemetry-sdk/src/trace/evicted_hash_map.rs +++ b/opentelemetry-sdk/src/trace/evicted_hash_map.rs @@ -1,6 +1,6 @@ //! # Evicted Map -use opentelemetry_api::{Key, KeyValue, Value}; +use opentelemetry::{Key, KeyValue, Value}; use std::collections::hash_map::Entry; use std::collections::{HashMap, LinkedList}; diff --git a/opentelemetry-sdk/src/trace/id_generator/aws.rs b/opentelemetry-sdk/src/trace/id_generator/aws.rs index db668059f2..958495fdbd 100644 --- a/opentelemetry-sdk/src/trace/id_generator/aws.rs +++ b/opentelemetry-sdk/src/trace/id_generator/aws.rs @@ -1,5 +1,5 @@ use crate::trace::{IdGenerator, RandomIdGenerator}; -use opentelemetry_api::trace::{SpanId, TraceId}; +use opentelemetry::trace::{SpanId, TraceId}; use std::time::{Duration, UNIX_EPOCH}; /// Generates AWS X-Ray compliant Trace and Span ids. @@ -46,7 +46,7 @@ impl IdGenerator for XrayIdGenerator { default_trace_id.truncate(24); - let epoch_time_seconds: u64 = opentelemetry_api::time::now() + let epoch_time_seconds: u64 = opentelemetry::time::now() .duration_since(UNIX_EPOCH) .unwrap_or_else(|_| Duration::from_secs(0)) .as_secs(); @@ -68,7 +68,7 @@ mod tests { #[test] fn test_trace_id_generation() { - let before: u64 = opentelemetry_api::time::now() + let before: u64 = opentelemetry::time::now() .duration_since(UNIX_EPOCH) .unwrap() .as_secs(); @@ -78,7 +78,7 @@ mod tests { let trace_id: TraceId = generator.new_trace_id(); sleep(Duration::from_secs(1)); - let after: u64 = opentelemetry_api::time::now() + let after: u64 = opentelemetry::time::now() .duration_since(UNIX_EPOCH) .unwrap() .as_secs(); diff --git a/opentelemetry-sdk/src/trace/id_generator/mod.rs b/opentelemetry-sdk/src/trace/id_generator/mod.rs index cf99b197cf..b0c73e6a1c 100644 --- a/opentelemetry-sdk/src/trace/id_generator/mod.rs +++ b/opentelemetry-sdk/src/trace/id_generator/mod.rs @@ -1,7 +1,7 @@ //! Id Generator pub(super) mod aws; -use opentelemetry_api::trace::{SpanId, TraceId}; +use opentelemetry::trace::{SpanId, TraceId}; use rand::{rngs, Rng}; use std::cell::RefCell; use std::fmt; diff --git a/opentelemetry-sdk/src/trace/provider.rs b/opentelemetry-sdk/src/trace/provider.rs index ef0383bb0a..30c05c2003 100644 --- a/opentelemetry-sdk/src/trace/provider.rs +++ b/opentelemetry-sdk/src/trace/provider.rs @@ -13,7 +13,7 @@ use crate::trace::{BatchMessage, BatchSpanProcessor, SimpleSpanProcessor, Tracer use crate::{export::trace::SpanExporter, trace::SpanProcessor}; use crate::{InstrumentationLibrary, Resource}; use once_cell::sync::OnceCell; -use opentelemetry_api::{global, trace::TraceResult}; +use opentelemetry::{global, trace::TraceResult}; use std::borrow::Cow; use std::sync::Arc; @@ -76,7 +76,7 @@ impl TracerProvider { /// # Examples /// /// ``` - /// use opentelemetry_api::global; + /// use opentelemetry::global; /// use opentelemetry_sdk::trace::TracerProvider; /// /// fn init_tracing() -> TracerProvider { @@ -116,7 +116,7 @@ impl TracerProvider { } } -impl opentelemetry_api::trace::TracerProvider for TracerProvider { +impl opentelemetry::trace::TracerProvider for TracerProvider { /// This implementation of `TracerProvider` produces `Tracer` instances. type Tracer = crate::trace::Tracer; @@ -126,7 +126,7 @@ impl opentelemetry_api::trace::TracerProvider for TracerProvider { name: impl Into>, version: Option>>, schema_url: Option>>, - attributes: Option>, + attributes: Option>, ) -> Self::Tracer { // Use default value if name is invalid empty string let name = name.into(); @@ -226,8 +226,8 @@ mod tests { use crate::trace::provider::TracerProviderInner; use crate::trace::{Config, Span, SpanProcessor}; use crate::Resource; - use opentelemetry_api::trace::{TraceError, TraceResult}; - use opentelemetry_api::{Context, Key, KeyValue}; + use opentelemetry::trace::{TraceError, TraceResult}; + use opentelemetry::{Context, Key, KeyValue}; use std::borrow::Cow; use std::env; use std::sync::Arc; diff --git a/opentelemetry-sdk/src/trace/runtime_tests.rs b/opentelemetry-sdk/src/trace/runtime_tests.rs index 1598ce1787..e88ce596af 100644 --- a/opentelemetry-sdk/src/trace/runtime_tests.rs +++ b/opentelemetry-sdk/src/trace/runtime_tests.rs @@ -10,9 +10,9 @@ use crate::runtime::RuntimeChannel; use crate::trace::BatchMessage; use futures_util::future::BoxFuture; #[cfg(any(feature = "rt-tokio", feature = "rt-tokio-current-thread"))] -use opentelemetry_api::global::*; +use opentelemetry::global::*; #[cfg(any(feature = "rt-tokio", feature = "rt-tokio-current-thread"))] -use opentelemetry_api::trace::Tracer; +use opentelemetry::trace::Tracer; use std::fmt::Debug; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; diff --git a/opentelemetry-sdk/src/trace/sampler.rs b/opentelemetry-sdk/src/trace/sampler.rs index 0722934d67..8b62c9f554 100644 --- a/opentelemetry-sdk/src/trace/sampler.rs +++ b/opentelemetry-sdk/src/trace/sampler.rs @@ -1,4 +1,4 @@ -use opentelemetry_api::{ +use opentelemetry::{ trace::{ Link, SamplingDecision, SamplingResult, SpanKind, TraceContextExt, TraceId, TraceState, }, @@ -56,12 +56,12 @@ use opentelemetry_http::HttpClient; /// MUST NOT allow this combination. /// /// [OpenTelemetry SDK]: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#sampling -/// [`SpanContext`]: opentelemetry_api::trace::SpanContext -/// [`SpanContext::trace_flags()`]: opentelemetry_api::trace::SpanContext#method.trace_flags +/// [`SpanContext`]: opentelemetry::trace::SpanContext +/// [`SpanContext::trace_flags()`]: opentelemetry::trace::SpanContext#method.trace_flags /// [`SpanExporter`]: crate::export::trace::SpanExporter /// [`SpanProcessor`]: crate::trace::SpanProcessor -/// [`Span`]: opentelemetry_api::trace::Span -/// [`Span::is_recording()`]: opentelemetry_api::trace::Span#tymethod.is_recording +/// [`Span`]: opentelemetry::trace::Span +/// [`Span::is_recording()`]: opentelemetry::trace::Span#tymethod.is_recording pub trait ShouldSample: CloneShouldSample + Send + Sync + std::fmt::Debug { /// Returns the [`SamplingDecision`] for a [`Span`] to be created. /// @@ -69,7 +69,7 @@ pub trait ShouldSample: CloneShouldSample + Send + Sync + std::fmt::Debug { /// make a decision about whether or not a [`Span`] should or should not be sampled. However, /// there are performance implications on the creation of a span /// - /// [`Span`]: opentelemetry_api::trace::Span + /// [`Span`]: opentelemetry::trace::Span /// [`should_sample`]: ShouldSample::should_sample #[allow(clippy::too_many_arguments)] fn should_sample( @@ -251,7 +251,7 @@ mod tests { use super::*; use crate::testing::trace::TestSpan; use crate::trace::{Sampler, ShouldSample}; - use opentelemetry_api::trace::{SamplingDecision, SpanContext, SpanId, TraceFlags, TraceState}; + use opentelemetry::trace::{SamplingDecision, SpanContext, SpanId, TraceFlags, TraceState}; use rand::Rng; #[rustfmt::skip] diff --git a/opentelemetry-sdk/src/trace/sampler/jaeger_remote/rate_limit.rs b/opentelemetry-sdk/src/trace/sampler/jaeger_remote/rate_limit.rs index db3990cec9..436df8f096 100644 --- a/opentelemetry-sdk/src/trace/sampler/jaeger_remote/rate_limit.rs +++ b/opentelemetry-sdk/src/trace/sampler/jaeger_remote/rate_limit.rs @@ -1,4 +1,4 @@ -use opentelemetry_api::trace::TraceError; +use opentelemetry::trace::TraceError; use std::time::SystemTime; // leaky bucket based rate limit @@ -16,7 +16,7 @@ impl LeakyBucket { span_per_sec, available: bucket_size, bucket_size, - last_time: opentelemetry_api::time::now(), + last_time: opentelemetry::time::now(), } } @@ -25,7 +25,7 @@ impl LeakyBucket { } pub(crate) fn should_sample(&mut self) -> bool { - self.check_availability(opentelemetry_api::time::now) + self.check_availability(opentelemetry::time::now) } fn check_availability(&mut self, now: F) -> bool @@ -54,7 +54,7 @@ impl LeakyBucket { } } Err(_) => { - opentelemetry_api::global::handle_error(TraceError::Other( + opentelemetry::global::handle_error(TraceError::Other( "jaeger remote sampler gets rewinded timestamp".into(), )); true diff --git a/opentelemetry-sdk/src/trace/sampler/jaeger_remote/sampler.rs b/opentelemetry-sdk/src/trace/sampler/jaeger_remote/sampler.rs index cadd87278d..2f67ebcf2b 100644 --- a/opentelemetry-sdk/src/trace/sampler/jaeger_remote/sampler.rs +++ b/opentelemetry-sdk/src/trace/sampler/jaeger_remote/sampler.rs @@ -4,8 +4,8 @@ use crate::trace::sampler::jaeger_remote::sampling_strategy::Inner; use crate::trace::{BatchMessage, Sampler, ShouldSample}; use futures_util::{stream, StreamExt as _}; use http::Uri; -use opentelemetry_api::trace::{Link, SamplingResult, SpanKind, TraceError, TraceId}; -use opentelemetry_api::{global, Context, Key, OrderMap, Value}; +use opentelemetry::trace::{Link, SamplingResult, SpanKind, TraceError, TraceId}; +use opentelemetry::{global, Context, Key, OrderMap, Value}; use opentelemetry_http::HttpClient; use std::str::FromStr; use std::sync::Arc; diff --git a/opentelemetry-sdk/src/trace/sampler/jaeger_remote/sampling_strategy.rs b/opentelemetry-sdk/src/trace/sampler/jaeger_remote/sampling_strategy.rs index bb66233142..b48642d478 100644 --- a/opentelemetry-sdk/src/trace/sampler/jaeger_remote/sampling_strategy.rs +++ b/opentelemetry-sdk/src/trace/sampler/jaeger_remote/sampling_strategy.rs @@ -3,10 +3,10 @@ use crate::trace::sampler::jaeger_remote::remote::{ SamplingStrategyResponse, }; use crate::trace::sampler::sample_based_on_probability; -use opentelemetry_api::trace::{ +use opentelemetry::trace::{ SamplingDecision, SamplingResult, TraceContextExt, TraceError, TraceId, TraceState, }; -use opentelemetry_api::{global, Context}; +use opentelemetry::{global, Context}; use std::collections::HashMap; use std::fmt::{Debug, Formatter}; use std::sync::Mutex; diff --git a/opentelemetry-sdk/src/trace/span.rs b/opentelemetry-sdk/src/trace/span.rs index c1cd0fbd25..3e40c96ff6 100644 --- a/opentelemetry-sdk/src/trace/span.rs +++ b/opentelemetry-sdk/src/trace/span.rs @@ -10,8 +10,8 @@ //! These cannot be changed after the `Span`'s end time has been set. use crate::trace::SpanLimits; use crate::Resource; -use opentelemetry_api::trace::{Event, SpanContext, SpanId, SpanKind, Status}; -use opentelemetry_api::{trace, KeyValue}; +use opentelemetry::trace::{Event, SpanContext, SpanId, SpanKind, Status}; +use opentelemetry::{trace, KeyValue}; use std::borrow::Cow; use std::time::SystemTime; @@ -82,7 +82,7 @@ impl Span { } } -impl opentelemetry_api::trace::Span for Span { +impl opentelemetry::trace::Span for Span { /// Records events at a specific time in the context of a given `Span`. /// /// Note that the OpenTelemetry project documents certain ["standard event names and @@ -180,7 +180,7 @@ impl Span { if let Some(timestamp) = timestamp { data.end_time = timestamp; } else if data.end_time == data.start_time { - data.end_time = opentelemetry_api::time::now(); + data.end_time = opentelemetry::time::now(); } match provider.span_processors().as_slice() { @@ -244,8 +244,8 @@ mod tests { use crate::trace::span_limit::{ DEFAULT_MAX_ATTRIBUTES_PER_EVENT, DEFAULT_MAX_ATTRIBUTES_PER_LINK, }; - use opentelemetry_api::trace::{Link, TraceFlags, TraceId, Tracer}; - use opentelemetry_api::{trace::Span as _, trace::TracerProvider, KeyValue}; + use opentelemetry::trace::{Link, TraceFlags, TraceId, Tracer}; + use opentelemetry::{trace::Span as _, trace::TracerProvider, KeyValue}; use std::time::Duration; fn init() -> (crate::trace::Tracer, SpanData) { @@ -256,8 +256,8 @@ mod tests { parent_span_id: SpanId::from_u64(0), span_kind: trace::SpanKind::Internal, name: "opentelemetry".into(), - start_time: opentelemetry_api::time::now(), - end_time: opentelemetry_api::time::now(), + start_time: opentelemetry::time::now(), + end_time: opentelemetry::time::now(), attributes: crate::trace::EvictedHashMap::new( config.span_limits.max_attributes_per_span, 0, @@ -324,7 +324,7 @@ mod tests { let mut span = create_span(); let name = "some_event"; let attributes = vec![KeyValue::new("k", "v")]; - let timestamp = opentelemetry_api::time::now(); + let timestamp = opentelemetry::time::now(); span.add_event_with_timestamp(name, timestamp, attributes.clone()); span.with_data(|data| { if let Some(event) = data.events.iter().next() { @@ -436,7 +436,7 @@ mod tests { #[test] fn end_with_timestamp() { let mut span = create_span(); - let timestamp = opentelemetry_api::time::now(); + let timestamp = opentelemetry::time::now(); span.end_with_timestamp(timestamp); span.with_data(|data| assert_eq!(data.end_time, timestamp)); } @@ -451,7 +451,7 @@ mod tests { #[test] fn end_only_once() { let mut span = create_span(); - let timestamp = opentelemetry_api::time::now(); + let timestamp = opentelemetry::time::now(); span.end_with_timestamp(timestamp); span.end_with_timestamp(timestamp.checked_add(Duration::from_secs(10)).unwrap()); span.with_data(|data| assert_eq!(data.end_time, timestamp)); @@ -465,7 +465,7 @@ mod tests { span.add_event("some_event", vec![KeyValue::new("k", "v")]); span.add_event_with_timestamp( "some_event", - opentelemetry_api::time::now(), + opentelemetry::time::now(), vec![KeyValue::new("k", "v")], ); let err = std::io::Error::from(std::io::ErrorKind::Other); diff --git a/opentelemetry-sdk/src/trace/span_processor.rs b/opentelemetry-sdk/src/trace/span_processor.rs index 2e9142d136..2dcef83ea0 100644 --- a/opentelemetry-sdk/src/trace/span_processor.rs +++ b/opentelemetry-sdk/src/trace/span_processor.rs @@ -31,8 +31,8 @@ //! +-----+--------------+ +---------------------+ //! ``` //! -//! [`is_recording`]: opentelemetry_api::trace::Span::is_recording() -//! [`TracerProvider`]: opentelemetry_api::trace::TracerProvider +//! [`is_recording`]: opentelemetry::trace::Span::is_recording() +//! [`TracerProvider`]: opentelemetry::trace::TracerProvider use crate::export::trace::{ExportResult, SpanData, SpanExporter}; use crate::runtime::{RuntimeChannel, TrySend}; @@ -44,8 +44,8 @@ use futures_util::{ stream::{self, FusedStream, FuturesUnordered}, Stream, StreamExt as _, }; -use opentelemetry_api::global; -use opentelemetry_api::{ +use opentelemetry::global; +use opentelemetry::{ trace::{TraceError, TraceResult}, Context, }; @@ -222,7 +222,7 @@ enum Message { /// ``` /// # #[cfg(feature="tokio")] /// # { -/// use opentelemetry_api::global; +/// use opentelemetry::global; /// use opentelemetry_sdk::{runtime, testing::trace::NoopSpanExporter, trace}; /// use std::time::Duration; /// @@ -720,7 +720,7 @@ mod tests { }; use crate::trace::{BatchConfig, EvictedHashMap, EvictedQueue}; use async_trait::async_trait; - use opentelemetry_api::trace::{SpanContext, SpanId, SpanKind, Status}; + use opentelemetry::trace::{SpanContext, SpanId, SpanKind, Status}; use std::fmt::Debug; use std::future::Future; use std::time::Duration; @@ -743,8 +743,8 @@ mod tests { parent_span_id: SpanId::INVALID, span_kind: SpanKind::Internal, name: "opentelemetry".into(), - start_time: opentelemetry_api::time::now(), - end_time: opentelemetry_api::time::now(), + start_time: opentelemetry::time::now(), + end_time: opentelemetry::time::now(), attributes: EvictedHashMap::new(0, 0), events: EvictedQueue::new(0), links: EvictedQueue::new(0), diff --git a/opentelemetry-sdk/src/trace/tracer.rs b/opentelemetry-sdk/src/trace/tracer.rs index 2ca5e05296..849604ad63 100644 --- a/opentelemetry-sdk/src/trace/tracer.rs +++ b/opentelemetry-sdk/src/trace/tracer.rs @@ -16,7 +16,7 @@ use crate::{ InstrumentationLibrary, }; use once_cell::sync::Lazy; -use opentelemetry_api::{ +use opentelemetry::{ trace::{ Link, SamplingDecision, SamplingResult, SpanBuilder, SpanContext, SpanId, SpanKind, TraceContextExt, TraceFlags, TraceId, TraceState, @@ -122,7 +122,7 @@ impl Tracer { static EMPTY_ATTRIBUTES: Lazy> = Lazy::new(Default::default); -impl opentelemetry_api::trace::Tracer for Tracer { +impl opentelemetry::trace::Tracer for Tracer { /// This implementation of `Tracer` produces `sdk::Span` instances. type Span = Span; @@ -220,7 +220,7 @@ impl opentelemetry_api::trace::Tracer for Tracer { } links.append_vec(link_options); } - let start_time = start_time.unwrap_or_else(opentelemetry_api::time::now); + let start_time = start_time.unwrap_or_else(opentelemetry::time::now); let end_time = end_time.unwrap_or(start_time); let mut events_queue = EvictedQueue::new(span_limits.max_events_per_span); if let Some(mut events) = events { @@ -279,7 +279,7 @@ mod tests { testing::trace::TestSpan, trace::{Config, Sampler, ShouldSample}, }; - use opentelemetry_api::{ + use opentelemetry::{ trace::{ Link, SamplingDecision, SamplingResult, Span, SpanContext, SpanId, SpanKind, TraceContextExt, TraceFlags, TraceId, TraceState, Tracer, TracerProvider, diff --git a/opentelemetry/src/lib.rs b/opentelemetry/src/lib.rs index a4e17c8c5e..33ae45f889 100644 --- a/opentelemetry/src/lib.rs +++ b/opentelemetry/src/lib.rs @@ -227,4 +227,4 @@ )] #![cfg_attr(test, deny(warnings))] -pub use opentelemetry_api::*; +pub use opentelemetry::*; diff --git a/stress/Cargo.toml b/stress/Cargo.toml index eb8e8c9090..ff300f5e6a 100644 --- a/stress/Cargo.toml +++ b/stress/Cargo.toml @@ -18,7 +18,7 @@ doc = false ctrlc = "3.2.5" lazy_static = "1.4.0" num_cpus = "1.15.0" -opentelemetry_api = { path = "../opentelemetry-api", features = ["metrics", "logs"] } +opentelemetry = { path = "../opentelemetry", features = ["metrics", "logs"] } opentelemetry_sdk = { path = "../opentelemetry-sdk", features = ["metrics", "logs"] } opentelemetry-appender-tracing = { path = "../opentelemetry-appender-tracing"} opentelemetry-stdout = { path = "../opentelemetry-stdout", features = ["logs"]} diff --git a/stress/src/logs.rs b/stress/src/logs.rs index 7ef94bb670..6c64c0fb81 100644 --- a/stress/src/logs.rs +++ b/stress/src/logs.rs @@ -1,4 +1,4 @@ -use opentelemetry_api::KeyValue; +use opentelemetry::KeyValue; use opentelemetry_appender_tracing::layer; use opentelemetry_sdk::{ logs::{Config, LogProcessor, LoggerProvider}, @@ -44,17 +44,17 @@ pub struct NoOpLogProcessor; impl LogProcessor for NoOpLogProcessor { fn emit(&self, _data: opentelemetry_sdk::export::logs::LogData) {} - fn force_flush(&self) -> opentelemetry_api::logs::LogResult<()> { + fn force_flush(&self) -> opentelemetry::logs::LogResult<()> { Ok(()) } - fn shutdown(&mut self) -> opentelemetry_api::logs::LogResult<()> { + fn shutdown(&mut self) -> opentelemetry::logs::LogResult<()> { Ok(()) } fn event_enabled( &self, - _level: opentelemetry_api::logs::Severity, + _level: opentelemetry::logs::Severity, _target: &str, _name: &str, ) -> bool { diff --git a/stress/src/metrics.rs b/stress/src/metrics.rs index 8ccf31e86b..3072b6cff2 100644 --- a/stress/src/metrics.rs +++ b/stress/src/metrics.rs @@ -1,5 +1,5 @@ use lazy_static::lazy_static; -use opentelemetry_api::{ +use opentelemetry::{ metrics::{Counter, MeterProvider as _}, KeyValue, };