Skip to content

Commit e521083

Browse files
authored
Minor refactoring (#1839)
1 parent 0f6de5a commit e521083

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

stress/src/metrics_counter.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rand::{
1616
rngs::{self},
1717
Rng, SeedableRng,
1818
};
19-
use std::{borrow::Cow, cell::RefCell};
19+
use std::cell::RefCell;
2020

2121
mod throughput;
2222

@@ -28,10 +28,7 @@ lazy_static! {
2828
"value1", "value2", "value3", "value4", "value5", "value6", "value7", "value8", "value9",
2929
"value10"
3030
];
31-
static ref COUNTER: Counter<u64> = PROVIDER
32-
.meter(<&str as Into<Cow<'static, str>>>::into("test"))
33-
.u64_counter("hello")
34-
.init();
31+
static ref COUNTER: Counter<u64> = PROVIDER.meter("test").u64_counter("hello").init();
3532
}
3633

3734
thread_local! {

stress/src/metrics_histogram.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use rand::{
1616
rngs::{self},
1717
Rng, SeedableRng,
1818
};
19-
use std::{borrow::Cow, cell::RefCell};
19+
use std::cell::RefCell;
2020

2121
mod throughput;
2222

@@ -28,10 +28,7 @@ lazy_static! {
2828
"value1", "value2", "value3", "value4", "value5", "value6", "value7", "value8", "value9",
2929
"value10"
3030
];
31-
static ref HISTOGRAM: Histogram<u64> = PROVIDER
32-
.meter(<&str as Into<Cow<'static, str>>>::into("test"))
33-
.u64_histogram("hello")
34-
.init();
31+
static ref HISTOGRAM: Histogram<u64> = PROVIDER.meter("test").u64_histogram("hello").init();
3532
}
3633

3734
thread_local! {

stress/src/metrics_overflow.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,15 @@ use rand::{
1616
rngs::{self},
1717
Rng, SeedableRng,
1818
};
19-
use std::{borrow::Cow, cell::RefCell};
19+
use std::cell::RefCell;
2020

2121
mod throughput;
2222

2323
lazy_static! {
2424
static ref PROVIDER: SdkMeterProvider = SdkMeterProvider::builder()
2525
.with_reader(ManualReader::builder().build())
2626
.build();
27-
static ref COUNTER: Counter<u64> = PROVIDER
28-
.meter(<&str as Into<Cow<'static, str>>>::into("test"))
29-
.u64_counter("hello")
30-
.init();
27+
static ref COUNTER: Counter<u64> = PROVIDER.meter("test").u64_counter("hello").init();
3128
}
3229

3330
thread_local! {

0 commit comments

Comments
 (0)