|
1 | 1 | use std::{collections::HashMap, f64::consts::LOG2_E, sync::Mutex, time::SystemTime};
|
2 | 2 |
|
3 | 3 | use once_cell::sync::Lazy;
|
4 |
| -use opentelemetry::metrics::MetricsError; |
| 4 | +use opentelemetry::{metrics::MetricsError, KeyValue}; |
5 | 5 |
|
6 | 6 | use crate::{
|
7 | 7 | metrics::data::{self, Aggregation, Temporality},
|
8 |
| - AttributeSet, |
| 8 | + metrics::AttributeSet, |
9 | 9 | };
|
10 | 10 |
|
11 | 11 | use super::Number;
|
@@ -396,7 +396,10 @@ impl<T: Number<T>> ExpoHistogram<T> {
|
396 | 396 |
|
397 | 397 | for (a, b) in values.drain() {
|
398 | 398 | h.data_points.push(data::ExponentialHistogramDataPoint {
|
399 |
| - attributes: a, |
| 399 | + attributes: a |
| 400 | + .iter() |
| 401 | + .map(|(k, v)| KeyValue::new(k.clone(), v.clone())) |
| 402 | + .collect(), |
400 | 403 | start_time: start,
|
401 | 404 | time: t,
|
402 | 405 | count: b.count,
|
@@ -474,7 +477,10 @@ impl<T: Number<T>> ExpoHistogram<T> {
|
474 | 477 | // overload the system.
|
475 | 478 | for (a, b) in values.iter() {
|
476 | 479 | h.data_points.push(data::ExponentialHistogramDataPoint {
|
477 |
| - attributes: a.clone(), |
| 480 | + attributes: a |
| 481 | + .iter() |
| 482 | + .map(|(k, v)| KeyValue::new(k.clone(), v.clone())) |
| 483 | + .collect(), |
478 | 484 | start_time: start,
|
479 | 485 | time: t,
|
480 | 486 | count: b.count,
|
@@ -1260,7 +1266,7 @@ mod tests {
|
1260 | 1266 | want: data::ExponentialHistogram {
|
1261 | 1267 | temporality: Temporality::Delta,
|
1262 | 1268 | data_points: vec![data::ExponentialHistogramDataPoint {
|
1263 |
| - attributes: AttributeSet::default(), |
| 1269 | + attributes: vec![], |
1264 | 1270 | count: 6,
|
1265 | 1271 | min: Some(1.into()),
|
1266 | 1272 | max: Some(16.into()),
|
@@ -1303,7 +1309,7 @@ mod tests {
|
1303 | 1309 | want: data::ExponentialHistogram {
|
1304 | 1310 | temporality: Temporality::Cumulative,
|
1305 | 1311 | data_points: vec![data::ExponentialHistogramDataPoint {
|
1306 |
| - attributes: AttributeSet::default(), |
| 1312 | + attributes: vec![], |
1307 | 1313 | count: 6,
|
1308 | 1314 | min: Some(1.into()),
|
1309 | 1315 | max: Some(16.into()),
|
@@ -1349,7 +1355,7 @@ mod tests {
|
1349 | 1355 | want: data::ExponentialHistogram {
|
1350 | 1356 | temporality: Temporality::Delta,
|
1351 | 1357 | data_points: vec![data::ExponentialHistogramDataPoint {
|
1352 |
| - attributes: AttributeSet::default(), |
| 1358 | + attributes: vec![], |
1353 | 1359 | count: 6,
|
1354 | 1360 | min: Some(1.into()),
|
1355 | 1361 | max: Some(16.into()),
|
@@ -1404,7 +1410,7 @@ mod tests {
|
1404 | 1410 | offset: -1,
|
1405 | 1411 | counts: vec![1, 6, 2],
|
1406 | 1412 | },
|
1407 |
| - attributes: AttributeSet::default(), |
| 1413 | + attributes: vec![], |
1408 | 1414 | start_time: SystemTime::now(),
|
1409 | 1415 | time: SystemTime::now(),
|
1410 | 1416 | negative_bucket: data::ExponentialBucket {
|
|
0 commit comments