Skip to content

Commit

Permalink
Move OrderMap module to root of otel-api crate (#1061)
Browse files Browse the repository at this point in the history
* more OrderMap to root of the otel-api crate

* missed file..

* fix lint

* re export OrderMap

* update changelog

* reorg use
  • Loading branch information
lalitb authored May 16, 2023
1 parent bdb777b commit 69fd972
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 12 deletions.
1 change: 1 addition & 0 deletions opentelemetry-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixed

- Fix `SpanRef::set_attributes` mutability requirement. [#1038](https://github.com/open-telemetry/opentelemetry-rust/pull/1038)
- Move OrderMap module to root of otel-api crate. [#1061](https://github.com/open-telemetry/opentelemetry-rust/pull/1061)

## v0.19.0
### Added
Expand Down
4 changes: 4 additions & 0 deletions opentelemetry-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ pub use context::{Context, ContextGuard};

mod common;

mod order_map;

pub use order_map::OrderMap;

#[cfg(any(feature = "testing", test))]
#[doc(hidden)]
pub mod testing;
Expand Down
File renamed without changes.
6 changes: 4 additions & 2 deletions opentelemetry-api/src/trace/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ use thiserror::Error;

mod context;
pub mod noop;
mod order_map;
mod span;
mod span_context;
mod tracer;
Expand All @@ -179,13 +178,16 @@ pub use self::{
context::{
get_active_span, mark_span_as_active, FutureExt, SpanRef, TraceContextExt, WithContext,
},
order_map::OrderMap,
span::{Span, SpanKind, Status},
span_context::{SpanContext, SpanId, TraceFlags, TraceId, TraceState},
tracer::{SamplingDecision, SamplingResult, SpanBuilder, Tracer},
tracer_provider::TracerProvider,
};
use crate::{ExportError, KeyValue};
use std::collections::hash_map::RandomState;

/// re-export OrderMap to mitigate breaking change
pub type OrderMap<K, V, S = RandomState> = crate::order_map::OrderMap<K, V, S>;

/// Describe the result of operations in tracing API.
pub type TraceResult<T> = Result<T, TraceError>;
Expand Down
3 changes: 1 addition & 2 deletions opentelemetry-api/src/trace/tracer.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::trace::OrderMap;
use crate::{
trace::{Event, Link, Span, SpanId, SpanKind, Status, TraceContextExt, TraceId, TraceState},
Context, Key, KeyValue, Value,
Context, Key, KeyValue, OrderMap, Value,
};
use std::borrow::Cow;
use std::iter::FromIterator;
Expand Down
3 changes: 1 addition & 2 deletions opentelemetry-sdk/src/trace/sampler.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use opentelemetry_api::trace::OrderMap;
use opentelemetry_api::{
trace::{
Link, SamplingDecision, SamplingResult, SpanKind, TraceContextExt, TraceId, TraceState,
},
Context, Key, Value,
Context, Key, OrderMap, Value,
};
use std::convert::TryInto;

Expand Down
4 changes: 2 additions & 2 deletions opentelemetry-sdk/src/trace/sampler/jaeger_remote/sampler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use crate::trace::sampler::jaeger_remote::sampling_strategy::Inner;
use crate::trace::{Sampler, ShouldSample, TraceRuntime};
use futures_util::{stream, StreamExt as _};
use http::Uri;
use opentelemetry_api::trace::{Link, OrderMap, SamplingResult, SpanKind, TraceError, TraceId};
use opentelemetry_api::{global, Context, Key, Value};
use opentelemetry_api::trace::{Link, SamplingResult, SpanKind, TraceError, TraceId};
use opentelemetry_api::{global, Context, Key, OrderMap, Value};
use opentelemetry_http::HttpClient;
use std::str::FromStr;
use std::sync::Arc;
Expand Down
8 changes: 4 additions & 4 deletions opentelemetry-sdk/src/trace/tracer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ use crate::{
InstrumentationLibrary,
};
use opentelemetry_api::trace::{
Link, OrderMap, SamplingDecision, SamplingResult, SpanBuilder, SpanContext, SpanId, SpanKind,
Link, SamplingDecision, SamplingResult, SpanBuilder, SpanContext, SpanId, SpanKind,
TraceContextExt, TraceFlags, TraceId, TraceState,
};
use opentelemetry_api::{Context, Key, KeyValue, Value};
use opentelemetry_api::{Context, Key, KeyValue, OrderMap, Value};
use std::fmt;
use std::sync::Weak;

Expand Down Expand Up @@ -276,10 +276,10 @@ mod tests {
};
use opentelemetry_api::{
trace::{
Link, OrderMap, SamplingDecision, SamplingResult, Span, SpanContext, SpanId, SpanKind,
Link, SamplingDecision, SamplingResult, Span, SpanContext, SpanId, SpanKind,
TraceContextExt, TraceFlags, TraceId, TraceState, Tracer, TracerProvider,
},
Context, Key, Value,
Context, Key, OrderMap, Value,
};

#[derive(Clone, Debug)]
Expand Down

0 comments on commit 69fd972

Please sign in to comment.