]>
Commit | Line | Data |
---|---|---|
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" | |
8 | using namespace opentelemetry::sdk::metrics; | |
9 | namespace | |
10 | { | |
11 | void 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 | ||
24 | BENCHMARK(BM_AttributseProcessorFilter); | |
25 | } // namespace | |
26 | #endif | |
27 | BENCHMARK_MAIN(); |