Skip to content

Commit a767fd3

Browse files
author
Luca Palmieri
authored
Allow O(1) get operations for SpanBuilder::attributes [breaking] (#799)
* Use index_map::IndexMap instead of Vec<KeyValue> to store SpanBuilder's attributes. * Test suite compiles. * Rustfmt * Wrap IndexMap to expose only the methods that are insertion-order preserving. * Raise MSRV to 1.51 to get support for const generics. * Fix doctest. * Fix lint. * Add specialised implementations to make it easier to work with KeyValue iterators/collections. * Bump MSRV to get access to array::map. * Minimise breakages for existing users. * Fix invocation. * Rustfmt
1 parent 7534891 commit a767fd3

File tree

8 files changed

+714
-23
lines changed

8 files changed

+714
-23
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
- uses: actions-rs/toolchain@v1
6969
with:
7070
profile: minimal
71-
toolchain: 1.49.0
71+
toolchain: 1.55.0
7272
override: true
7373
- name: Run tests
7474
run: cargo --version &&

opentelemetry-api/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ lazy_static = "1.4"
1111
pin-project = { version = "1.0.2", optional = true }
1212
thiserror = "1"
1313
tokio-stream = { version = "0.1", optional = true }
14+
indexmap = "1"
1415

1516
[package.metadata.docs.rs]
1617
all-features = true

opentelemetry-api/src/trace/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,15 @@ use thiserror::Error;
168168

169169
mod context;
170170
pub mod noop;
171+
mod order_map;
171172
mod span;
172173
mod span_context;
173174
mod tracer;
174175
mod tracer_provider;
175176

176177
pub use self::{
177178
context::{get_active_span, mark_span_as_active, FutureExt, SpanRef, TraceContextExt},
179+
order_map::OrderMap,
178180
span::{Span, SpanKind, Status},
179181
span_context::{SpanContext, SpanId, TraceFlags, TraceId, TraceState},
180182
tracer::{SamplingDecision, SamplingResult, SpanBuilder, Tracer},

0 commit comments

Comments
 (0)