Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions stress/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,20 @@ path = "src/metrics_histogram.rs"
doc = false
bench = false

[[bin]] # Bin to run the metrics stress tests for bound Counter
name = "metrics_counter_bound"
path = "src/metrics_counter_bound.rs"
required-features = ["experimental_metrics_bound_instruments"]
doc = false
bench = false

[[bin]] # Bin to run the metrics stress tests for bound Histogram
name = "metrics_histogram_bound"
path = "src/metrics_histogram_bound.rs"
required-features = ["experimental_metrics_bound_instruments"]
doc = false
bench = false

[[bin]] # Bin to run the metrics overflow stress tests
name = "metrics_overflow"
path = "src/metrics_overflow.rs"
Expand Down Expand Up @@ -64,6 +78,7 @@ sysinfo = { workspace = true, optional = true }

[features]
stats = ["sysinfo"]
experimental_metrics_bound_instruments = ["opentelemetry/experimental_metrics_bound_instruments"]

[lints]
workspace = true
9 changes: 5 additions & 4 deletions stress/src/logs.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/*
Stress test results:
Hardware: Apple M4 Pro
Total Number of Cores: 14 (10 performance and 4 efficiency)
~27 M/sec
~1.4 B/sec (when disabled)
OS: macOS 26.4.1
Hardware: Apple M4 Pro, 14 cores (10 performance + 4 efficiency)
RAM: 24.0 GB
~27 M /sec
~1.4 B /sec (when disabled)
*/
use opentelemetry::logs::Severity;
use opentelemetry::InstrumentationScope;
Expand Down
5 changes: 5 additions & 0 deletions stress/src/metrics_counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

Hardware: AMD EPYC 7763 64-Core Processor - 2.44 GHz, 16vCPUs,
~20 M /sec

OS: macOS 26.4.1
Hardware: Apple M4 Pro, 14 cores (10 performance + 4 efficiency)
RAM: 24.0 GB
~1.65 M /sec
*/

use lazy_static::lazy_static;
Expand Down
45 changes: 45 additions & 0 deletions stress/src/metrics_counter_bound.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
Stress test for bound Counter instrument.

Run with:
cargo run --release --bin metrics_counter_bound \
--features experimental_metrics_bound_instruments

Stress test results:
OS: macOS 26.4.1
Hardware: Apple M4 Pro, 14 cores (10 performance + 4 efficiency)
RAM: 24.0 GB
~13 B /sec
*/

use lazy_static::lazy_static;
use opentelemetry::{
metrics::{BoundCounter, Counter, MeterProvider as _},
KeyValue,
};
use opentelemetry_sdk::metrics::{ManualReader, SdkMeterProvider};

mod throughput;

lazy_static! {
static ref PROVIDER: SdkMeterProvider = SdkMeterProvider::builder()
.with_reader(ManualReader::builder().build())
.build();
static ref COUNTER: Counter<u64> = PROVIDER.meter("test").u64_counter("hello").build();
// A single bound counter created once at startup. The hot path simply
// calls add(1) on it, exercising the bound-instrument fast path with no
// per-call attribute resolution.
static ref BOUND_COUNTER: BoundCounter<u64> = COUNTER.bind(&[
KeyValue::new("attribute1", "value1"),
KeyValue::new("attribute2", "value2"),
KeyValue::new("attribute3", "value3"),
]);
}

fn main() {
throughput::test_throughput(test_counter_bound);
}

fn test_counter_bound() {
BOUND_COUNTER.add(1);
}
5 changes: 5 additions & 0 deletions stress/src/metrics_gauge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
Hardware: Intel(R) Xeon(R) Platinum 8370C CPU @ 2.80GHz, 16vCPUs,
RAM: 64.0 GB
~11.5 M/sec

OS: macOS 26.4.1
Hardware: Apple M4 Pro, 14 cores (10 performance + 4 efficiency)
RAM: 24.0 GB
~1.6 M /sec
*/

use lazy_static::lazy_static;
Expand Down
5 changes: 5 additions & 0 deletions stress/src/metrics_histogram.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

Hardware: AMD EPYC 7763 64-Core Processor - 2.44 GHz, 16vCPUs,
~12.0 M /sec

OS: macOS 26.4.1
Hardware: Apple M4 Pro, 14 cores (10 performance + 4 efficiency)
RAM: 24.0 GB
~1.5 M /sec
*/

use lazy_static::lazy_static;
Expand Down
45 changes: 45 additions & 0 deletions stress/src/metrics_histogram_bound.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
Stress test for bound Histogram instrument.

Run with:
cargo run --release --bin metrics_histogram_bound \
--features experimental_metrics_bound_instruments

Stress test results:
OS: macOS 26.4.1
Hardware: Apple M4 Pro, 14 cores (10 performance + 4 efficiency)
RAM: 24.0 GB
~11 B /sec
*/

use lazy_static::lazy_static;
use opentelemetry::{
metrics::{BoundHistogram, Histogram, MeterProvider as _},
KeyValue,
};
use opentelemetry_sdk::metrics::{ManualReader, SdkMeterProvider};

mod throughput;

lazy_static! {
static ref PROVIDER: SdkMeterProvider = SdkMeterProvider::builder()
.with_reader(ManualReader::builder().build())
.build();
static ref HISTOGRAM: Histogram<u64> = PROVIDER.meter("test").u64_histogram("hello").build();
// A single bound histogram created once at startup. The hot path simply
// calls record() on it, exercising the bound-instrument fast path with no
// per-call attribute resolution.
static ref BOUND_HISTOGRAM: BoundHistogram<u64> = HISTOGRAM.bind(&[
KeyValue::new("attribute1", "value1"),
KeyValue::new("attribute2", "value2"),
KeyValue::new("attribute3", "value3"),
]);
}

fn main() {
throughput::test_throughput(test_histogram_bound);
}

fn test_histogram_bound() {
BOUND_HISTOGRAM.record(1);
}
5 changes: 5 additions & 0 deletions stress/src/traces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@

Hardware: AMD EPYC 7763 64-Core Processor - 2.44 GHz, 16vCPUs,
~10.6 M /sec

OS: macOS 26.4.1
Hardware: Apple M4 Pro, 14 cores (10 performance + 4 efficiency)
RAM: 24.0 GB
~5.2 M /sec
*/
use lazy_static::lazy_static;
use opentelemetry::{
Expand Down
Loading