]> git.proxmox.com Git - ceph.git/blame - ceph/src/jaegertracing/opentelemetry-cpp/sdk/test/metrics/attributes_processor_benchmark.cc
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / jaegertracing / opentelemetry-cpp / sdk / test / metrics / attributes_processor_benchmark.cc
CommitLineData
1e59de90
TL
1// Copyright The OpenTelemetry Authors
2// SPDX-License-Identifier: Apache-2.0
3
4#include <benchmark/benchmark.h>
5#ifndef ENABLE_METRICS_PREVIEW
6# include <map>
7# include "opentelemetry/sdk/metrics/view/attributes_processor.h"
8using namespace opentelemetry::sdk::metrics;
9namespace
10{
11void BM_AttributseProcessorFilter(benchmark::State &state)
12{
13 std::map<std::string, int> attributes = {
14 {"att1", 10}, {"attr1", 20}, {"attr3", 30}, {"attr4", 40}};
15 FilteringAttributesProcessor attributes_processor(
16 {{"attr2", true}, {"attr4", true}, {"attr6", true}});
17 opentelemetry::common::KeyValueIterableView<std::map<std::string, int>> iterable(attributes);
18 while (state.KeepRunning())
19 {
20 auto filtered_attributes = attributes_processor.process(iterable);
21 }
22}
23
24BENCHMARK(BM_AttributseProcessorFilter);
25} // namespace
26#endif
27BENCHMARK_MAIN();