]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | // Copyright The OpenTelemetry Authors |
2 | // SPDX-License-Identifier: Apache-2.0 | |
3 | ||
4 | #pragma once | |
5 | ||
6 | #include "opentelemetry/common/key_value_iterable_view.h" | |
7 | #include "opentelemetry/common/macros.h" | |
8 | ||
9 | #include <array> | |
10 | #include <map> | |
11 | #include <string> | |
12 | #include <utility> | |
13 | ||
14 | OPENTELEMETRY_BEGIN_NAMESPACE | |
15 | namespace sdk | |
16 | { | |
17 | /** | |
18 | * Maintain a static empty array of pairs that represents empty (default) attributes. | |
19 | * This helps to avoid constructing a new empty container every time a call is made | |
20 | * with default attributes. | |
21 | */ | |
22 | OPENTELEMETRY_MAYBE_UNUSED static const opentelemetry::common::KeyValueIterableView< | |
23 | std::array<std::pair<std::string, int>, 0>> | |
24 | &GetEmptyAttributes() noexcept | |
25 | { | |
26 | static const std::array<std::pair<std::string, int>, 0> array{}; | |
27 | static const opentelemetry::common::KeyValueIterableView< | |
28 | std::array<std::pair<std::string, int>, 0>> | |
29 | kEmptyAttributes(array); | |
30 | ||
31 | return kEmptyAttributes; | |
32 | } | |
33 | } // namespace sdk | |
34 | OPENTELEMETRY_END_NAMESPACE |