Skip to content

Commit

Permalink
remove i64_histogram support (#99)
Browse files Browse the repository at this point in the history
rust-opentelemetry has dropped this, as it is
recommended against by the otel spec.
  • Loading branch information
rbtcollins authored Feb 27, 2024
1 parent 4f747a0 commit 6cdd4d7
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 61 deletions.
13 changes: 0 additions & 13 deletions src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ pub(crate) struct Instruments {
i64_up_down_counter: MetricsMap<UpDownCounter<i64>>,
f64_up_down_counter: MetricsMap<UpDownCounter<f64>>,
u64_histogram: MetricsMap<Histogram<u64>>,
i64_histogram: MetricsMap<Histogram<i64>>,
f64_histogram: MetricsMap<Histogram<f64>>,
}

Expand All @@ -43,7 +42,6 @@ pub(crate) enum InstrumentType {
UpDownCounterI64(i64),
UpDownCounterF64(f64),
HistogramU64(u64),
HistogramI64(i64),
HistogramF64(f64),
}

Expand Down Expand Up @@ -119,14 +117,6 @@ impl Instruments {
|rec| rec.record(value, attributes),
);
}
InstrumentType::HistogramI64(value) => {
update_or_insert(
&self.i64_histogram,
metric_name,
|| meter.i64_histogram(metric_name).init(),
|rec| rec.record(value, attributes),
);
}
InstrumentType::HistogramF64(value) => {
update_or_insert(
&self.f64_histogram,
Expand Down Expand Up @@ -198,9 +188,6 @@ impl<'a> Visit for MetricVisitor<'a> {
} else if let Some(metric_name) = field.name().strip_prefix(METRIC_PREFIX_COUNTER) {
self.visited_metrics
.push((metric_name, InstrumentType::UpDownCounterI64(value)));
} else if let Some(metric_name) = field.name().strip_prefix(METRIC_PREFIX_HISTOGRAM) {
self.visited_metrics
.push((metric_name, InstrumentType::HistogramI64(value)));
} else {
self.attributes.push(KeyValue::new(field.name(), value));
}
Expand Down
48 changes: 0 additions & 48 deletions tests/metrics_publishing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,22 +132,6 @@ async fn u64_histogram_is_exported() {
exporter.export().unwrap();
}

#[tokio::test]
async fn i64_histogram_is_exported() {
let (subscriber, exporter) = init_subscriber(
"abcdefg_auenatsou".to_string(),
InstrumentKind::Histogram,
-19_i64,
None,
);

tracing::subscriber::with_default(subscriber, || {
tracing::info!(histogram.abcdefg_auenatsou = -19_i64);
});

exporter.export().unwrap();
}

#[tokio::test]
async fn f64_histogram_is_exported() {
let (subscriber, exporter) = init_subscriber(
Expand Down Expand Up @@ -324,38 +308,6 @@ async fn u64_histogram_with_attributes_is_exported() {
exporter.export().unwrap();
}

#[tokio::test]
async fn i64_histogram_with_attributes_is_exported() {
let (subscriber, exporter) = init_subscriber(
"hello_world".to_string(),
InstrumentKind::Histogram,
-1_i64,
Some(AttributeSet::from(
[
KeyValue::new("u64_key_1", 1_i64),
KeyValue::new("i64_key_1", 2_i64),
KeyValue::new("f64_key_1", 3_f64),
KeyValue::new("str_key_1", "foo"),
KeyValue::new("bool_key_1", true),
]
.as_slice(),
)),
);

tracing::subscriber::with_default(subscriber, || {
tracing::info!(
histogram.hello_world = -1_i64,
u64_key_1 = 1_u64,
i64_key_1 = 2_i64,
f64_key_1 = 3_f64,
str_key_1 = "foo",
bool_key_1 = true,
);
});

exporter.export().unwrap();
}

#[tokio::test]
async fn f64_histogram_with_attributes_is_exported() {
let (subscriber, exporter) = init_subscriber(
Expand Down

0 comments on commit 6cdd4d7

Please sign in to comment.