Skip to content

Commit

Permalink
Minor refactoring (#1839)
Browse files Browse the repository at this point in the history
  • Loading branch information
utpilla authored May 29, 2024
1 parent 0f6de5a commit e521083
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
7 changes: 2 additions & 5 deletions stress/src/metrics_counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use rand::{
rngs::{self},
Rng, SeedableRng,
};
use std::{borrow::Cow, cell::RefCell};
use std::cell::RefCell;

mod throughput;

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

thread_local! {
Expand Down
7 changes: 2 additions & 5 deletions stress/src/metrics_histogram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use rand::{
rngs::{self},
Rng, SeedableRng,
};
use std::{borrow::Cow, cell::RefCell};
use std::cell::RefCell;

mod throughput;

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

thread_local! {
Expand Down
7 changes: 2 additions & 5 deletions stress/src/metrics_overflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,15 @@ use rand::{
rngs::{self},
Rng, SeedableRng,
};
use std::{borrow::Cow, cell::RefCell};
use std::cell::RefCell;

mod throughput;

lazy_static! {
static ref PROVIDER: SdkMeterProvider = SdkMeterProvider::builder()
.with_reader(ManualReader::builder().build())
.build();
static ref COUNTER: Counter<u64> = PROVIDER
.meter(<&str as Into<Cow<'static, str>>>::into("test"))
.u64_counter("hello")
.init();
static ref COUNTER: Counter<u64> = PROVIDER.meter("test").u64_counter("hello").init();
}

thread_local! {
Expand Down

0 comments on commit e521083

Please sign in to comment.