Skip to content

Commit d48133f

Browse files
committed
metrics-sdk-error
1 parent ea4b5e4 commit d48133f

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

opentelemetry-sdk/src/metrics/internal/exponential_histogram.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{collections::HashMap, f64::consts::LOG2_E, sync::Mutex, time::SystemTime};
22

33
use once_cell::sync::Lazy;
4-
use opentelemetry::{metrics::MetricsError, KeyValue};
4+
use opentelemetry::{otel_debug, KeyValue};
55

66
use crate::{
77
metrics::data::{self, Aggregation, Temporality},
@@ -100,9 +100,20 @@ impl<T: Number> ExpoHistogramDataPoint<T> {
100100
if (self.scale - scale_delta as i8) < EXPO_MIN_SCALE {
101101
// With a scale of -10 there is only two buckets for the whole range of f64 values.
102102
// This can only happen if there is a max size of 1.
103-
opentelemetry::global::handle_error(MetricsError::Other(
104-
"exponential histogram scale underflow".into(),
105-
));
103+
104+
// TODO - to check if this should be logged as an error if this is auto-recoverable.
105+
otel_debug!(
106+
name: "ExponentialHistogramDataPoint.Scale.Underflow",
107+
current_scale = self.scale,
108+
scale_delta = scale_delta,
109+
max_size = self.max_size,
110+
min_scale = EXPO_MIN_SCALE,
111+
record_min_max = self.record_min_max,
112+
record_sum = self.record_sum,
113+
value = format!("{:?}", v),
114+
error = "The measurement will be dropped due to scale underflow. Check the histogram configuration"
115+
);
116+
106117
return;
107118
}
108119
// Downscale

0 commit comments

Comments
 (0)