diff --git a/opentelemetry-sdk/Cargo.toml b/opentelemetry-sdk/Cargo.toml index a755a75734..ec7c73be5b 100644 --- a/opentelemetry-sdk/Cargo.toml +++ b/opentelemetry-sdk/Cargo.toml @@ -21,7 +21,7 @@ futures-util = { version = "0.3.17", default-features = false, features = ["std" once_cell = "1.10" ordered-float = "4.0" percent-encoding = { version = "2.0", optional = true } -rand = { version = "0.8", default-features = false, features = ["std", "std_rng"], optional = true } +rand = { version = "0.8", default-features = false, features = ["std", "std_rng","small_rng"], optional = true } glob = {version = "0.3.1", optional =true} serde = { version = "1.0", features = ["derive", "rc"], optional = true } serde_json = { version = "1", optional = true } @@ -68,6 +68,7 @@ harness = false [[bench]] name = "trace" harness = false +required-features = ["testing"] [[bench]] name = "batch_span_processor" diff --git a/opentelemetry-sdk/src/trace/id_generator/mod.rs b/opentelemetry-sdk/src/trace/id_generator/mod.rs index b0c73e6a1c..27cea4cb19 100644 --- a/opentelemetry-sdk/src/trace/id_generator/mod.rs +++ b/opentelemetry-sdk/src/trace/id_generator/mod.rs @@ -2,7 +2,7 @@ pub(super) mod aws; use opentelemetry::trace::{SpanId, TraceId}; -use rand::{rngs, Rng}; +use rand::{rngs, Rng, SeedableRng}; use std::cell::RefCell; use std::fmt; @@ -35,5 +35,5 @@ impl IdGenerator for RandomIdGenerator { thread_local! { /// Store random number generator for each thread - static CURRENT_RNG: RefCell = RefCell::new(rngs::ThreadRng::default()); + static CURRENT_RNG: RefCell = RefCell::new(rngs::SmallRng::from_entropy()); }