Skip to content

Commit 5f0e3d4

Browse files
committed
Address PR comments
1 parent e6ca3a7 commit 5f0e3d4

File tree

2 files changed

+11
-24
lines changed

2 files changed

+11
-24
lines changed

opentelemetry-sdk/benches/metrics_counter.rs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,11 @@ fn criterion_benchmark(c: &mut Criterion) {
5353
counter_add_sorted(c);
5454
counter_add_unsorted(c);
5555

56-
let attribute_values = [
57-
"value1".to_owned(),
58-
"value2".to_owned(),
59-
"value3".to_owned(),
60-
"value4".to_owned(),
61-
"value5".to_owned(),
62-
"value6".to_owned(),
63-
"value7".to_owned(),
64-
"value8".to_owned(),
65-
"value9".to_owned(),
66-
"value10".to_owned(),
67-
];
56+
let attribute_values: [String; 10] = (1..=10)
57+
.map(|i| format!("value{}", i))
58+
.collect::<Vec<String>>()
59+
.try_into()
60+
.expect("Expected a Vec of length 10");
6861

6962
counter_add_sorted_with_non_static_values(c, attribute_values);
7063

opentelemetry-sdk/benches/metrics_histogram.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,12 @@ fn create_histogram(name: &'static str) -> Histogram<u64> {
5050
fn criterion_benchmark(c: &mut Criterion) {
5151
histogram_record(c);
5252

53-
let attribute_values = [
54-
"value1".to_owned(),
55-
"value2".to_owned(),
56-
"value3".to_owned(),
57-
"value4".to_owned(),
58-
"value5".to_owned(),
59-
"value6".to_owned(),
60-
"value7".to_owned(),
61-
"value8".to_owned(),
62-
"value9".to_owned(),
63-
"value10".to_owned(),
64-
];
53+
let attribute_values: [String; 10] = (1..=10)
54+
.map(|i| format!("value{}", i))
55+
.collect::<Vec<String>>()
56+
.try_into()
57+
.expect("Expected a Vec of length 10");
58+
6559
histogram_record_with_non_static_values(c, attribute_values);
6660
}
6761

0 commit comments

Comments
 (0)