Skip to content

Commit e48e6f4

Browse files
authored
chore: remove deprecated functions/methods in trace::Config (#2810)
1 parent e5f8a48 commit e48e6f4

File tree

8 files changed

+11
-121
lines changed

8 files changed

+11
-121
lines changed

opentelemetry-otlp/src/lib.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,12 @@
153153
//!
154154
//! let tracer_provider = opentelemetry_sdk::trace::SdkTracerProvider::builder()
155155
//! .with_batch_exporter(exporter)
156-
//! .with_config(
157-
//! trace::Config::default()
158-
//! .with_sampler(Sampler::AlwaysOn)
159-
//! .with_id_generator(RandomIdGenerator::default())
160-
//! .with_max_events_per_span(64)
161-
//! .with_max_attributes_per_span(16)
162-
//! .with_max_events_per_span(16)
163-
//! .with_resource(Resource::builder_empty().with_attributes([KeyValue::new("service.name", "example")]).build()),
164-
//! ).build();
156+
//! .with_sampler(Sampler::AlwaysOn)
157+
//! .with_id_generator(RandomIdGenerator::default())
158+
//! .with_max_events_per_span(64)
159+
//! .with_max_attributes_per_span(16)
160+
//! .with_resource(Resource::builder_empty().with_attributes([KeyValue::new("service.name", "example")]).build())
161+
//! .build();
165162
//! global::set_tracer_provider(tracer_provider.clone());
166163
//! let tracer = global::tracer("tracer-name");
167164
//! # tracer

opentelemetry-sdk/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
- **Breaking** for custom `LogProcessor` authors: Changed `set_resource`
7575
to require mutable ref.
7676
`fn set_resource(&mut self, _resource: &Resource) {}`
77+
- **Breaking** Removed deprecated functions and methods related to `trace::Config`
7778

7879
## 0.28.0
7980

opentelemetry-sdk/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ pub mod runtime;
136136
#[cfg_attr(docsrs, doc(cfg(any(feature = "testing", test))))]
137137
pub mod testing;
138138

139-
#[allow(deprecated)]
140139
#[cfg(feature = "trace")]
141140
#[cfg_attr(docsrs, doc(cfg(feature = "trace")))]
142141
pub mod trace;

opentelemetry-sdk/src/trace/config.rs

Lines changed: 0 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ use std::borrow::Cow;
99
use std::env;
1010
use std::str::FromStr;
1111

12-
/// Default trace configuration
13-
#[deprecated(since = "0.23.0", note = "Use Config::default() instead")]
14-
pub fn config() -> Config {
15-
Config::default()
16-
}
17-
1812
/// Tracer configuration
1913
#[derive(Debug)]
2014
#[non_exhaustive]
@@ -32,98 +26,6 @@ pub struct Config {
3226
pub resource: Cow<'static, Resource>,
3327
}
3428

35-
impl Config {
36-
/// Specify the sampler to be used.
37-
#[deprecated(
38-
since = "0.27.1",
39-
note = "Config is becoming private. Please use Builder::with_sampler(...) instead."
40-
)]
41-
pub fn with_sampler<T: crate::trace::ShouldSample + 'static>(mut self, sampler: T) -> Self {
42-
self.sampler = Box::new(sampler);
43-
self
44-
}
45-
46-
/// Specify the id generator to be used.
47-
#[deprecated(
48-
since = "0.27.1",
49-
note = "Config is becoming private. Please use Builder::with_id_generator(...) instead."
50-
)]
51-
pub fn with_id_generator<T: IdGenerator + 'static>(mut self, id_generator: T) -> Self {
52-
self.id_generator = Box::new(id_generator);
53-
self
54-
}
55-
56-
/// Specify the maximum number of events that can be recorded per span.
57-
#[deprecated(
58-
since = "0.27.1",
59-
note = "Config is becoming private. Please use Builder::with_max_events_per_span(...) instead."
60-
)]
61-
pub fn with_max_events_per_span(mut self, max_events: u32) -> Self {
62-
self.span_limits.max_events_per_span = max_events;
63-
self
64-
}
65-
66-
/// Specify the maximum number of attributes that can be recorded per span.
67-
#[deprecated(
68-
since = "0.27.1",
69-
note = "Config is becoming private. Please use Builder::with_max_attributes_per_span(...) instead."
70-
)]
71-
pub fn with_max_attributes_per_span(mut self, max_attributes: u32) -> Self {
72-
self.span_limits.max_attributes_per_span = max_attributes;
73-
self
74-
}
75-
76-
/// Specify the maximum number of links that can be recorded per span.
77-
#[deprecated(
78-
since = "0.27.1",
79-
note = "Config is becoming private. Please use Builder::with_max_links_per_span(...) instead."
80-
)]
81-
pub fn with_max_links_per_span(mut self, max_links: u32) -> Self {
82-
self.span_limits.max_links_per_span = max_links;
83-
self
84-
}
85-
86-
/// Specify the maximum number of attributes one event can have.
87-
#[deprecated(
88-
since = "0.27.1",
89-
note = "Config is becoming private. Please use Builder::with_max_attributes_per_event(...) instead."
90-
)]
91-
pub fn with_max_attributes_per_event(mut self, max_attributes: u32) -> Self {
92-
self.span_limits.max_attributes_per_event = max_attributes;
93-
self
94-
}
95-
96-
/// Specify the maximum number of attributes one link can have.
97-
#[deprecated(
98-
since = "0.27.1",
99-
note = "Config is becoming private. Please use Builder::with_max_attributes_per_link(...) instead."
100-
)]
101-
pub fn with_max_attributes_per_link(mut self, max_attributes: u32) -> Self {
102-
self.span_limits.max_attributes_per_link = max_attributes;
103-
self
104-
}
105-
106-
/// Specify all limit via the span_limits
107-
#[deprecated(
108-
since = "0.27.1",
109-
note = "Config is becoming private. Please use Builder::with_span_limits(...) instead."
110-
)]
111-
pub fn with_span_limits(mut self, span_limits: SpanLimits) -> Self {
112-
self.span_limits = span_limits;
113-
self
114-
}
115-
116-
/// Specify the attributes representing the entity that produces telemetry
117-
#[deprecated(
118-
since = "0.27.1",
119-
note = "Config is becoming private. Please use Builder::with_resource(...) instead."
120-
)]
121-
pub fn with_resource(mut self, resource: Resource) -> Self {
122-
self.resource = Cow::Owned(resource);
123-
self
124-
}
125-
}
126-
12729
impl Default for Config {
12830
/// Create default global sdk configuration.
12931
fn default() -> Self {

opentelemetry-sdk/src/trace/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ mod span_processor;
2222
pub mod span_processor_with_async_runtime;
2323
mod tracer;
2424

25-
pub use config::{config, Config};
25+
pub use config::Config;
2626
pub use error::{TraceError, TraceResult};
2727
pub use events::SpanEvents;
2828
pub use export::{SpanData, SpanExporter};

opentelemetry-sdk/src/trace/provider.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -345,15 +345,6 @@ impl TracerProviderBuilder {
345345
TracerProviderBuilder { processors, ..self }
346346
}
347347

348-
/// The sdk [`crate::trace::Config`] that this provider will use.
349-
#[deprecated(
350-
since = "0.27.1",
351-
note = "Config is becoming a private type. Use Builder::with_{config_name}(resource) instead. ex: Builder::with_resource(resource)"
352-
)]
353-
pub fn with_config(self, config: crate::trace::Config) -> Self {
354-
TracerProviderBuilder { config, ..self }
355-
}
356-
357348
/// Specify the sampler to be used.
358349
pub fn with_sampler<T: crate::trace::ShouldSample + 'static>(mut self, sampler: T) -> Self {
359350
self.config.sampler = Box::new(sampler);
@@ -428,7 +419,7 @@ impl TracerProviderBuilder {
428419

429420
// Now, we can update the config with the resource.
430421
if let Some(resource) = self.resource {
431-
config = config.with_resource(resource);
422+
config.resource = Cow::Owned(resource);
432423
};
433424

434425
// Standard config will contain an owned [`Resource`] (either sdk default or use supplied)

opentelemetry-sdk/src/trace/sampler/jaeger_remote/sampler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl JaegerRemoteSampler {
234234
.unwrap();
235235

236236
let resp = client
237-
.send(request)
237+
.send_bytes(request)
238238
.await
239239
.map_err(|err| format!("the request is failed to send {}", err))?;
240240

opentelemetry-semantic-conventions/src/resource.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
//!
1616
//! ```rust
1717
//! use opentelemetry::KeyValue;
18-
//! use opentelemetry_sdk::{trace::{config, SdkTracerProvider}, Resource};
18+
//! use opentelemetry_sdk::{trace::SdkTracerProvider, Resource};
1919
//! use opentelemetry_semantic_conventions as semconv;
2020
//!
2121
//! let _tracer = SdkTracerProvider::builder()

0 commit comments

Comments
 (0)