File tree Expand file tree Collapse file tree 7 files changed +25
-2
lines changed
examples/metrics-advanced Expand file tree Collapse file tree 7 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ publish = false
7
7
8
8
[dependencies ]
9
9
opentelemetry = { path = " ../../opentelemetry" , features = [" metrics" ] }
10
- opentelemetry_sdk = { path = " ../../opentelemetry-sdk" , features = [" metrics " , " rt-tokio" ] }
10
+ opentelemetry_sdk = { path = " ../../opentelemetry-sdk" , features = [" spec_unstable_metrics_views " , " rt-tokio" ] }
11
11
opentelemetry-stdout = { path = " ../../opentelemetry-stdout" , features = [" metrics" ] }
12
12
tokio = { workspace = true , features = [" full" ] }
13
13
serde_json = { workspace = true }
Original file line number Diff line number Diff line change 49
49
50
50
- * * BREAKING ** : `Temporality ` enum moved from `opentelemetry_sdk :: metrics :: data :: Temporality ` to `opentelemetry_sdk :: metrics :: Temporality `.
51
51
52
+ - * * BREAKING ** : `Views ` are now an opt- in ONLY feature. Please include the feature `spec_unstable_metrics_views` to enable `Views `. It will be stabilized post 1. 0 stable release of the SDK . [#2295](https: // github.com/open-telemetry/opentelemetry-rust/issues/2295)
53
+
52
54
- Added a new `PeriodicReader ` implementation (`PeriodicReaderWithOwnThread `)
53
55
that does not rely on an async runtime, and instead creates own Thread . This
54
56
is under feature flag "experimental_metrics_periodic_reader_no_runtime". The
Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ rt-tokio-current-thread = ["tokio", "tokio-stream"]
54
54
rt-async-std = [" async-std" ]
55
55
internal-logs = [" tracing" ]
56
56
experimental_metrics_periodic_reader_no_runtime = [" metrics" ]
57
+ spec_unstable_metrics_views = [" metrics" ]
57
58
58
59
[[bench ]]
59
60
name = " context"
Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ impl InstrumentKind {
83
83
/// ```
84
84
#[ derive( Clone , Default , Debug , PartialEq ) ]
85
85
#[ non_exhaustive]
86
+ #[ allow( unreachable_pub) ]
86
87
pub struct Instrument {
87
88
/// The human-readable identifier of the instrument.
88
89
pub name : Cow < ' static , str > ,
@@ -96,6 +97,7 @@ pub struct Instrument {
96
97
pub scope : InstrumentationScope ,
97
98
}
98
99
100
+ #[ cfg( feature = "spec_unstable_metrics_views" ) ]
99
101
impl Instrument {
100
102
/// Create a new instrument with default values
101
103
pub fn new ( ) -> Self {
@@ -185,6 +187,7 @@ impl Instrument {
185
187
/// ```
186
188
#[ derive( Default , Debug ) ]
187
189
#[ non_exhaustive]
190
+ #[ allow( unreachable_pub) ]
188
191
pub struct Stream {
189
192
/// The human-readable identifier of the stream.
190
193
pub name : Cow < ' static , str > ,
@@ -202,6 +205,7 @@ pub struct Stream {
202
205
pub allowed_attribute_keys : Option < Arc < HashSet < Key > > > ,
203
206
}
204
207
208
+ #[ cfg( feature = "spec_unstable_metrics_views" ) ]
205
209
impl Stream {
206
210
/// Create a new stream with empty values.
207
211
pub fn new ( ) -> Self {
Original file line number Diff line number Diff line change @@ -215,6 +215,7 @@ impl MeterProviderBuilder {
215
215
self
216
216
}
217
217
218
+ #[ cfg( feature = "spec_unstable_metrics_views" ) ]
218
219
/// Associates a [View] with a [MeterProvider].
219
220
///
220
221
/// [View]s are appended to existing ones in a [MeterProvider] if this option is
Original file line number Diff line number Diff line change @@ -58,14 +58,24 @@ pub(crate) mod view;
58
58
59
59
pub use aggregation:: * ;
60
60
pub use error:: { MetricError , MetricResult } ;
61
- pub use instrument:: * ;
62
61
pub use manual_reader:: * ;
63
62
pub use meter_provider:: * ;
64
63
pub use periodic_reader:: * ;
65
64
#[ cfg( feature = "experimental_metrics_periodic_reader_no_runtime" ) ]
66
65
pub use periodic_reader_with_own_thread:: * ;
67
66
pub use pipeline:: Pipeline ;
67
+
68
+ pub use instrument:: InstrumentKind ;
69
+
70
+ #[ cfg( feature = "spec_unstable_metrics_views" ) ]
71
+ pub use instrument:: * ;
72
+ // #[cfg(not(feature = "spec_unstable_metrics_views"))]
73
+ // pub(crate) use instrument::*;
74
+
75
+ #[ cfg( feature = "spec_unstable_metrics_views" ) ]
68
76
pub use view:: * ;
77
+ // #[cfg(not(feature = "spec_unstable_metrics_views"))]
78
+ // pub(crate) use view::*;
69
79
70
80
use std:: collections:: hash_map:: DefaultHasher ;
71
81
use std:: collections:: HashSet ;
Original file line number Diff line number Diff line change 1
1
use super :: instrument:: { Instrument , Stream } ;
2
+ #[ cfg( feature = "spec_unstable_metrics_views" ) ]
2
3
use crate :: metrics:: { MetricError , MetricResult } ;
4
+ #[ cfg( feature = "spec_unstable_metrics_views" ) ]
3
5
use glob:: Pattern ;
4
6
7
+ #[ cfg( feature = "spec_unstable_metrics_views" ) ]
5
8
fn empty_view ( _inst : & Instrument ) -> Option < Stream > {
6
9
None
7
10
}
@@ -42,6 +45,7 @@ fn empty_view(_inst: &Instrument) -> Option<Stream> {
42
45
/// let provider = SdkMeterProvider::builder().with_view(my_view).build();
43
46
/// # drop(provider)
44
47
/// ```
48
+ #[ allow( unreachable_pub) ]
45
49
pub trait View : Send + Sync + ' static {
46
50
/// Defines how data should be collected for certain instruments.
47
51
///
@@ -65,6 +69,7 @@ impl View for Box<dyn View> {
65
69
}
66
70
}
67
71
72
+ #[ cfg( feature = "spec_unstable_metrics_views" ) ]
68
73
/// Creates a [View] that applies the [Stream] mask for all instruments that
69
74
/// match criteria.
70
75
///
You can’t perform that action at this time.
0 commit comments