Skip to content

Commit 6aeed5a

Browse files
bantonssonlalitb
andauthored
perf: use line tables only and make profiling optional (open-telemetry#3150)
Co-authored-by: Lalit Kumar Bhasin <[email protected]>
1 parent 8474966 commit 6aeed5a

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@ criterion = { workspace = true }
3131
#tokio = { workspace = true, features = ["full"]}
3232

3333
[target.'cfg(not(target_os = "windows"))'.dev-dependencies]
34-
pprof = { version = "0.14", features = ["flamegraph", "criterion"] }
34+
pprof = { workspace = true }
3535

3636
[features]
3737
default = []
3838
experimental_metadata_attributes = ["dep:tracing-log"]
3939
spec_unstable_logs_enabled = ["opentelemetry/spec_unstable_logs_enabled"]
4040
experimental_use_tracing_span_context = ["tracing-opentelemetry"]
41+
bench_profiling = []
4142

4243

4344
[[bench]]

benches/log-attributes.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use opentelemetry_appender_tracing::layer as tracing_layer;
2828
use opentelemetry_sdk::error::OTelSdkResult;
2929
use opentelemetry_sdk::logs::{LogProcessor, SdkLogRecord, SdkLoggerProvider};
3030
use opentelemetry_sdk::Resource;
31-
#[cfg(not(target_os = "windows"))]
31+
#[cfg(all(not(target_os = "windows"), feature = "bench_profiling"))]
3232
use pprof::criterion::{Output, PProfProfiler};
3333
use tracing::error;
3434
use tracing_subscriber::prelude::*;
@@ -251,7 +251,7 @@ fn criterion_benchmark(c: &mut Criterion) {
251251
// }
252252
}
253253

254-
#[cfg(not(target_os = "windows"))]
254+
#[cfg(all(not(target_os = "windows"), feature = "bench_profiling"))]
255255
criterion_group! {
256256
name = benches;
257257
config = Criterion::default()
@@ -261,7 +261,7 @@ criterion_group! {
261261
targets = criterion_benchmark
262262
}
263263

264-
#[cfg(target_os = "windows")]
264+
#[cfg(any(target_os = "windows", not(feature = "bench_profiling")))]
265265
criterion_group! {
266266
name = benches;
267267
config = Criterion::default()

benches/logs.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use opentelemetry_appender_tracing::layer as tracing_layer;
2929
use opentelemetry_sdk::error::OTelSdkResult;
3030
use opentelemetry_sdk::logs::{LogProcessor, SdkLogRecord, SdkLoggerProvider};
3131
use opentelemetry_sdk::Resource;
32-
#[cfg(not(target_os = "windows"))]
32+
#[cfg(all(not(target_os = "windows"), feature = "bench_profiling"))]
3333
use pprof::criterion::{Output, PProfProfiler};
3434
use tracing::error;
3535
use tracing_subscriber::prelude::*;
@@ -161,7 +161,7 @@ fn criterion_benchmark(c: &mut Criterion) {
161161
benchmark_with_noop_layer(c, false, "noop_layer_disabled");
162162
}
163163

164-
#[cfg(not(target_os = "windows"))]
164+
#[cfg(all(not(target_os = "windows"), feature = "bench_profiling"))]
165165
criterion_group! {
166166
name = benches;
167167
config = Criterion::default()
@@ -170,7 +170,8 @@ criterion_group! {
170170
.with_profiler(PProfProfiler::new(100, Output::Flamegraph(None)));
171171
targets = criterion_benchmark
172172
}
173-
#[cfg(target_os = "windows")]
173+
174+
#[cfg(any(target_os = "windows", not(feature = "bench_profiling")))]
174175
criterion_group! {
175176
name = benches;
176177
config = Criterion::default()

0 commit comments

Comments
 (0)