diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:54:28 +0000 |
commit | e6918187568dbd01842d8d1d2c808ce16a894239 (patch) | |
tree | 64f88b554b444a49f656b6c656111a145cbbaa28 /src/jaegertracing/opentelemetry-cpp/sdk/test/metrics/attributes_processor_benchmark.cc | |
parent | Initial commit. (diff) | |
download | ceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip |
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/jaegertracing/opentelemetry-cpp/sdk/test/metrics/attributes_processor_benchmark.cc')
-rw-r--r-- | src/jaegertracing/opentelemetry-cpp/sdk/test/metrics/attributes_processor_benchmark.cc | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/jaegertracing/opentelemetry-cpp/sdk/test/metrics/attributes_processor_benchmark.cc b/src/jaegertracing/opentelemetry-cpp/sdk/test/metrics/attributes_processor_benchmark.cc new file mode 100644 index 000000000..d558a668f --- /dev/null +++ b/src/jaegertracing/opentelemetry-cpp/sdk/test/metrics/attributes_processor_benchmark.cc @@ -0,0 +1,27 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +#include <benchmark/benchmark.h> +#ifndef ENABLE_METRICS_PREVIEW +# include <map> +# include "opentelemetry/sdk/metrics/view/attributes_processor.h" +using namespace opentelemetry::sdk::metrics; +namespace +{ +void BM_AttributseProcessorFilter(benchmark::State &state) +{ + std::map<std::string, int> attributes = { + {"att1", 10}, {"attr1", 20}, {"attr3", 30}, {"attr4", 40}}; + FilteringAttributesProcessor attributes_processor( + {{"attr2", true}, {"attr4", true}, {"attr6", true}}); + opentelemetry::common::KeyValueIterableView<std::map<std::string, int>> iterable(attributes); + while (state.KeepRunning()) + { + auto filtered_attributes = attributes_processor.process(iterable); + } +} + +BENCHMARK(BM_AttributseProcessorFilter); +} // namespace +#endif +BENCHMARK_MAIN(); |