@@ -135,13 +135,20 @@ impl<T> From<ExponentialHistogram<T>> for MetricData<T> {
135135pub struct GaugeDataPoint < T > {
136136 /// Attributes is the set of key value pairs that uniquely identify the
137137 /// time series.
138- pub attributes : Vec < KeyValue > ,
138+ pub ( crate ) attributes : Vec < KeyValue > ,
139139 /// The value of this data point.
140140 pub value : T ,
141141 /// The sampled [Exemplar]s collected during the time series.
142142 pub exemplars : Vec < Exemplar < T > > ,
143143}
144144
145+ impl < T > GaugeDataPoint < T > {
146+ /// Returns an iterator over the attributes in [GaugeDataPoint].
147+ pub fn attributes ( & self ) -> impl Iterator < Item = & KeyValue > {
148+ self . attributes . iter ( )
149+ }
150+ }
151+
145152/// A measurement of the current value of an instrument.
146153#[ derive( Debug , Clone ) ]
147154pub struct Gauge < T > {
@@ -165,13 +172,20 @@ impl<T> Gauge<T> {
165172pub struct SumDataPoint < T > {
166173 /// Attributes is the set of key value pairs that uniquely identify the
167174 /// time series.
168- pub attributes : Vec < KeyValue > ,
175+ pub ( crate ) attributes : Vec < KeyValue > ,
169176 /// The value of this data point.
170177 pub value : T ,
171178 /// The sampled [Exemplar]s collected during the time series.
172179 pub exemplars : Vec < Exemplar < T > > ,
173180}
174181
182+ impl < T > SumDataPoint < T > {
183+ /// Returns an iterator over the attributes in [SumDataPoint].
184+ pub fn attributes ( & self ) -> impl Iterator < Item = & KeyValue > {
185+ self . attributes . iter ( )
186+ }
187+ }
188+
175189/// Represents the sum of all measurements of values from an instrument.
176190#[ derive( Debug , Clone ) ]
177191pub struct Sum < T > {
@@ -220,7 +234,7 @@ impl<T> Histogram<T> {
220234#[ derive( Debug , Clone , PartialEq ) ]
221235pub struct HistogramDataPoint < T > {
222236 /// The set of key value pairs that uniquely identify the time series.
223- pub attributes : Vec < KeyValue > ,
237+ pub ( crate ) attributes : Vec < KeyValue > ,
224238 /// The number of updates this histogram has been calculated with.
225239 pub count : u64 ,
226240 /// The upper bounds of the buckets of the histogram.
@@ -241,6 +255,13 @@ pub struct HistogramDataPoint<T> {
241255 pub exemplars : Vec < Exemplar < T > > ,
242256}
243257
258+ impl < T > HistogramDataPoint < T > {
259+ /// Returns an iterator over the attributes in [HistogramDataPoint].
260+ pub fn attributes ( & self ) -> impl Iterator < Item = & KeyValue > {
261+ self . attributes . iter ( )
262+ }
263+ }
264+
244265/// The histogram of all measurements of values from an instrument.
245266#[ derive( Debug , Clone ) ]
246267pub struct ExponentialHistogram < T > {
@@ -266,7 +287,7 @@ impl<T> ExponentialHistogram<T> {
266287#[ derive( Debug , Clone , PartialEq ) ]
267288pub struct ExponentialHistogramDataPoint < T > {
268289 /// The set of key value pairs that uniquely identify the time series.
269- pub attributes : Vec < KeyValue > ,
290+ pub ( crate ) attributes : Vec < KeyValue > ,
270291
271292 /// The number of updates this histogram has been calculated with.
272293 pub count : usize ,
@@ -307,6 +328,13 @@ pub struct ExponentialHistogramDataPoint<T> {
307328 pub exemplars : Vec < Exemplar < T > > ,
308329}
309330
331+ impl < T > ExponentialHistogramDataPoint < T > {
332+ /// Returns an iterator over the attributes in [ExponentialHistogramDataPoint].
333+ pub fn attributes ( & self ) -> impl Iterator < Item = & KeyValue > {
334+ self . attributes . iter ( )
335+ }
336+ }
337+
310338/// A set of bucket counts, encoded in a contiguous array of counts.
311339#[ derive( Debug , Clone , PartialEq ) ]
312340pub struct ExponentialBucket {
0 commit comments