8 #include <unordered_map>
11 #include "opentelemetry/common/attribute_value.h"
12 #include "opentelemetry/common/key_value_iterable.h"
13 #include "opentelemetry/nostd/string_view.h"
14 #include "opentelemetry/sdk/common/custom_hash_equality.h"
15 #include "opentelemetry/sdk/metrics/state/filtered_ordered_attribute_map.h"
16 #include "opentelemetry/version.h"
24 using MetricAttributes = opentelemetry::sdk::metrics::FilteredOrderedAttributeMap;
26 typedef std::unordered_map<std::string,
28 opentelemetry::sdk::common::StringViewHash,
29 opentelemetry::sdk::common::StringViewEqual>
37 class AttributesProcessor
44 const opentelemetry::common::KeyValueIterable &attributes)
const noexcept = 0;
56 class DefaultAttributesProcessor :
public AttributesProcessor
60 const opentelemetry::common::KeyValueIterable &attributes)
const noexcept
override
74 class FilteringAttributesProcessor :
public AttributesProcessor
78 : allowed_attribute_keys_(
std::move(allowed_attribute_keys))
82 : allowed_attribute_keys_(allowed_attribute_keys)
86 const opentelemetry::common::KeyValueIterable &attributes)
const noexcept
override
89 attributes.ForEachKeyValue(
92 allowed_attribute_keys_.end())
94 result.SetAttribute(key, value);
107 allowed_attribute_keys_.end());
119 class FilteringExcludeAttributesProcessor :
public AttributesProcessor
127 : exclude_list_(exclude_list)
131 const opentelemetry::common::KeyValueIterable &attributes)
const noexcept
override
138 result.SetAttribute(key, value);
151 exclude_list_.end());