From ed663528b81ba5c29e4fd28a15e505dfe23a0d30 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Mon, 9 Oct 2023 21:32:26 +0200 Subject: [PATCH] Revert, back to solution 1. --- sdk/include/opentelemetry/sdk/trace/samplers/parent.h | 4 ++-- .../opentelemetry/sdk/trace/samplers/trace_id_ratio.h | 2 +- sdk/test/trace/sampler_benchmark.cc | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sdk/include/opentelemetry/sdk/trace/samplers/parent.h b/sdk/include/opentelemetry/sdk/trace/samplers/parent.h index 0561364625..59dd314589 100644 --- a/sdk/include/opentelemetry/sdk/trace/samplers/parent.h +++ b/sdk/include/opentelemetry/sdk/trace/samplers/parent.h @@ -52,8 +52,8 @@ class ParentBasedSampler : public Sampler nostd::string_view GetDescription() const noexcept override; private: - std::shared_ptr delegate_sampler_; - std::string description_; + const std::shared_ptr delegate_sampler_; + const std::string description_; }; } // namespace trace } // namespace sdk diff --git a/sdk/include/opentelemetry/sdk/trace/samplers/trace_id_ratio.h b/sdk/include/opentelemetry/sdk/trace/samplers/trace_id_ratio.h index a6e2983fac..b5df576091 100644 --- a/sdk/include/opentelemetry/sdk/trace/samplers/trace_id_ratio.h +++ b/sdk/include/opentelemetry/sdk/trace/samplers/trace_id_ratio.h @@ -64,7 +64,7 @@ class TraceIdRatioBasedSampler : public Sampler private: std::string description_; - uint64_t threshold_; + const uint64_t threshold_; }; } // namespace trace } // namespace sdk diff --git a/sdk/test/trace/sampler_benchmark.cc b/sdk/test/trace/sampler_benchmark.cc index 42de190980..ec188b84a1 100644 --- a/sdk/test/trace/sampler_benchmark.cc +++ b/sdk/test/trace/sampler_benchmark.cc @@ -42,6 +42,11 @@ void BM_AlwaysOnSamplerConstruction(benchmark::State &state) } BENCHMARK(BM_AlwaysOnSamplerConstruction); +/* + Fails to build with GCC. + See upstream bug: https://github.com/google/benchmark/issues/1675 +*/ +#if 0 void BM_ParentBasedSamplerConstruction(benchmark::State &state) { while (state.KeepRunning()) @@ -59,6 +64,7 @@ void BM_TraceIdRatioBasedSamplerConstruction(benchmark::State &state) } } BENCHMARK(BM_TraceIdRatioBasedSamplerConstruction); +#endif // Sampler Helper Function void BenchmarkShouldSampler(Sampler &sampler, benchmark::State &state)