Skip to content

Commit 6cdd4d7

Browse files
authored
remove i64_histogram support (#99)
rust-opentelemetry has dropped this, as it is recommended against by the otel spec.
1 parent 4f747a0 commit 6cdd4d7

File tree

2 files changed

+0
-61
lines changed

2 files changed

+0
-61
lines changed

src/metrics.rs

-13
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ pub(crate) struct Instruments {
3030
i64_up_down_counter: MetricsMap<UpDownCounter<i64>>,
3131
f64_up_down_counter: MetricsMap<UpDownCounter<f64>>,
3232
u64_histogram: MetricsMap<Histogram<u64>>,
33-
i64_histogram: MetricsMap<Histogram<i64>>,
3433
f64_histogram: MetricsMap<Histogram<f64>>,
3534
}
3635

@@ -43,7 +42,6 @@ pub(crate) enum InstrumentType {
4342
UpDownCounterI64(i64),
4443
UpDownCounterF64(f64),
4544
HistogramU64(u64),
46-
HistogramI64(i64),
4745
HistogramF64(f64),
4846
}
4947

@@ -119,14 +117,6 @@ impl Instruments {
119117
|rec| rec.record(value, attributes),
120118
);
121119
}
122-
InstrumentType::HistogramI64(value) => {
123-
update_or_insert(
124-
&self.i64_histogram,
125-
metric_name,
126-
|| meter.i64_histogram(metric_name).init(),
127-
|rec| rec.record(value, attributes),
128-
);
129-
}
130120
InstrumentType::HistogramF64(value) => {
131121
update_or_insert(
132122
&self.f64_histogram,
@@ -198,9 +188,6 @@ impl<'a> Visit for MetricVisitor<'a> {
198188
} else if let Some(metric_name) = field.name().strip_prefix(METRIC_PREFIX_COUNTER) {
199189
self.visited_metrics
200190
.push((metric_name, InstrumentType::UpDownCounterI64(value)));
201-
} else if let Some(metric_name) = field.name().strip_prefix(METRIC_PREFIX_HISTOGRAM) {
202-
self.visited_metrics
203-
.push((metric_name, InstrumentType::HistogramI64(value)));
204191
} else {
205192
self.attributes.push(KeyValue::new(field.name(), value));
206193
}

tests/metrics_publishing.rs

-48
Original file line numberDiff line numberDiff line change
@@ -132,22 +132,6 @@ async fn u64_histogram_is_exported() {
132132
exporter.export().unwrap();
133133
}
134134

135-
#[tokio::test]
136-
async fn i64_histogram_is_exported() {
137-
let (subscriber, exporter) = init_subscriber(
138-
"abcdefg_auenatsou".to_string(),
139-
InstrumentKind::Histogram,
140-
-19_i64,
141-
None,
142-
);
143-
144-
tracing::subscriber::with_default(subscriber, || {
145-
tracing::info!(histogram.abcdefg_auenatsou = -19_i64);
146-
});
147-
148-
exporter.export().unwrap();
149-
}
150-
151135
#[tokio::test]
152136
async fn f64_histogram_is_exported() {
153137
let (subscriber, exporter) = init_subscriber(
@@ -324,38 +308,6 @@ async fn u64_histogram_with_attributes_is_exported() {
324308
exporter.export().unwrap();
325309
}
326310

327-
#[tokio::test]
328-
async fn i64_histogram_with_attributes_is_exported() {
329-
let (subscriber, exporter) = init_subscriber(
330-
"hello_world".to_string(),
331-
InstrumentKind::Histogram,
332-
-1_i64,
333-
Some(AttributeSet::from(
334-
[
335-
KeyValue::new("u64_key_1", 1_i64),
336-
KeyValue::new("i64_key_1", 2_i64),
337-
KeyValue::new("f64_key_1", 3_f64),
338-
KeyValue::new("str_key_1", "foo"),
339-
KeyValue::new("bool_key_1", true),
340-
]
341-
.as_slice(),
342-
)),
343-
);
344-
345-
tracing::subscriber::with_default(subscriber, || {
346-
tracing::info!(
347-
histogram.hello_world = -1_i64,
348-
u64_key_1 = 1_u64,
349-
i64_key_1 = 2_i64,
350-
f64_key_1 = 3_f64,
351-
str_key_1 = "foo",
352-
bool_key_1 = true,
353-
);
354-
});
355-
356-
exporter.export().unwrap();
357-
}
358-
359311
#[tokio::test]
360312
async fn f64_histogram_with_attributes_is_exported() {
361313
let (subscriber, exporter) = init_subscriber(

0 commit comments

Comments
 (0)