Skip to content

Commit a18853e

Browse files
lalitbTommyCppcijothomas
authored
Global error handler cleanup - exponential histogram (#2235)
Co-authored-by: Zhongyang Wu <[email protected]> Co-authored-by: Cijo Thomas <[email protected]>
1 parent d3b1c47 commit a18853e

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

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

Lines changed: 13 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,18 @@ 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+
value = format!("{:?}", v),
112+
message = "The measurement will be dropped due to scale underflow. Check the histogram configuration"
113+
);
114+
106115
return;
107116
}
108117
// Downscale

0 commit comments

Comments
 (0)