Skip to content

Commit 45708ab

Browse files
committed
use iterator
1 parent 5a9ece3 commit 45708ab

File tree

2 files changed

+5
-5
lines changed
  • opentelemetry-proto/src/transform
  • opentelemetry-sdk/src/metrics/data

2 files changed

+5
-5
lines changed

opentelemetry-proto/src/transform/metrics.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,11 @@ pub mod tonic {
250250
zero_count: dp.zero_count(),
251251
positive: Some(TonicBuckets {
252252
offset: dp.positive_bucket().offset(),
253-
bucket_counts: dp.positive_bucket().counts().to_vec(),
253+
bucket_counts: dp.positive_bucket().counts().collect(),
254254
}),
255255
negative: Some(TonicBuckets {
256256
offset: dp.negative_bucket().offset(),
257-
bucket_counts: dp.negative_bucket().counts().to_vec(),
257+
bucket_counts: dp.negative_bucket().counts().collect(),
258258
}),
259259
flags: TonicDataPointFlags::default() as u32,
260260
exemplars: dp.exemplars().map(Into::into).collect(),

opentelemetry-sdk/src/metrics/data/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -562,9 +562,9 @@ impl ExponentialBucket {
562562
self.offset
563563
}
564564

565-
/// Returns a reference to the counts vec.
566-
pub fn counts(&self) -> &[u64] {
567-
&self.counts
565+
/// Returns an iterator over the counts.
566+
pub fn counts(&self) -> impl Iterator<Item = u64> + '_ {
567+
self.counts.iter().copied()
568568
}
569569
}
570570

0 commit comments

Comments
 (0)