Skip to content

Commit c88fc95

Browse files
committed
Print histogram bucket info in stdout exporter
1 parent 18834f5 commit c88fc95

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

opentelemetry-stdout/src/metrics/exporter.rs

+14
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,20 @@ fn print_hist_data_points<T: Debug>(data_points: &[HistogramDataPoint<T>]) {
234234
for kv in data_point.attributes.iter() {
235235
println!("\t\t\t\t -> {}: {}", kv.key, kv.value.as_str());
236236
}
237+
238+
println!("\t\t\tBuckets");
239+
let mut lower_bound = f64::NEG_INFINITY;
240+
for (i, &upper_bound) in data_point.bounds.iter().enumerate() {
241+
let count = data_point.bucket_counts.get(i).unwrap_or(&0);
242+
println!("\t\t\t\t {} to {} : {}", lower_bound, upper_bound, count);
243+
lower_bound = upper_bound;
244+
}
245+
246+
let last_count = data_point
247+
.bucket_counts
248+
.get(data_point.bounds.len())
249+
.unwrap_or(&0);
250+
println!("\t\t\t\t{} to +Infinity : {}", lower_bound, last_count);
237251
}
238252
}
239253

0 commit comments

Comments
 (0)