@@ -2,10 +2,8 @@ use std::{collections::HashMap, fmt, sync::RwLock};
2
2
use tracing:: { field:: Visit , Subscriber } ;
3
3
use tracing_core:: { Field , Interest , Metadata } ;
4
4
5
- #[ cfg( feature = "metrics_gauge_unstable" ) ]
6
- use opentelemetry:: metrics:: Gauge ;
7
5
use opentelemetry:: {
8
- metrics:: { Counter , Histogram , Meter , MeterProvider , UpDownCounter } ,
6
+ metrics:: { Counter , Gauge , Histogram , Meter , MeterProvider , UpDownCounter } ,
9
7
InstrumentationScope , KeyValue , Value ,
10
8
} ;
11
9
use tracing_subscriber:: {
@@ -23,7 +21,6 @@ const INSTRUMENTATION_LIBRARY_NAME: &str = "tracing/tracing-opentelemetry";
23
21
const METRIC_PREFIX_MONOTONIC_COUNTER : & str = "monotonic_counter." ;
24
22
const METRIC_PREFIX_COUNTER : & str = "counter." ;
25
23
const METRIC_PREFIX_HISTOGRAM : & str = "histogram." ;
26
- #[ cfg( feature = "metrics_gauge_unstable" ) ]
27
24
const METRIC_PREFIX_GAUGE : & str = "gauge." ;
28
25
29
26
const I64_MAX : u64 = i64:: MAX as u64 ;
@@ -36,11 +33,8 @@ pub(crate) struct Instruments {
36
33
f64_up_down_counter : MetricsMap < UpDownCounter < f64 > > ,
37
34
u64_histogram : MetricsMap < Histogram < u64 > > ,
38
35
f64_histogram : MetricsMap < Histogram < f64 > > ,
39
- #[ cfg( feature = "metrics_gauge_unstable" ) ]
40
36
u64_gauge : MetricsMap < Gauge < u64 > > ,
41
- #[ cfg( feature = "metrics_gauge_unstable" ) ]
42
37
i64_gauge : MetricsMap < Gauge < i64 > > ,
43
- #[ cfg( feature = "metrics_gauge_unstable" ) ]
44
38
f64_gauge : MetricsMap < Gauge < f64 > > ,
45
39
}
46
40
@@ -54,11 +48,8 @@ pub(crate) enum InstrumentType {
54
48
UpDownCounterF64 ( f64 ) ,
55
49
HistogramU64 ( u64 ) ,
56
50
HistogramF64 ( f64 ) ,
57
- #[ cfg( feature = "metrics_gauge_unstable" ) ]
58
51
GaugeU64 ( u64 ) ,
59
- #[ cfg( feature = "metrics_gauge_unstable" ) ]
60
52
GaugeI64 ( i64 ) ,
61
- #[ cfg( feature = "metrics_gauge_unstable" ) ]
62
53
GaugeF64 ( f64 ) ,
63
54
}
64
55
@@ -142,7 +133,6 @@ impl Instruments {
142
133
|rec| rec. record ( value, attributes) ,
143
134
) ;
144
135
}
145
- #[ cfg( feature = "metrics_gauge_unstable" ) ]
146
136
InstrumentType :: GaugeU64 ( value) => {
147
137
update_or_insert (
148
138
& self . u64_gauge ,
@@ -151,7 +141,6 @@ impl Instruments {
151
141
|rec| rec. record ( value, attributes) ,
152
142
) ;
153
143
}
154
- #[ cfg( feature = "metrics_gauge_unstable" ) ]
155
144
InstrumentType :: GaugeI64 ( value) => {
156
145
update_or_insert (
157
146
& self . i64_gauge ,
@@ -160,7 +149,6 @@ impl Instruments {
160
149
|rec| rec. record ( value, attributes) ,
161
150
) ;
162
151
}
163
- #[ cfg( feature = "metrics_gauge_unstable" ) ]
164
152
InstrumentType :: GaugeF64 ( value) => {
165
153
update_or_insert (
166
154
& self . f64_gauge ,
@@ -185,7 +173,6 @@ impl Visit for MetricVisitor<'_> {
185
173
}
186
174
187
175
fn record_u64 ( & mut self , field : & Field , value : u64 ) {
188
- #[ cfg( feature = "metrics_gauge_unstable" ) ]
189
176
if let Some ( metric_name) = field. name ( ) . strip_prefix ( METRIC_PREFIX_GAUGE ) {
190
177
self . visited_metrics
191
178
. push ( ( metric_name, InstrumentType :: GaugeU64 ( value) ) ) ;
@@ -216,7 +203,6 @@ impl Visit for MetricVisitor<'_> {
216
203
}
217
204
218
205
fn record_f64 ( & mut self , field : & Field , value : f64 ) {
219
- #[ cfg( feature = "metrics_gauge_unstable" ) ]
220
206
if let Some ( metric_name) = field. name ( ) . strip_prefix ( METRIC_PREFIX_GAUGE ) {
221
207
self . visited_metrics
222
208
. push ( ( metric_name, InstrumentType :: GaugeF64 ( value) ) ) ;
@@ -238,7 +224,6 @@ impl Visit for MetricVisitor<'_> {
238
224
}
239
225
240
226
fn record_i64 ( & mut self , field : & Field , value : i64 ) {
241
- #[ cfg( feature = "metrics_gauge_unstable" ) ]
242
227
if let Some ( metric_name) = field. name ( ) . strip_prefix ( METRIC_PREFIX_GAUGE ) {
243
228
self . visited_metrics
244
229
. push ( ( metric_name, InstrumentType :: GaugeI64 ( value) ) ) ;
@@ -427,7 +412,6 @@ impl MetricsFilter {
427
412
return true ;
428
413
}
429
414
430
- #[ cfg( feature = "metrics_gauge_unstable" ) ]
431
415
if name. starts_with ( METRIC_PREFIX_GAUGE ) {
432
416
return true ;
433
417
}
0 commit comments