Skip to content

Commit 5d52509

Browse files
committed
refactor: mark trace::Config methods as deprecated
Moving away from trace::Config
1 parent 3ac2d9f commit 5d52509

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

opentelemetry-sdk/src/trace/config.rs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,54 +34,90 @@ pub struct Config {
3434

3535
impl Config {
3636
/// 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+
)]
3741
pub fn with_sampler<T: crate::trace::ShouldSample + 'static>(mut self, sampler: T) -> Self {
3842
self.sampler = Box::new(sampler);
3943
self
4044
}
4145

4246
/// 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+
)]
4351
pub fn with_id_generator<T: IdGenerator + 'static>(mut self, id_generator: T) -> Self {
4452
self.id_generator = Box::new(id_generator);
4553
self
4654
}
4755

4856
/// Specify the number of events to be recorded per span.
57+
#[deprecated(
58+
since = "0.27.1",
59+
note = "Config is becoming private. Please use Builder::with_sampler(...) instead."
60+
)]
4961
pub fn with_max_events_per_span(mut self, max_events: u32) -> Self {
5062
self.span_limits.max_events_per_span = max_events;
5163
self
5264
}
5365

5466
/// Specify the number of attributes to be recorded per span.
67+
#[deprecated(
68+
since = "0.27.1",
69+
note = "Config is becoming private. Please use Builder::with_sampler(...) instead."
70+
)]
5571
pub fn with_max_attributes_per_span(mut self, max_attributes: u32) -> Self {
5672
self.span_limits.max_attributes_per_span = max_attributes;
5773
self
5874
}
5975

6076
/// Specify the number of events to be recorded per span.
77+
#[deprecated(
78+
since = "0.27.1",
79+
note = "Config is becoming private. Please use Builder::with_sampler(...) instead."
80+
)]
6181
pub fn with_max_links_per_span(mut self, max_links: u32) -> Self {
6282
self.span_limits.max_links_per_span = max_links;
6383
self
6484
}
6585

6686
/// Specify the number of attributes one event can have.
87+
#[deprecated(
88+
since = "0.27.1",
89+
note = "Config is becoming private. Please use Builder::with_sampler(...) instead."
90+
)]
6791
pub fn with_max_attributes_per_event(mut self, max_attributes: u32) -> Self {
6892
self.span_limits.max_attributes_per_event = max_attributes;
6993
self
7094
}
7195

7296
/// Specify the number of attributes one link can have.
97+
#[deprecated(
98+
since = "0.27.1",
99+
note = "Config is becoming private. Please use Builder::with_sampler(...) instead."
100+
)]
73101
pub fn with_max_attributes_per_link(mut self, max_attributes: u32) -> Self {
74102
self.span_limits.max_attributes_per_link = max_attributes;
75103
self
76104
}
77105

78106
/// Specify all limit via the span_limits
107+
#[deprecated(
108+
since = "0.27.1",
109+
note = "Config is becoming private. Please use Builder::with_sampler(...) instead."
110+
)]
79111
pub fn with_span_limits(mut self, span_limits: SpanLimits) -> Self {
80112
self.span_limits = span_limits;
81113
self
82114
}
83115

84116
/// 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_sampler(...) instead."
120+
)]
85121
pub fn with_resource(mut self, resource: Resource) -> Self {
86122
self.resource = Cow::Owned(resource);
87123
self

opentelemetry-sdk/src/trace/provider.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,10 @@ impl Builder {
308308
}
309309

310310
/// The sdk [`crate::trace::Config`] that this provider will use.
311+
#[deprecated(
312+
since = "0.27.1",
313+
note = "Config is becoming a private type. Use Builder::with_{config_name}(resource) instead. ex: Builder::with_resource(resource)"
314+
)]
311315
pub fn with_config(self, config: crate::trace::Config) -> Self {
312316
Builder { config, ..self }
313317
}

0 commit comments

Comments
 (0)