-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into async_exporting_for_otlp_grpc_exporter
- Loading branch information
Showing
12 changed files
with
213 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
sdk/include/opentelemetry/sdk/metrics/state/filtered_ordered_attribute_map.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#pragma once | ||
|
||
#include <map> | ||
#include <string> | ||
#include "opentelemetry/sdk/common/attributemap_hash.h" | ||
#include "opentelemetry/version.h" | ||
|
||
OPENTELEMETRY_BEGIN_NAMESPACE | ||
namespace sdk | ||
{ | ||
namespace metrics | ||
{ | ||
class AttributesProcessor; | ||
class FilteredOrderedAttributeMap : public opentelemetry::sdk::common::OrderedAttributeMap | ||
{ | ||
public: | ||
FilteredOrderedAttributeMap() = default; | ||
FilteredOrderedAttributeMap( | ||
std::initializer_list<std::pair<nostd::string_view, opentelemetry::common::AttributeValue>> | ||
attributes) | ||
: OrderedAttributeMap(attributes) | ||
{} | ||
FilteredOrderedAttributeMap(const opentelemetry::common::KeyValueIterable &attributes) | ||
: FilteredOrderedAttributeMap(attributes, nullptr) | ||
{} | ||
FilteredOrderedAttributeMap(const opentelemetry::common::KeyValueIterable &attributes, | ||
const opentelemetry::sdk::metrics::AttributesProcessor *processor); | ||
FilteredOrderedAttributeMap( | ||
std::initializer_list<std::pair<nostd::string_view, opentelemetry::common::AttributeValue>> | ||
attributes, | ||
const opentelemetry::sdk::metrics::AttributesProcessor *processor); | ||
}; | ||
} // namespace metrics | ||
} // namespace sdk | ||
OPENTELEMETRY_END_NAMESPACE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include "opentelemetry/sdk/metrics/state/filtered_ordered_attribute_map.h" | ||
#include "opentelemetry/sdk/metrics/view/attributes_processor.h" | ||
|
||
OPENTELEMETRY_BEGIN_NAMESPACE | ||
namespace sdk | ||
{ | ||
namespace metrics | ||
{ | ||
FilteredOrderedAttributeMap::FilteredOrderedAttributeMap( | ||
const opentelemetry::common::KeyValueIterable &attributes, | ||
const AttributesProcessor *processor) | ||
: OrderedAttributeMap() | ||
{ | ||
attributes.ForEachKeyValue( | ||
[&](nostd::string_view key, opentelemetry::common::AttributeValue value) noexcept { | ||
if (processor && processor->isPresent(key)) | ||
{ | ||
SetAttribute(key, value); | ||
} | ||
return true; | ||
}); | ||
} | ||
|
||
FilteredOrderedAttributeMap::FilteredOrderedAttributeMap( | ||
std::initializer_list<std::pair<nostd::string_view, opentelemetry::common::AttributeValue>> | ||
attributes, | ||
const AttributesProcessor *processor) | ||
: OrderedAttributeMap() | ||
{ | ||
for (auto &kv : attributes) | ||
{ | ||
if (processor && processor->isPresent(kv.first)) | ||
{ | ||
SetAttribute(kv.first, kv.second); | ||
} | ||
} | ||
} | ||
} // namespace metrics | ||
} // namespace sdk | ||
OPENTELEMETRY_END_NAMESPACE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.