From 622f8fb06f92aec3a952c42c7890d1d74189f171 Mon Sep 17 00:00:00 2001 From: owent Date: Tue, 1 Jul 2025 20:39:18 +0800 Subject: [PATCH 01/23] Add bundle version of utf8_range to validate attribute values --- .../sdk/common/attribute_validity.h | 127 ++++++++ .../instrumentation_scope.h | 30 +- sdk/src/common/BUILD | 30 ++ sdk/src/common/CMakeLists.txt | 10 +- sdk/src/common/attribute_validity.cc | 171 +++++++++++ sdk/src/common/internal/utf8_range/README.md | 7 + .../common/internal/utf8_range/uft8_range.cc | 240 +++++++++++++++ .../common/internal/utf8_range/utf8_range.h | 24 ++ .../internal/utf8_range/utf8_range_neon.inc | 126 ++++++++ .../internal/utf8_range/utf8_range_sse.inc | 274 ++++++++++++++++++ sdk/src/resource/BUILD | 1 + sdk/src/resource/resource.cc | 20 +- sdk/src/trace/BUILD | 1 + sdk/src/trace/span.cc | 11 +- sdk/test/instrumentationscope/BUILD | 1 + sdk/test/instrumentationscope/CMakeLists.txt | 5 +- 16 files changed, 1069 insertions(+), 9 deletions(-) create mode 100644 sdk/include/opentelemetry/sdk/common/attribute_validity.h create mode 100644 sdk/src/common/attribute_validity.cc create mode 100644 sdk/src/common/internal/utf8_range/README.md create mode 100644 sdk/src/common/internal/utf8_range/uft8_range.cc create mode 100644 sdk/src/common/internal/utf8_range/utf8_range.h create mode 100644 sdk/src/common/internal/utf8_range/utf8_range_neon.inc create mode 100644 sdk/src/common/internal/utf8_range/utf8_range_sse.inc diff --git a/sdk/include/opentelemetry/sdk/common/attribute_validity.h b/sdk/include/opentelemetry/sdk/common/attribute_validity.h new file mode 100644 index 0000000000..4ee992aaf2 --- /dev/null +++ b/sdk/include/opentelemetry/sdk/common/attribute_validity.h @@ -0,0 +1,127 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +#include "opentelemetry/common/attribute_value.h" +#include "opentelemetry/common/key_value_iterable.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/common/attribute_utils.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace sdk +{ +namespace common +{ + +OPENTELEMETRY_EXPORT bool AttributeIsValidString(nostd::string_view value) noexcept; + +/** + * Validate if an attribute value is valid. + */ +struct AttributeValidator +{ + bool operator()(bool /*v*/) noexcept { return true; } + bool operator()(int32_t /*v*/) noexcept { return true; } + bool operator()(uint32_t /*v*/) noexcept { return true; } + bool operator()(int64_t /*v*/) noexcept { return true; } + bool operator()(uint64_t /*v*/) noexcept { return true; } + bool operator()(double /*v*/) noexcept { return true; } + bool operator()(nostd::string_view v) noexcept { return AttributeIsValidString(v); } + bool operator()(std::string v) noexcept { return AttributeIsValidString(v); } + bool operator()(const char *v) noexcept { return AttributeIsValidString(v); } + bool operator()(nostd::span /*v*/) noexcept { return true; } + bool operator()(nostd::span /*v*/) noexcept { return true; } + bool operator()(nostd::span /*v*/) noexcept { return true; } + bool operator()(nostd::span /*v*/) noexcept { return true; } + bool operator()(nostd::span /*v*/) noexcept { return true; } + bool operator()(nostd::span /*v*/) noexcept { return true; } + bool operator()(nostd::span /*v*/) noexcept { return true; } + bool operator()(nostd::span v) noexcept + { + for (const auto &s : v) + { + if (!AttributeIsValidString(s)) + { + return false; + } + } + return true; + } + bool operator()(const std::vector & /*v*/) noexcept { return true; } + bool operator()(const std::vector & /*v*/) noexcept { return true; } + bool operator()(const std::vector & /*v*/) noexcept { return true; } + bool operator()(const std::vector & /*v*/) noexcept { return true; } + bool operator()(const std::vector & /*v*/) noexcept { return true; } + bool operator()(const std::vector &v) + { + for (const auto &s : v) + { + if (!AttributeIsValidString(s)) + { + return false; + } + } + return true; + } + bool operator()(const std::vector & /*v*/) noexcept { return true; } + bool operator()(const std::vector & /*v*/) noexcept { return true; } + + OPENTELEMETRY_EXPORT static bool IsValid(const OwnedAttributeValue &value) noexcept; + + OPENTELEMETRY_EXPORT static bool IsValid( + const opentelemetry::common::AttributeValue &value) noexcept; + + OPENTELEMETRY_EXPORT static bool IsAllValid(const AttributeMap &attributes) noexcept; + + OPENTELEMETRY_EXPORT static bool IsAllValid(const OrderedAttributeMap &attributes) noexcept; + + OPENTELEMETRY_EXPORT static void Filter(AttributeMap &attributes, nostd::string_view log_hint); + + OPENTELEMETRY_EXPORT static void Filter(OrderedAttributeMap &attributes, + nostd::string_view log_hint); +}; + +/** + * Supports internal iteration over a collection of key-value pairs and filtering of invalid + * attributes. + */ +class OPENTELEMETRY_EXPORT KeyValueFilterIterable : public opentelemetry::common::KeyValueIterable +{ +public: + KeyValueFilterIterable(const opentelemetry::common::KeyValueIterable &origin, + opentelemetry::nostd::string_view log_hint) noexcept; + + ~KeyValueFilterIterable() override; + + bool ForEachKeyValue( + opentelemetry::nostd::function_ref callback) + const noexcept override; + + size_t size() const noexcept override; + +private: + // Pointer to the original KeyValueIterable + const opentelemetry::common::KeyValueIterable *origin_; + + // Size of valid attributes + mutable size_t size_; + + // Log hint for invalid attributes + opentelemetry::nostd::string_view log_hint_; +}; + +} // namespace common +} // namespace sdk +OPENTELEMETRY_END_NAMESPACE diff --git a/sdk/include/opentelemetry/sdk/instrumentationscope/instrumentation_scope.h b/sdk/include/opentelemetry/sdk/instrumentationscope/instrumentation_scope.h index 68e9d10d40..6fc28da92b 100644 --- a/sdk/include/opentelemetry/sdk/instrumentationscope/instrumentation_scope.h +++ b/sdk/include/opentelemetry/sdk/instrumentationscope/instrumentation_scope.h @@ -12,6 +12,8 @@ #include "opentelemetry/nostd/unique_ptr.h" #include "opentelemetry/nostd/variant.h" #include "opentelemetry/sdk/common/attribute_utils.h" +#include "opentelemetry/sdk/common/attribute_validity.h" +#include "opentelemetry/sdk/common/global_log_handler.h" #include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE @@ -42,6 +44,7 @@ class InstrumentationScope nostd::string_view schema_url = "", InstrumentationScopeAttributes &&attributes = {}) { + common::AttributeValidator::Filter(attributes, "[InstrumentationScope]"); return nostd::unique_ptr( new InstrumentationScope{name, version, schema_url, std::move(attributes)}); } @@ -60,8 +63,19 @@ class InstrumentationScope nostd::string_view schema_url, const InstrumentationScopeAttributes &attributes) { - return nostd::unique_ptr(new InstrumentationScope{ - name, version, schema_url, InstrumentationScopeAttributes(attributes)}); + // Copy attributes only when we find some invalid attributes and try to remove them. + if (common::AttributeValidator::IsAllValid(attributes)) + { + return nostd::unique_ptr(new InstrumentationScope{ + name, version, schema_url, InstrumentationScopeAttributes(attributes)}); + } + else + { + InstrumentationScopeAttributes copy_attributes = attributes; + common::AttributeValidator::Filter(copy_attributes, "[InstrumentationScope]"); + return nostd::unique_ptr(new InstrumentationScope{ + name, version, schema_url, InstrumentationScopeAttributes(copy_attributes)}); + } } /** @@ -88,6 +102,12 @@ class InstrumentationScope result->attributes_.reserve(opentelemetry::nostd::size(arg)); for (auto &argv : arg) { + if (!common::AttributeValidator::IsValid(argv.second)) + { + OTEL_INTERNAL_LOG_WARN("[InstrumentationScope] Invalid attribute value for: " + << std::string{argv.first} << ". This attribute will be ignored."); + continue; + } result->SetAttribute(argv.first, argv.second); } @@ -148,6 +168,12 @@ class InstrumentationScope void SetAttribute(nostd::string_view key, const opentelemetry::common::AttributeValue &value) noexcept { + if (!common::AttributeValidator::IsValid(value)) + { + OTEL_INTERNAL_LOG_WARN("[InstrumentationScope] Invalid attribute value for: " + << std::string{key} << ". This attribute will be ignored."); + return; + } attributes_[std::string(key)] = nostd::visit(opentelemetry::sdk::common::AttributeConverter(), value); } diff --git a/sdk/src/common/BUILD b/sdk/src/common/BUILD index 19b47034f7..804cdd7992 100644 --- a/sdk/src/common/BUILD +++ b/sdk/src/common/BUILD @@ -3,6 +3,36 @@ package(default_visibility = ["//visibility:public"]) +cc_library( + name = "utf8_range", + srcs = [ + "internal/utf8_range/uft8_range.cc", + ], + hdrs = [ + "internal/utf8_range/utf8_range.h", + "internal/utf8_range/utf8_range_neon.inc", + "internal/utf8_range/utf8_range_sse.inc", + ], + include_prefix = "src/common", + deps = [ + "//api", + ], +) + +cc_library( + name = "attribute_validity", + srcs = [ + "attribute_validity.cc", + ], + include_prefix = "src/common", + deps = [ + "//api", + "//sdk:headers", + "//sdk/src/common:global_log_handler", + "//sdk/src/common:utf8_range", + ], +) + cc_library( name = "random", srcs = [ diff --git a/sdk/src/common/CMakeLists.txt b/sdk/src/common/CMakeLists.txt index 4a3b59aefa..0d08148c27 100644 --- a/sdk/src/common/CMakeLists.txt +++ b/sdk/src/common/CMakeLists.txt @@ -1,8 +1,14 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -set(COMMON_SRCS random.cc global_log_handler.cc env_variables.cc base64.cc - disabled.cc) +set(COMMON_SRCS + random.cc + global_log_handler.cc + env_variables.cc + base64.cc + disabled.cc + attribute_validity.cc + internal/utf8_range/uft8_range.cc) if(WIN32) list(APPEND COMMON_SRCS platform/fork_windows.cc) else() diff --git a/sdk/src/common/attribute_validity.cc b/sdk/src/common/attribute_validity.cc new file mode 100644 index 0000000000..51a7e5990c --- /dev/null +++ b/sdk/src/common/attribute_validity.cc @@ -0,0 +1,171 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +#include "opentelemetry/sdk/common/attribute_validity.h" + +#include + +#include "opentelemetry/sdk/common/global_log_handler.h" +#include "opentelemetry/version.h" + +#include "src/common/internal/utf8_range/utf8_range.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace sdk +{ +namespace common +{ + +namespace +{ +static AttributeValidator &GetSharedAttributeValidator() noexcept +{ + static AttributeValidator validator; + return validator; +} +} // namespace + +OPENTELEMETRY_EXPORT bool AttributeIsValidString(nostd::string_view value) noexcept +{ + return 0 != utf8_range::utf8_range_IsValid(value.data(), value.size()); +} + +OPENTELEMETRY_EXPORT bool AttributeValidator::IsValid(const OwnedAttributeValue &value) noexcept +{ + return nostd::visit(GetSharedAttributeValidator(), value); +} + +OPENTELEMETRY_EXPORT bool AttributeValidator::IsValid( + const opentelemetry::common::AttributeValue &value) noexcept +{ + return nostd::visit(GetSharedAttributeValidator(), value); +} + +OPENTELEMETRY_EXPORT bool AttributeValidator::IsAllValid(const AttributeMap &attributes) noexcept +{ + for (const auto &kv : attributes) + { + if (!AttributeValidator::IsValid(kv.second)) + { + return false; + } + } + return true; +} + +OPENTELEMETRY_EXPORT bool AttributeValidator::IsAllValid( + const OrderedAttributeMap &attributes) noexcept +{ + for (const auto &kv : attributes) + { + if (!AttributeValidator::IsValid(kv.second)) + { + return false; + } + } + return true; +} + +OPENTELEMETRY_EXPORT void AttributeValidator::Filter(AttributeMap &attributes, + nostd::string_view log_hint) +{ + std::unordered_set invalid_keys; + for (auto &kv : attributes) + { + if (!common::AttributeValidator::IsValid(kv.second)) + { + OTEL_INTERNAL_LOG_WARN(log_hint << " Invalid attribute value for: " << kv.first + << ". This attribute will be ignored."); + + invalid_keys.insert(kv.first); + } + } + + for (auto &invalid_key : invalid_keys) + { + attributes.erase(invalid_key); + } +} + +OPENTELEMETRY_EXPORT void AttributeValidator::Filter(OrderedAttributeMap &attributes, + nostd::string_view log_hint) +{ + std::unordered_set invalid_keys; + for (auto &kv : attributes) + { + if (!common::AttributeValidator::IsValid(kv.second)) + { + OTEL_INTERNAL_LOG_WARN(log_hint << " Invalid attribute value for: " << kv.first + << ". This attribute will be ignored."); + + invalid_keys.insert(kv.first); + } + } + + for (auto &invalid_key : invalid_keys) + { + attributes.erase(invalid_key); + } +} + +KeyValueFilterIterable::KeyValueFilterIterable( + const opentelemetry::common::KeyValueIterable &origin, + opentelemetry::nostd::string_view log_hint) noexcept + : origin_(&origin), size_(static_cast(-1)), log_hint_(log_hint) +{} + +KeyValueFilterIterable::~KeyValueFilterIterable() {} + +bool KeyValueFilterIterable::ForEachKeyValue( + opentelemetry::nostd::function_ref callback) + const noexcept +{ + size_t size = 0; + bool ret = + origin_->ForEachKeyValue([&size, &callback, this](opentelemetry::nostd::string_view k, + opentelemetry::common::AttributeValue v) { + if (AttributeValidator::IsValid(v)) + { + ++size; + return callback(k, v); + } + + OTEL_INTERNAL_LOG_WARN(log_hint_ << " Invalid value for: " << k << ". It will be ignored."); + return true; + }); + + // If it return true, we already iterated over all key-values. The the size can be updated. + if (ret) + { + size_ = size; + } + + return ret; +} + +size_t KeyValueFilterIterable::size() const noexcept +{ + // Use cached size if it was already calculated. + if (size_ != static_cast(-1)) + { + return size_; + } + + size_t size = 0; + origin_->ForEachKeyValue( + [&size](opentelemetry::nostd::string_view, opentelemetry::common::AttributeValue v) { + if (AttributeValidator::IsValid(v)) + { + ++size; + } + return true; + }); + + size_ = size; + return size_; +} + +} // namespace common +} // namespace sdk +OPENTELEMETRY_END_NAMESPACE diff --git a/sdk/src/common/internal/utf8_range/README.md b/sdk/src/common/internal/utf8_range/README.md new file mode 100644 index 0000000000..f469cbe027 --- /dev/null +++ b/sdk/src/common/internal/utf8_range/README.md @@ -0,0 +1,7 @@ +# Notes on utf8_range implementation + +This is a snapshot of utf8_range from Google protobuf `v31.1`. + +The origin source is here . + +We modify the namespace to keep ABI compatibility. diff --git a/sdk/src/common/internal/utf8_range/uft8_range.cc b/sdk/src/common/internal/utf8_range/uft8_range.cc new file mode 100644 index 0000000000..72bf57f46f --- /dev/null +++ b/sdk/src/common/internal/utf8_range/uft8_range.cc @@ -0,0 +1,240 @@ +// Copyright 2023 Google LLC +// +// Use of this source code is governed by an MIT-style +// license that can be found in the LICENSE file or at +// https://opensource.org/licenses/MIT. + +/* This is a wrapper for the Google range-sse.cc algorithm which checks whether + * a sequence of bytes is a valid UTF-8 sequence and finds the longest valid + * prefix of the UTF-8 sequence. + * + * The key difference is that it checks for as much ASCII symbols as possible + * and then falls back to the range-sse.cc algorithm. The changes to the + * algorithm are cosmetic, mostly to trick the clang compiler to produce optimal + * code. + * + * For API see the utf8_validity.h header. + */ +#include "src/common/internal/utf8_range/utf8_range.h" + +#include +#include +#include + +#if defined(__GNUC__) +# define FORCE_INLINE_ATTR __attribute__((always_inline)) inline +#elif defined(_MSC_VER) +# define FORCE_INLINE_ATTR __forceinline +#else +# define FORCE_INLINE_ATTR +#endif + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace sdk +{ +namespace utf8_range +{ + +static FORCE_INLINE_ATTR uint64_t utf8_range_UnalignedLoad64(const void *p) +{ + uint64_t t; + memcpy(&t, p, sizeof t); + return t; +} + +static FORCE_INLINE_ATTR int utf8_range_AsciiIsAscii(unsigned char c) +{ + return c < 128; +} + +static FORCE_INLINE_ATTR int utf8_range_IsTrailByteOk(const char c) +{ + return (int8_t)(c) <= (int8_t)(0xBF); +} + +/* If return_position is false then it returns 1 if |data| is a valid utf8 + * sequence, otherwise returns 0. + * If return_position is set to true, returns the length in bytes of the prefix + of |data| that is all structurally valid UTF-8. + */ +static size_t utf8_range_ValidateUTF8Naive(const char *data, const char *end, int return_position) +{ + /* We return err_pos in the loop which is always 0 if !return_position */ + size_t err_pos = 0; + size_t codepoint_bytes = 0; + /* The early check is done because of early continue's on codepoints of all + * sizes, i.e. we first check for ascii and if it is, we call continue, then + * for 2 byte codepoints, etc. This is done in order to reduce indentation and + * improve readability of the codepoint validity check. + */ + while (data + codepoint_bytes < end) + { + if (return_position) + { + err_pos += codepoint_bytes; + } + data += codepoint_bytes; + const size_t len = end - data; + const unsigned char byte1 = data[0]; + + /* We do not skip many ascii bytes at the same time as this function is + used for tail checking (< 16 bytes) and for non x86 platforms. We also + don't think that cases where non-ASCII codepoints are followed by ascii + happen often. For small strings it also introduces some penalty. For + purely ascii UTF8 strings (which is the overwhelming case) we call + SkipAscii function which is multiplatform and extremely fast. + */ + /* [00..7F] ASCII -> 1 byte */ + if (utf8_range_AsciiIsAscii(byte1)) + { + codepoint_bytes = 1; + continue; + } + /* [C2..DF], [80..BF] -> 2 bytes */ + if (len >= 2 && byte1 >= 0xC2 && byte1 <= 0xDF && utf8_range_IsTrailByteOk(data[1])) + { + codepoint_bytes = 2; + continue; + } + if (len >= 3) + { + const unsigned char byte2 = data[1]; + const unsigned char byte3 = data[2]; + + /* Is byte2, byte3 between [0x80, 0xBF] + * Check for 0x80 was done above. + */ + if (!utf8_range_IsTrailByteOk(byte2) || !utf8_range_IsTrailByteOk(byte3)) + { + return err_pos; + } + + if (/* E0, A0..BF, 80..BF */ + ((byte1 == 0xE0 && byte2 >= 0xA0) || + /* E1..EC, 80..BF, 80..BF */ + (byte1 >= 0xE1 && byte1 <= 0xEC) || + /* ED, 80..9F, 80..BF */ + (byte1 == 0xED && byte2 <= 0x9F) || + /* EE..EF, 80..BF, 80..BF */ + (byte1 >= 0xEE && byte1 <= 0xEF))) + { + codepoint_bytes = 3; + continue; + } + if (len >= 4) + { + const unsigned char byte4 = data[3]; + /* Is byte4 between 0x80 ~ 0xBF */ + if (!utf8_range_IsTrailByteOk(byte4)) + { + return err_pos; + } + + if (/* F0, 90..BF, 80..BF, 80..BF */ + ((byte1 == 0xF0 && byte2 >= 0x90) || + /* F1..F3, 80..BF, 80..BF, 80..BF */ + (byte1 >= 0xF1 && byte1 <= 0xF3) || + /* F4, 80..8F, 80..BF, 80..BF */ + (byte1 == 0xF4 && byte2 <= 0x8F))) + { + codepoint_bytes = 4; + continue; + } + } + } + return err_pos; + } + if (return_position) + { + err_pos += codepoint_bytes; + } + /* if return_position is false, this returns 1. + * if return_position is true, this returns err_pos. + */ + return err_pos + (1 - return_position); +} + +#if defined(__SSE4_1__) || (defined(__ARM_NEON) && defined(__ARM_64BIT_STATE)) +/* Returns the number of bytes needed to skip backwards to get to the first + byte of codepoint. + */ +static inline int utf8_range_CodepointSkipBackwards(int32_t codepoint_word) +{ + const int8_t *const codepoint = (const int8_t *)(&codepoint_word); + if (!utf8_range_IsTrailByteOk(codepoint[3])) + { + return 1; + } + else if (!utf8_range_IsTrailByteOk(codepoint[2])) + { + return 2; + } + else if (!utf8_range_IsTrailByteOk(codepoint[1])) + { + return 3; + } + return 0; +} +#endif // __SSE4_1__ + +/* Skipping over ASCII as much as possible, per 8 bytes. It is intentional + as most strings to check for validity consist only of 1 byte codepoints. + */ +static inline const char *utf8_range_SkipAscii(const char *data, const char *end) +{ + while (8 <= end - data && (utf8_range_UnalignedLoad64(data) & 0x8080808080808080) == 0) + { + data += 8; + } + while (data < end && utf8_range_AsciiIsAscii(*data)) + { + ++data; + } + return data; +} + +#if defined(__SSE4_1__) +# include "src/common/internal/utf8_range/utf8_range_sse.inc" +#elif defined(__ARM_NEON) && defined(__ARM_64BIT_STATE) +# include "src/common/internal/utf8_range/utf8_range_neon.inc" +#endif + +static FORCE_INLINE_ATTR size_t utf8_range_Validate(const char *data, + size_t len, + int return_position) +{ + if (len == 0) + return 1 - return_position; + // Save buffer start address for later use + const char *const data_original = data; + const char *const end = data + len; + data = utf8_range_SkipAscii(data, end); + /* SIMD algorithm always outperforms the naive version for any data of + length >=16. + */ + if (end - data < 16) + { + return (return_position ? (data - data_original) : 0) + + utf8_range_ValidateUTF8Naive(data, end, return_position); + } +#if defined(__SSE4_1__) || (defined(__ARM_NEON) && defined(__ARM_64BIT_STATE)) + return utf8_range_ValidateUTF8Simd(data_original, data, end, return_position); +#else + return (return_position ? (data - data_original) : 0) + + utf8_range_ValidateUTF8Naive(data, end, return_position); +#endif +} + +int utf8_range_IsValid(const char *data, size_t len) +{ + return utf8_range_Validate(data, len, /*return_position=*/0) != 0; +} + +size_t utf8_range_ValidPrefix(const char *data, size_t len) +{ + return utf8_range_Validate(data, len, /*return_position=*/1); +} + +} // namespace utf8_range +} // namespace sdk +OPENTELEMETRY_END_NAMESPACE diff --git a/sdk/src/common/internal/utf8_range/utf8_range.h b/sdk/src/common/internal/utf8_range/utf8_range.h new file mode 100644 index 0000000000..58d20f2b53 --- /dev/null +++ b/sdk/src/common/internal/utf8_range/utf8_range.h @@ -0,0 +1,24 @@ + +#pragma once + +#include + +#include + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace sdk +{ +namespace utf8_range +{ + +// Returns 1 if the sequence of characters is a valid UTF-8 sequence, otherwise +// 0. +int utf8_range_IsValid(const char *data, size_t len); + +// Returns the length in bytes of the prefix of str that is all +// structurally valid UTF-8. +size_t utf8_range_ValidPrefix(const char *data, size_t len); + +} // namespace utf8_range +} // namespace sdk +OPENTELEMETRY_END_NAMESPACE diff --git a/sdk/src/common/internal/utf8_range/utf8_range_neon.inc b/sdk/src/common/internal/utf8_range/utf8_range_neon.inc new file mode 100644 index 0000000000..d0e1e4b294 --- /dev/null +++ b/sdk/src/common/internal/utf8_range/utf8_range_neon.inc @@ -0,0 +1,126 @@ +#include + +/* This code is almost the same as SSE implementation, please reference + * utf8-range-sse.inc for detailed explanation. + * The only difference is the range adjustment step. NEON code is more + * straightforward. + */ + +static FORCE_INLINE_ATTR inline size_t utf8_range_ValidateUTF8Simd(const char *data_original, + const char *data, + const char *end, + int return_position) +{ + const uint8x16_t first_len_tbl = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, + }; + const uint8x16_t first_range_tbl = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8, + }; + const uint8x16_t range_min_tbl = { + 0x00, 0x80, 0x80, 0x80, 0xA0, 0x80, 0x90, 0x80, + 0xC2, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + }; + const uint8x16_t range_max_tbl = { + 0x7F, 0xBF, 0xBF, 0xBF, 0xBF, 0x9F, 0xBF, 0x8F, + 0xF4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }; + /* Range adjustment in NEON uint8x16x2 table. Note that lanes are interleaved + * in register. The table below is plotted vertically to ease understanding. + * The 1st column is for E0~EF, 2nd column for F0~FF. + */ + // clang-format off + const uint8_t range_adjust_tbl_data[] = { + /* index -> 0~15 16~31 <- index */ + /* E0 -> */ 2, 3, /* <- F0 */ + 0, 0, + 0, 0, + 0, 0, + 0, 4, /* <- F4 */ + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + 0, 0, + /* ED -> */ 3, 0, + 0, 0, + 0, 0, + }; + // clang-format on + const uint8x16x2_t range_adjust_tbl = vld2q_u8(range_adjust_tbl_data); + + const uint8x16_t const_1 = vdupq_n_u8(1); + const uint8x16_t const_2 = vdupq_n_u8(2); + const uint8x16_t const_e0 = vdupq_n_u8(0xE0); + + uint8x16_t prev_input = vdupq_n_u8(0); + uint8x16_t prev_first_len = vdupq_n_u8(0); + uint8x16_t error = vdupq_n_u8(0); + + while (end - data >= 16) + { + const uint8x16_t input = vld1q_u8((const uint8_t *)data); + + const uint8x16_t high_nibbles = vshrq_n_u8(input, 4); + + const uint8x16_t first_len = vqtbl1q_u8(first_len_tbl, high_nibbles); + + uint8x16_t range = vqtbl1q_u8(first_range_tbl, high_nibbles); + + range = vorrq_u8(range, vextq_u8(prev_first_len, first_len, 15)); + + uint8x16_t shift2 = vextq_u8(prev_first_len, first_len, 14); + shift2 = vqsubq_u8(shift2, const_1); + range = vorrq_u8(range, shift2); + + uint8x16_t shift3 = vextq_u8(prev_first_len, first_len, 13); + shift3 = vqsubq_u8(shift3, const_2); + range = vorrq_u8(range, shift3); + + uint8x16_t shift1 = vextq_u8(prev_input, input, 15); + shift1 = vsubq_u8(shift1, const_e0); + range = vaddq_u8(range, vqtbl2q_u8(range_adjust_tbl, shift1)); + + const uint8x16_t min_range = vqtbl1q_u8(range_min_tbl, range); + const uint8x16_t max_range = vqtbl1q_u8(range_max_tbl, range); + + if (return_position) + { + error = vcltq_u8(input, min_range); + error = vorrq_u8(error, vcgtq_u8(input, max_range)); + if (vmaxvq_u32(vreinterpretq_u32_u8(error))) + { + break; + } + } + else + { + error = vorrq_u8(error, vcltq_u8(input, min_range)); + error = vorrq_u8(error, vcgtq_u8(input, max_range)); + } + + prev_input = input; + prev_first_len = first_len; + + data += 16; + } + + if (return_position && data == data_original) + { + return utf8_range_ValidateUTF8Naive(data, end, return_position); + } + const int32_t prev = vgetq_lane_s32(vreinterpretq_s32_u8(prev_input), 3); + data -= utf8_range_CodepointSkipBackwards(prev); + if (return_position) + { + return (data - data_original) + utf8_range_ValidateUTF8Naive(data, end, return_position); + } + if (vmaxvq_u32(vreinterpretq_u32_u8(error))) + { + return 0; + } + return utf8_range_ValidateUTF8Naive(data, end, return_position); +} diff --git a/sdk/src/common/internal/utf8_range/utf8_range_sse.inc b/sdk/src/common/internal/utf8_range/utf8_range_sse.inc new file mode 100644 index 0000000000..6b6476a4e1 --- /dev/null +++ b/sdk/src/common/internal/utf8_range/utf8_range_sse.inc @@ -0,0 +1,274 @@ +#include +#include +#include + +static FORCE_INLINE_ATTR inline size_t utf8_range_ValidateUTF8Simd(const char *data_original, + const char *data, + const char *end, + int return_position) +{ + /* This code checks that utf-8 ranges are structurally valid 16 bytes at once + * using superscalar instructions. + * The mapping between ranges of codepoint and their corresponding utf-8 + * sequences is below. + */ + + /* + * U+0000...U+007F 00...7F + * U+0080...U+07FF C2...DF 80...BF + * U+0800...U+0FFF E0 A0...BF 80...BF + * U+1000...U+CFFF E1...EC 80...BF 80...BF + * U+D000...U+D7FF ED 80...9F 80...BF + * U+E000...U+FFFF EE...EF 80...BF 80...BF + * U+10000...U+3FFFF F0 90...BF 80...BF 80...BF + * U+40000...U+FFFFF F1...F3 80...BF 80...BF 80...BF + * U+100000...U+10FFFF F4 80...8F 80...BF 80...BF + */ + + /* First we compute the type for each byte, as given by the table below. + * This type will be used as an index later on. + */ + + /* + * Index Min Max Byte Type + * 0 00 7F Single byte sequence + * 1,2,3 80 BF Second, third and fourth byte for many of the sequences. + * 4 A0 BF Second byte after E0 + * 5 80 9F Second byte after ED + * 6 90 BF Second byte after F0 + * 7 80 8F Second byte after F4 + * 8 C2 F4 First non ASCII byte + * 9..15 7F 80 Invalid byte + */ + + /* After the first step we compute the index for all bytes, then we permute + the bytes according to their indices to check the ranges from the range + table. + * The range for a given type can be found in the range_min_table and + range_max_table, the range for type/index X is in range_min_table[X] ... + range_max_table[X]. + */ + + /* Algorithm: + * Put index zero to all bytes. + * Find all non ASCII characters, give them index 8. + * For each tail byte in a codepoint sequence, give it an index corresponding + to the 1 based index from the end. + * If the first byte of the codepoint is in the [C0...DF] range, we write + index 1 in the following byte. + * If the first byte of the codepoint is in the range [E0...EF], we write + indices 2 and 1 in the next two bytes. + * If the first byte of the codepoint is in the range [F0...FF] we write + indices 3,2,1 into the next three bytes. + * For finding the number of bytes we need to look at high nibbles (4 bits) + and do the lookup from the table, it can be done with shift by 4 + shuffle + instructions. We call it `first_len`. + * Then we shift first_len by 8 bits to get the indices of the 2nd bytes. + * Saturating sub 1 and shift by 8 bits to get the indices of the 3rd bytes. + * Again to get the indices of the 4th bytes. + * Take OR of all that 4 values and check within range. + */ + /* For example: + * input C3 80 68 E2 80 20 A6 F0 A0 80 AC 20 F0 93 80 80 + * first_len 1 0 0 2 0 0 0 3 0 0 0 0 3 0 0 0 + * 1st byte 8 0 0 8 0 0 0 8 0 0 0 0 8 0 0 0 + * 2nd byte 0 1 0 0 2 0 0 0 3 0 0 0 0 3 0 0 // Shift + sub + * 3rd byte 0 0 0 0 0 1 0 0 0 2 0 0 0 0 2 0 // Shift + sub + * 4th byte 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 // Shift + sub + * Index 8 1 0 8 2 1 0 8 3 2 1 0 8 3 2 1 // OR of results + */ + + /* Checking for errors: + * Error checking is done by looking up the high nibble (4 bits) of each byte + against an error checking table. + * Because the lookup value for the second byte depends of the value of the + first byte in codepoint, we use saturated operations to adjust the index. + * Specifically we need to add 2 for E0, 3 for ED, 3 for F0 and 4 for F4 to + match the correct index. + * If we subtract from all bytes EF then EO -> 241, ED -> 254, F0 -> 1, + F4 -> 5 + * Do saturating sub 240, then E0 -> 1, ED -> 14 and we can do lookup to + match the adjustment + * Add saturating 112, then F0 -> 113, F4 -> 117, all that were > 16 will + be more 128 and lookup in ef_fe_table will return 0 but for F0 + and F4 it will be 4 and 5 accordingly + */ + /* + * Then just check the appropriate ranges with greater/smaller equal + instructions. Check tail with a naive algorithm. + * To save from previous 16 byte checks we just align previous_first_len to + get correct continuations of the codepoints. + */ + + /* + * Map high nibble of "First Byte" to legal character length minus 1 + * 0x00 ~ 0xBF --> 0 + * 0xC0 ~ 0xDF --> 1 + * 0xE0 ~ 0xEF --> 2 + * 0xF0 ~ 0xFF --> 3 + */ + const __m128i first_len_table = _mm_setr_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3); + + /* Map "First Byte" to 8-th item of range table (0xC2 ~ 0xF4) */ + const __m128i first_range_table = _mm_setr_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 8, 8, 8); + + /* + * Range table, map range index to min and max values + */ + const __m128i range_min_table = _mm_setr_epi8(0x00, 0x80, 0x80, 0x80, 0xA0, 0x80, 0x90, 0x80, + 0xC2, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F); + + const __m128i range_max_table = _mm_setr_epi8(0x7F, 0xBF, 0xBF, 0xBF, 0xBF, 0x9F, 0xBF, 0x8F, + 0xF4, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80); + + /* + * Tables for fast handling of four special First Bytes(E0,ED,F0,F4), after + * which the Second Byte are not 80~BF. It contains "range index adjustment". + * +------------+---------------+------------------+----------------+ + * | First Byte | original range| range adjustment | adjusted range | + * +------------+---------------+------------------+----------------+ + * | E0 | 2 | 2 | 4 | + * +------------+---------------+------------------+----------------+ + * | ED | 2 | 3 | 5 | + * +------------+---------------+------------------+----------------+ + * | F0 | 3 | 3 | 6 | + * +------------+---------------+------------------+----------------+ + * | F4 | 4 | 4 | 8 | + * +------------+---------------+------------------+----------------+ + */ + + /* df_ee_table[1] -> E0, df_ee_table[14] -> ED as ED - E0 = 13 */ + // The values represent the adjustment in the Range Index table for a correct + // index. + const __m128i df_ee_table = _mm_setr_epi8(0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0); + + /* ef_fe_table[1] -> F0, ef_fe_table[5] -> F4, F4 - F0 = 4 */ + // The values represent the adjustment in the Range Index table for a correct + // index. + const __m128i ef_fe_table = _mm_setr_epi8(0, 3, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + + __m128i prev_input = _mm_set1_epi8(0); + __m128i prev_first_len = _mm_set1_epi8(0); + __m128i error = _mm_set1_epi8(0); + + while (end - data >= 16) + { + const __m128i input = _mm_loadu_si128((const __m128i *)(data)); + + /* high_nibbles = input >> 4 */ + const __m128i high_nibbles = _mm_and_si128(_mm_srli_epi16(input, 4), _mm_set1_epi8(0x0F)); + + /* first_len = legal character length minus 1 */ + /* 0 for 00~7F, 1 for C0~DF, 2 for E0~EF, 3 for F0~FF */ + /* first_len = first_len_table[high_nibbles] */ + __m128i first_len = _mm_shuffle_epi8(first_len_table, high_nibbles); + + /* First Byte: set range index to 8 for bytes within 0xC0 ~ 0xFF */ + /* range = first_range_table[high_nibbles] */ + __m128i range = _mm_shuffle_epi8(first_range_table, high_nibbles); + + /* Second Byte: set range index to first_len */ + /* 0 for 00~7F, 1 for C0~DF, 2 for E0~EF, 3 for F0~FF */ + /* range |= (first_len, prev_first_len) << 1 byte */ + range = _mm_or_si128(range, _mm_alignr_epi8(first_len, prev_first_len, 15)); + + /* Third Byte: set range index to saturate_sub(first_len, 1) */ + /* 0 for 00~7F, 0 for C0~DF, 1 for E0~EF, 2 for F0~FF */ + __m128i tmp1; + __m128i tmp2; + /* tmp1 = saturate_sub(first_len, 1) */ + tmp1 = _mm_subs_epu8(first_len, _mm_set1_epi8(1)); + /* tmp2 = saturate_sub(prev_first_len, 1) */ + tmp2 = _mm_subs_epu8(prev_first_len, _mm_set1_epi8(1)); + /* range |= (tmp1, tmp2) << 2 bytes */ + range = _mm_or_si128(range, _mm_alignr_epi8(tmp1, tmp2, 14)); + + /* Fourth Byte: set range index to saturate_sub(first_len, 2) */ + /* 0 for 00~7F, 0 for C0~DF, 0 for E0~EF, 1 for F0~FF */ + /* tmp1 = saturate_sub(first_len, 2) */ + tmp1 = _mm_subs_epu8(first_len, _mm_set1_epi8(2)); + /* tmp2 = saturate_sub(prev_first_len, 2) */ + tmp2 = _mm_subs_epu8(prev_first_len, _mm_set1_epi8(2)); + /* range |= (tmp1, tmp2) << 3 bytes */ + range = _mm_or_si128(range, _mm_alignr_epi8(tmp1, tmp2, 13)); + + /* + * Now we have below range indices calculated + * Correct cases: + * - 8 for C0~FF + * - 3 for 1st byte after F0~FF + * - 2 for 1st byte after E0~EF or 2nd byte after F0~FF + * - 1 for 1st byte after C0~DF or 2nd byte after E0~EF or + * 3rd byte after F0~FF + * - 0 for others + * Error cases: + * >9 for non ascii First Byte overlapping + * E.g., F1 80 C2 90 --> 8 3 10 2, where 10 indicates error + */ + + /* Adjust Second Byte range for special First Bytes(E0,ED,F0,F4) */ + /* Overlaps lead to index 9~15, which are illegal in range table */ + __m128i shift1; + __m128i pos; + __m128i range2; + /* shift1 = (input, prev_input) << 1 byte */ + shift1 = _mm_alignr_epi8(input, prev_input, 15); + pos = _mm_sub_epi8(shift1, _mm_set1_epi8(0xEF)); + /* + * shift1: | EF F0 ... FE | FF 00 ... ... DE | DF E0 ... EE | + * pos: | 0 1 15 | 16 17 239| 240 241 255| + * pos-240: | 0 0 0 | 0 0 0 | 0 1 15 | + * pos+112: | 112 113 127| >= 128 | >= 128 | + */ + tmp1 = _mm_subs_epu8(pos, _mm_set1_epi8(-16)); + range2 = _mm_shuffle_epi8(df_ee_table, tmp1); + tmp2 = _mm_adds_epu8(pos, _mm_set1_epi8(112)); + range2 = _mm_add_epi8(range2, _mm_shuffle_epi8(ef_fe_table, tmp2)); + + range = _mm_add_epi8(range, range2); + + /* Load min and max values per calculated range index */ + __m128i min_range = _mm_shuffle_epi8(range_min_table, range); + __m128i max_range = _mm_shuffle_epi8(range_max_table, range); + + /* Check value range */ + if (return_position) + { + error = _mm_cmplt_epi8(input, min_range); + error = _mm_or_si128(error, _mm_cmpgt_epi8(input, max_range)); + /* 5% performance drop from this conditional branch */ + if (!_mm_testz_si128(error, error)) + { + break; + } + } + else + { + error = _mm_or_si128(error, _mm_cmplt_epi8(input, min_range)); + error = _mm_or_si128(error, _mm_cmpgt_epi8(input, max_range)); + } + + prev_input = input; + prev_first_len = first_len; + + data += 16; + } + /* If we got to the end, we don't need to skip any bytes backwards */ + if (return_position && data == data_original) + { + return utf8_range_ValidateUTF8Naive(data, end, return_position); + } + /* Find previous codepoint (not 80~BF) */ + data -= utf8_range_CodepointSkipBackwards(_mm_extract_epi32(prev_input, 3)); + if (return_position) + { + return (data - data_original) + utf8_range_ValidateUTF8Naive(data, end, return_position); + } + /* Test if there was any error */ + if (!_mm_testz_si128(error, error)) + { + return 0; + } + /* Check the tail */ + return utf8_range_ValidateUTF8Naive(data, end, return_position); +} diff --git a/sdk/src/resource/BUILD b/sdk/src/resource/BUILD index 8845629990..1d3d840f47 100644 --- a/sdk/src/resource/BUILD +++ b/sdk/src/resource/BUILD @@ -10,6 +10,7 @@ cc_library( deps = [ "//api", "//sdk:headers", + "//sdk/src/common:attribute_validity", "//sdk/src/common:env_variables", ], ) diff --git a/sdk/src/resource/resource.cc b/sdk/src/resource/resource.cc index 5ae5446e80..2bf1e8c851 100644 --- a/sdk/src/resource/resource.cc +++ b/sdk/src/resource/resource.cc @@ -6,6 +6,8 @@ #include #include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/common/attribute_validity.h" +#include "opentelemetry/sdk/common/global_log_handler.h" #include "opentelemetry/sdk/resource/resource.h" #include "opentelemetry/sdk/resource/resource_detector.h" #include "opentelemetry/sdk/version/version.h" @@ -22,7 +24,20 @@ namespace resource Resource::Resource(const ResourceAttributes &attributes, const std::string &schema_url) noexcept : attributes_(attributes), schema_url_(schema_url) -{} +{ + attributes_.reserve(attributes.size()); + for (auto &kv : attributes) + { + if (!common::AttributeValidator::IsValid(kv.second)) + { + OTEL_INTERNAL_LOG_WARN("[Resource] Invalid attribute value for: " + << kv.first << ". This attribute will be ignored."); + continue; + } + + attributes_[kv.first] = kv.second; + } +} Resource Resource::Merge(const Resource &other) const noexcept { @@ -43,7 +58,8 @@ Resource Resource::Create(const ResourceAttributes &attributes, const std::strin std::string default_service_name = "unknown_service"; auto it_process_executable_name = resource.attributes_.find(semconv::process::kProcessExecutableName); - if (it_process_executable_name != resource.attributes_.end()) + if (it_process_executable_name != resource.attributes_.end() && + nostd::holds_alternative(it_process_executable_name->second)) { default_service_name += ":" + nostd::get(it_process_executable_name->second); } diff --git a/sdk/src/trace/BUILD b/sdk/src/trace/BUILD index 7262a1c0a0..67f5fbdede 100644 --- a/sdk/src/trace/BUILD +++ b/sdk/src/trace/BUILD @@ -11,6 +11,7 @@ cc_library( deps = [ "//api", "//sdk:headers", + "//sdk/src/common:attribute_validity", "//sdk/src/common:disabled", "//sdk/src/common:global_log_handler", "//sdk/src/common:random", diff --git a/sdk/src/trace/span.cc b/sdk/src/trace/span.cc index 3509b164da..b2068a65eb 100644 --- a/sdk/src/trace/span.cc +++ b/sdk/src/trace/span.cc @@ -5,6 +5,8 @@ #include #include "opentelemetry/nostd/function_ref.h" +#include "opentelemetry/sdk/common/attribute_validity.h" +#include "opentelemetry/sdk/common/global_log_handler.h" #include "opentelemetry/sdk/trace/processor.h" #include "opentelemetry/sdk/trace/recordable.h" #include "opentelemetry/trace/span_id.h" @@ -106,6 +108,13 @@ void Span::SetAttribute(nostd::string_view key, const common::AttributeValue &va return; } + if (!sdk::common::AttributeValidator::IsValid(value)) + { + OTEL_INTERNAL_LOG_WARN("[Trace Span] Invalid span attribute value for: " + << key << ". This attribute will be ignored."); + return; + } + recordable_->SetAttribute(key, value); } @@ -161,7 +170,7 @@ void Span::AddLink(const opentelemetry::trace::SpanContext &target, return; } - recordable_->AddLink(target, attrs); + recordable_->AddLink(target, common::KeyValueFilterIterable(attrs, "[Trace Span Link] ")); } void Span::AddLinks(const opentelemetry::trace::SpanContextKeyValueIterable &links) noexcept diff --git a/sdk/test/instrumentationscope/BUILD b/sdk/test/instrumentationscope/BUILD index 39a61564a7..4c053bf65b 100644 --- a/sdk/test/instrumentationscope/BUILD +++ b/sdk/test/instrumentationscope/BUILD @@ -10,6 +10,7 @@ cc_test( deps = [ "//api", "//sdk:headers", + "//sdk/src/common:attribute_validity", "@com_google_googletest//:gtest_main", ], ) diff --git a/sdk/test/instrumentationscope/CMakeLists.txt b/sdk/test/instrumentationscope/CMakeLists.txt index 659728300b..1743836ec4 100644 --- a/sdk/test/instrumentationscope/CMakeLists.txt +++ b/sdk/test/instrumentationscope/CMakeLists.txt @@ -5,8 +5,9 @@ include(GoogleTest) foreach(testname instrumentationscope_test) add_executable(${testname} "${testname}.cc") - target_link_libraries(${testname} ${GTEST_BOTH_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} opentelemetry_sdk) + target_link_libraries( + ${testname} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} + opentelemetry_common opentelemetry_sdk) gtest_add_tests( TARGET ${testname} TEST_PREFIX instrumentationscope. From b5299037961263fdd61eef23a1e81e171be8b7a5 Mon Sep 17 00:00:00 2001 From: owent Date: Mon, 14 Jul 2025 14:53:36 +0800 Subject: [PATCH 02/23] Fixes styles and copyright --- .../sdk/common/attribute_validity.h | 8 +++----- sdk/src/common/attribute_validity.cc | 5 +++++ .../common/internal/utf8_range/uft8_range.cc | 17 ++++++++++++----- sdk/src/common/internal/utf8_range/utf8_range.h | 2 ++ .../internal/utf8_range/utf8_range_neon.inc | 3 +++ .../internal/utf8_range/utf8_range_sse.inc | 3 +++ sdk/src/resource/resource.cc | 1 + 7 files changed, 29 insertions(+), 10 deletions(-) diff --git a/sdk/include/opentelemetry/sdk/common/attribute_validity.h b/sdk/include/opentelemetry/sdk/common/attribute_validity.h index 4ee992aaf2..638451b41b 100644 --- a/sdk/include/opentelemetry/sdk/common/attribute_validity.h +++ b/sdk/include/opentelemetry/sdk/common/attribute_validity.h @@ -3,18 +3,16 @@ #pragma once +#include #include -#include -#include #include -#include -#include #include #include "opentelemetry/common/attribute_value.h" #include "opentelemetry/common/key_value_iterable.h" +#include "opentelemetry/nostd/function_ref.h" +#include "opentelemetry/nostd/span.h" #include "opentelemetry/nostd/string_view.h" -#include "opentelemetry/nostd/variant.h" #include "opentelemetry/sdk/common/attribute_utils.h" #include "opentelemetry/version.h" diff --git a/sdk/src/common/attribute_validity.cc b/sdk/src/common/attribute_validity.cc index 51a7e5990c..d3e0880623 100644 --- a/sdk/src/common/attribute_validity.cc +++ b/sdk/src/common/attribute_validity.cc @@ -3,8 +3,13 @@ #include "opentelemetry/sdk/common/attribute_validity.h" +#include +#include +#include #include +#include +#include "opentelemetry/nostd/variant.h" #include "opentelemetry/sdk/common/global_log_handler.h" #include "opentelemetry/version.h" diff --git a/sdk/src/common/internal/utf8_range/uft8_range.cc b/sdk/src/common/internal/utf8_range/uft8_range.cc index 72bf57f46f..6a91ce9b3d 100644 --- a/sdk/src/common/internal/utf8_range/uft8_range.cc +++ b/sdk/src/common/internal/utf8_range/uft8_range.cc @@ -1,4 +1,5 @@ -// Copyright 2023 Google LLC +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 // // Use of this source code is governed by an MIT-style // license that can be found in the LICENSE file or at @@ -17,10 +18,11 @@ */ #include "src/common/internal/utf8_range/utf8_range.h" -#include #include #include +#include "opentelemetry/version.h" + #if defined(__GNUC__) # define FORCE_INLINE_ATTR __attribute__((always_inline)) inline #elif defined(_MSC_VER) @@ -42,14 +44,19 @@ static FORCE_INLINE_ATTR uint64_t utf8_range_UnalignedLoad64(const void *p) return t; } -static FORCE_INLINE_ATTR int utf8_range_AsciiIsAscii(unsigned char c) +static FORCE_INLINE_ATTR bool utf8_range_AsciiIsAscii(unsigned char c) { return c < 128; } -static FORCE_INLINE_ATTR int utf8_range_IsTrailByteOk(const char c) +static FORCE_INLINE_ATTR bool utf8_range_IsTrailByteOk(const char c) +{ + return static_cast(c) <= static_cast(0xBF); +} + +static FORCE_INLINE_ATTR bool utf8_range_IsTrailByteOk(const unsigned char c) { - return (int8_t)(c) <= (int8_t)(0xBF); + return utf8_range_IsTrailByteOk(static_cast(c)); } /* If return_position is false then it returns 1 if |data| is a valid utf8 diff --git a/sdk/src/common/internal/utf8_range/utf8_range.h b/sdk/src/common/internal/utf8_range/utf8_range.h index 58d20f2b53..1b77e0b2ab 100644 --- a/sdk/src/common/internal/utf8_range/utf8_range.h +++ b/sdk/src/common/internal/utf8_range/utf8_range.h @@ -1,3 +1,5 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 #pragma once diff --git a/sdk/src/common/internal/utf8_range/utf8_range_neon.inc b/sdk/src/common/internal/utf8_range/utf8_range_neon.inc index d0e1e4b294..b1a8729549 100644 --- a/sdk/src/common/internal/utf8_range/utf8_range_neon.inc +++ b/sdk/src/common/internal/utf8_range/utf8_range_neon.inc @@ -1,3 +1,6 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + #include /* This code is almost the same as SSE implementation, please reference diff --git a/sdk/src/common/internal/utf8_range/utf8_range_sse.inc b/sdk/src/common/internal/utf8_range/utf8_range_sse.inc index 6b6476a4e1..90e5deb70e 100644 --- a/sdk/src/common/internal/utf8_range/utf8_range_sse.inc +++ b/sdk/src/common/internal/utf8_range/utf8_range_sse.inc @@ -1,3 +1,6 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + #include #include #include diff --git a/sdk/src/resource/resource.cc b/sdk/src/resource/resource.cc index 2bf1e8c851..57ed752b37 100644 --- a/sdk/src/resource/resource.cc +++ b/sdk/src/resource/resource.cc @@ -1,6 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +#include #include #include #include From c924a76d86cd1f457287d1979540ee98bb98fd6f Mon Sep 17 00:00:00 2001 From: owent Date: Mon, 14 Jul 2025 15:06:58 +0800 Subject: [PATCH 03/23] Fixes type in `utf8_range_IsTrailByteOk` --- .../common/internal/utf8_range/uft8_range.cc | 18 +++++++----------- sdk/src/resource/resource.cc | 2 +- sdk/src/trace/span.cc | 3 ++- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/sdk/src/common/internal/utf8_range/uft8_range.cc b/sdk/src/common/internal/utf8_range/uft8_range.cc index 6a91ce9b3d..3ceb4c4505 100644 --- a/sdk/src/common/internal/utf8_range/uft8_range.cc +++ b/sdk/src/common/internal/utf8_range/uft8_range.cc @@ -49,14 +49,9 @@ static FORCE_INLINE_ATTR bool utf8_range_AsciiIsAscii(unsigned char c) return c < 128; } -static FORCE_INLINE_ATTR bool utf8_range_IsTrailByteOk(const char c) +static FORCE_INLINE_ATTR bool utf8_range_IsTrailByteOk(unsigned char c) { - return static_cast(c) <= static_cast(0xBF); -} - -static FORCE_INLINE_ATTR bool utf8_range_IsTrailByteOk(const unsigned char c) -{ - return utf8_range_IsTrailByteOk(static_cast(c)); + return c <= static_cast(0xBF); } /* If return_position is false then it returns 1 if |data| is a valid utf8 @@ -98,7 +93,8 @@ static size_t utf8_range_ValidateUTF8Naive(const char *data, const char *end, in continue; } /* [C2..DF], [80..BF] -> 2 bytes */ - if (len >= 2 && byte1 >= 0xC2 && byte1 <= 0xDF && utf8_range_IsTrailByteOk(data[1])) + if (len >= 2 && byte1 >= 0xC2 && byte1 <= 0xDF && + utf8_range_IsTrailByteOk(static_cast(data[1]))) { codepoint_bytes = 2; continue; @@ -168,15 +164,15 @@ static size_t utf8_range_ValidateUTF8Naive(const char *data, const char *end, in static inline int utf8_range_CodepointSkipBackwards(int32_t codepoint_word) { const int8_t *const codepoint = (const int8_t *)(&codepoint_word); - if (!utf8_range_IsTrailByteOk(codepoint[3])) + if (!utf8_range_IsTrailByteOk(static_cast(codepoint[3]))) { return 1; } - else if (!utf8_range_IsTrailByteOk(codepoint[2])) + else if (!utf8_range_IsTrailByteOk(static_cast(codepoint[2]))) { return 2; } - else if (!utf8_range_IsTrailByteOk(codepoint[1])) + else if (!utf8_range_IsTrailByteOk(static_cast(codepoint[1]))) { return 3; } diff --git a/sdk/src/resource/resource.cc b/sdk/src/resource/resource.cc index 57ed752b37..010851b6e6 100644 --- a/sdk/src/resource/resource.cc +++ b/sdk/src/resource/resource.cc @@ -24,7 +24,7 @@ namespace resource { Resource::Resource(const ResourceAttributes &attributes, const std::string &schema_url) noexcept - : attributes_(attributes), schema_url_(schema_url) + : schema_url_(schema_url) { attributes_.reserve(attributes.size()); for (auto &kv : attributes) diff --git a/sdk/src/trace/span.cc b/sdk/src/trace/span.cc index b2068a65eb..a69872f04a 100644 --- a/sdk/src/trace/span.cc +++ b/sdk/src/trace/span.cc @@ -170,7 +170,8 @@ void Span::AddLink(const opentelemetry::trace::SpanContext &target, return; } - recordable_->AddLink(target, common::KeyValueFilterIterable(attrs, "[Trace Span Link] ")); + recordable_->AddLink( + target, opentelemetry::sdk::common::KeyValueFilterIterable(attrs, "[Trace Span Link] ")); } void Span::AddLinks(const opentelemetry::trace::SpanContextKeyValueIterable &links) noexcept From d89343ca9f6ecd37db38e6717e29bd5943e415ee Mon Sep 17 00:00:00 2001 From: owent Date: Mon, 14 Jul 2025 20:32:33 +0800 Subject: [PATCH 04/23] Fixes IWYU and clang-tidy warnings --- sdk/src/common/attribute_validity.cc | 31 +++++++++++++++++++++++++--- sdk/src/trace/span.cc | 1 + 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/sdk/src/common/attribute_validity.cc b/sdk/src/common/attribute_validity.cc index d3e0880623..4410c1f9e9 100644 --- a/sdk/src/common/attribute_validity.cc +++ b/sdk/src/common/attribute_validity.cc @@ -5,7 +5,6 @@ #include #include -#include #include #include @@ -37,13 +36,39 @@ OPENTELEMETRY_EXPORT bool AttributeIsValidString(nostd::string_view value) noexc OPENTELEMETRY_EXPORT bool AttributeValidator::IsValid(const OwnedAttributeValue &value) noexcept { - return nostd::visit(GetSharedAttributeValidator(), value); +#if OPENTELEMETRY_HAVE_EXCEPTIONS + try + { +#endif + + return nostd::visit(GetSharedAttributeValidator(), value); + +#if OPENTELEMETRY_HAVE_EXCEPTIONS + } + catch (...) + { + return false; + } +#endif } OPENTELEMETRY_EXPORT bool AttributeValidator::IsValid( const opentelemetry::common::AttributeValue &value) noexcept { - return nostd::visit(GetSharedAttributeValidator(), value); +#if OPENTELEMETRY_HAVE_EXCEPTIONS + try + { +#endif + + return nostd::visit(GetSharedAttributeValidator(), value); + +#if OPENTELEMETRY_HAVE_EXCEPTIONS + } + catch (...) + { + return false; + } +#endif } OPENTELEMETRY_EXPORT bool AttributeValidator::IsAllValid(const AttributeMap &attributes) noexcept diff --git a/sdk/src/trace/span.cc b/sdk/src/trace/span.cc index a69872f04a..c869613570 100644 --- a/sdk/src/trace/span.cc +++ b/sdk/src/trace/span.cc @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 #include +#include #include #include "opentelemetry/nostd/function_ref.h" From d800b205d46ebdc57167fb62d58832d4d91bcb14 Mon Sep 17 00:00:00 2001 From: owent Date: Fri, 18 Jul 2025 17:23:14 +0800 Subject: [PATCH 05/23] Add unit tests for resources and trace span --- .../otlp/src/otlp_populate_attribute_utils.cc | 47 +++++++++++-- .../sdk/common/attribute_validity.h | 4 ++ sdk/src/common/attribute_validity.cc | 38 +++++++++-- sdk/src/resource/resource.cc | 9 ++- sdk/src/trace/span.cc | 32 ++++++--- sdk/test/resource/resource_test.cc | 30 +++++++++ sdk/test/trace/tracer_test.cc | 66 +++++++++++++++++++ 7 files changed, 206 insertions(+), 20 deletions(-) diff --git a/exporters/otlp/src/otlp_populate_attribute_utils.cc b/exporters/otlp/src/otlp_populate_attribute_utils.cc index bc9a7d618a..0e78176e58 100644 --- a/exporters/otlp/src/otlp_populate_attribute_utils.cc +++ b/exporters/otlp/src/otlp_populate_attribute_utils.cc @@ -13,6 +13,7 @@ #include "opentelemetry/nostd/string_view.h" #include "opentelemetry/nostd/variant.h" #include "opentelemetry/sdk/common/attribute_utils.h" +#include "opentelemetry/sdk/common/attribute_validity.h" #include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" #include "opentelemetry/sdk/resource/resource.h" #include "opentelemetry/version.h" @@ -85,8 +86,18 @@ void OtlpPopulateAttributeUtils::PopulateAnyValue( } else if (nostd::holds_alternative(value)) { - proto_value->set_string_value(nostd::get(value).data(), - nostd::get(value).size()); + if (allow_bytes && + !opentelemetry::sdk::common::AttributeIsValidString(nostd::get(value))) + { + proto_value->set_bytes_value( + reinterpret_cast(nostd::get(value).data()), + nostd::get(value).size()); + } + else + { + proto_value->set_string_value(nostd::get(value).data(), + nostd::get(value).size()); + } } else if (nostd::holds_alternative>(value)) { @@ -159,7 +170,15 @@ void OtlpPopulateAttributeUtils::PopulateAnyValue( auto array_value = proto_value->mutable_array_value(); for (const auto &val : nostd::get>(value)) { - array_value->add_values()->set_string_value(val.data(), val.size()); + if (allow_bytes && !opentelemetry::sdk::common::AttributeIsValidString(val)) + { + array_value->add_values()->set_bytes_value(reinterpret_cast(val.data()), + val.size()); + } + else + { + array_value->add_values()->set_string_value(val.data(), val.size()); + } } } } @@ -224,7 +243,17 @@ void OtlpPopulateAttributeUtils::PopulateAnyValue( } else if (nostd::holds_alternative(value)) { - proto_value->set_string_value(nostd::get(value)); + if (allow_bytes && + !opentelemetry::sdk::common::AttributeIsValidString(nostd::get(value))) + { + proto_value->set_bytes_value( + reinterpret_cast(nostd::get(value).data()), + nostd::get(value).size()); + } + else + { + proto_value->set_string_value(nostd::get(value)); + } } else if (nostd::holds_alternative>(value)) { @@ -281,7 +310,15 @@ void OtlpPopulateAttributeUtils::PopulateAnyValue( auto array_value = proto_value->mutable_array_value(); for (const auto &val : nostd::get>(value)) { - array_value->add_values()->set_string_value(val); + if (allow_bytes && !opentelemetry::sdk::common::AttributeIsValidString(val)) + { + array_value->add_values()->set_bytes_value(reinterpret_cast(val.data()), + val.size()); + } + else + { + array_value->add_values()->set_string_value(val); + } } } } diff --git a/sdk/include/opentelemetry/sdk/common/attribute_validity.h b/sdk/include/opentelemetry/sdk/common/attribute_validity.h index 638451b41b..3e7bbfcaac 100644 --- a/sdk/include/opentelemetry/sdk/common/attribute_validity.h +++ b/sdk/include/opentelemetry/sdk/common/attribute_validity.h @@ -75,6 +75,10 @@ struct AttributeValidator bool operator()(const std::vector & /*v*/) noexcept { return true; } bool operator()(const std::vector & /*v*/) noexcept { return true; } + OPENTELEMETRY_EXPORT static bool IsValid(const std::string &value) noexcept; + + OPENTELEMETRY_EXPORT static bool IsValid(nostd::string_view value) noexcept; + OPENTELEMETRY_EXPORT static bool IsValid(const OwnedAttributeValue &value) noexcept; OPENTELEMETRY_EXPORT static bool IsValid( diff --git a/sdk/src/common/attribute_validity.cc b/sdk/src/common/attribute_validity.cc index 4410c1f9e9..6772b3d072 100644 --- a/sdk/src/common/attribute_validity.cc +++ b/sdk/src/common/attribute_validity.cc @@ -34,6 +34,16 @@ OPENTELEMETRY_EXPORT bool AttributeIsValidString(nostd::string_view value) noexc return 0 != utf8_range::utf8_range_IsValid(value.data(), value.size()); } +OPENTELEMETRY_EXPORT bool AttributeValidator::IsValid(const std::string &value) noexcept +{ + return AttributeIsValidString(value); +} + +OPENTELEMETRY_EXPORT bool AttributeValidator::IsValid(nostd::string_view value) noexcept +{ + return AttributeIsValidString(value); +} + OPENTELEMETRY_EXPORT bool AttributeValidator::IsValid(const OwnedAttributeValue &value) noexcept { #if OPENTELEMETRY_HAVE_EXCEPTIONS @@ -102,9 +112,18 @@ OPENTELEMETRY_EXPORT void AttributeValidator::Filter(AttributeMap &attributes, std::unordered_set invalid_keys; for (auto &kv : attributes) { + if (!common::AttributeValidator::IsValid(kv.first)) + { + OTEL_INTERNAL_LOG_WARN(log_hint << " Invalid attribute key " << kv.first + << ". This attribute will be ignored."); + + invalid_keys.insert(kv.first); + continue; + } + if (!common::AttributeValidator::IsValid(kv.second)) { - OTEL_INTERNAL_LOG_WARN(log_hint << " Invalid attribute value for: " << kv.first + OTEL_INTERNAL_LOG_WARN(log_hint << " Invalid attribute value for " << kv.first << ". This attribute will be ignored."); invalid_keys.insert(kv.first); @@ -123,9 +142,18 @@ OPENTELEMETRY_EXPORT void AttributeValidator::Filter(OrderedAttributeMap &attrib std::unordered_set invalid_keys; for (auto &kv : attributes) { + if (!common::AttributeValidator::IsValid(kv.first)) + { + OTEL_INTERNAL_LOG_WARN(log_hint << " Invalid attribute key " << kv.first + << ". This attribute will be ignored."); + + invalid_keys.insert(kv.first); + continue; + } + if (!common::AttributeValidator::IsValid(kv.second)) { - OTEL_INTERNAL_LOG_WARN(log_hint << " Invalid attribute value for: " << kv.first + OTEL_INTERNAL_LOG_WARN(log_hint << " Invalid attribute value for " << kv.first << ". This attribute will be ignored."); invalid_keys.insert(kv.first); @@ -155,7 +183,7 @@ bool KeyValueFilterIterable::ForEachKeyValue( bool ret = origin_->ForEachKeyValue([&size, &callback, this](opentelemetry::nostd::string_view k, opentelemetry::common::AttributeValue v) { - if (AttributeValidator::IsValid(v)) + if (AttributeValidator::IsValid(k) && AttributeValidator::IsValid(v)) { ++size; return callback(k, v); @@ -184,8 +212,8 @@ size_t KeyValueFilterIterable::size() const noexcept size_t size = 0; origin_->ForEachKeyValue( - [&size](opentelemetry::nostd::string_view, opentelemetry::common::AttributeValue v) { - if (AttributeValidator::IsValid(v)) + [&size](opentelemetry::nostd::string_view k, opentelemetry::common::AttributeValue v) { + if (AttributeValidator::IsValid(k) && AttributeValidator::IsValid(v)) { ++size; } diff --git a/sdk/src/resource/resource.cc b/sdk/src/resource/resource.cc index 010851b6e6..2c40321618 100644 --- a/sdk/src/resource/resource.cc +++ b/sdk/src/resource/resource.cc @@ -29,9 +29,16 @@ Resource::Resource(const ResourceAttributes &attributes, const std::string &sche attributes_.reserve(attributes.size()); for (auto &kv : attributes) { + if (!common::AttributeValidator::IsValid(kv.first)) + { + OTEL_INTERNAL_LOG_WARN("[Resource] Invalid attribute key " + << kv.first << ". This attribute will be ignored."); + continue; + } + if (!common::AttributeValidator::IsValid(kv.second)) { - OTEL_INTERNAL_LOG_WARN("[Resource] Invalid attribute value for: " + OTEL_INTERNAL_LOG_WARN("[Resource] Invalid attribute value for " << kv.first << ". This attribute will be ignored."); continue; } diff --git a/sdk/src/trace/span.cc b/sdk/src/trace/span.cc index c869613570..daa25d5b4e 100644 --- a/sdk/src/trace/span.cc +++ b/sdk/src/trace/span.cc @@ -78,14 +78,17 @@ Span::Span(std::shared_ptr &&tracer, recordable_->SetTraceFlags(span_context_->trace_flags()); - attributes.ForEachKeyValue([&](nostd::string_view key, common::AttributeValue value) noexcept { - recordable_->SetAttribute(key, value); - return true; - }); + opentelemetry::sdk::common::KeyValueFilterIterable attributes_filter(attributes, "[Trace Span] "); + attributes_filter.ForEachKeyValue( + [&](nostd::string_view key, common::AttributeValue value) noexcept { + recordable_->SetAttribute(key, value); + return true; + }); links.ForEachKeyValue([&](const opentelemetry::trace::SpanContext &span_context, const common::KeyValueIterable &attributes) { - recordable_->AddLink(span_context, attributes); + recordable_->AddLink(span_context, opentelemetry::sdk::common::KeyValueFilterIterable( + attributes, "[Trace Span Link] ")); return true; }); @@ -109,9 +112,16 @@ void Span::SetAttribute(nostd::string_view key, const common::AttributeValue &va return; } + if (!sdk::common::AttributeValidator::IsValid(key)) + { + OTEL_INTERNAL_LOG_WARN("[Trace Span] Invalid span attribute key " + << key << ". This attribute will be ignored."); + return; + } + if (!sdk::common::AttributeValidator::IsValid(value)) { - OTEL_INTERNAL_LOG_WARN("[Trace Span] Invalid span attribute value for: " + OTEL_INTERNAL_LOG_WARN("[Trace Span] Invalid span attribute value for " << key << ". This attribute will be ignored."); return; } @@ -146,7 +156,8 @@ void Span::AddEvent(nostd::string_view name, const common::KeyValueIterable &att { return; } - recordable_->AddEvent(name, attributes); + recordable_->AddEvent( + name, opentelemetry::sdk::common::KeyValueFilterIterable(attributes, "[Trace Span Event] ")); } void Span::AddEvent(nostd::string_view name, @@ -158,7 +169,9 @@ void Span::AddEvent(nostd::string_view name, { return; } - recordable_->AddEvent(name, timestamp, attributes); + recordable_->AddEvent( + name, timestamp, + opentelemetry::sdk::common::KeyValueFilterIterable(attributes, "[Trace Span Event] ")); } #if OPENTELEMETRY_ABI_VERSION_NO >= 2 @@ -185,7 +198,8 @@ void Span::AddLinks(const opentelemetry::trace::SpanContextKeyValueIterable &lin links.ForEachKeyValue([&](const opentelemetry::trace::SpanContext &span_context, const common::KeyValueIterable &attributes) { - recordable_->AddLink(span_context, attributes); + recordable_->AddLink(span_context, opentelemetry::sdk::common::KeyValueFilterIterable( + attributes, "[Trace Span Link] ")); return true; }); } diff --git a/sdk/test/resource/resource_test.cc b/sdk/test/resource/resource_test.cc index 696509f892..07f04b0bd4 100644 --- a/sdk/test/resource/resource_test.cc +++ b/sdk/test/resource/resource_test.cc @@ -145,6 +145,36 @@ TEST(ResourceTest, create_with_schemaurl) EXPECT_EQ(received_schema_url, schema_url); } +TEST(ResourceTest, create_with_invalid_attributes) +{ + ResourceAttributes expected_attributes = { + {semconv::telemetry::kTelemetrySdkLanguage, "cpp"}, + {semconv::telemetry::kTelemetrySdkName, "opentelemetry"}, + {semconv::telemetry::kTelemetrySdkVersion, OPENTELEMETRY_SDK_VERSION}, + {semconv::service::kServiceName, "unknown_service"}, + }; + ResourceAttributes attributes = { + {semconv::telemetry::kTelemetrySdkLanguage, "cpp"}, + {semconv::telemetry::kTelemetrySdkName, "opentelemetry"}, + {semconv::telemetry::kTelemetrySdkVersion, OPENTELEMETRY_SDK_VERSION}, + {semconv::service::kServiceName, "unknown_service"}, + {"invalid_key\xff", "valid_value"}, + {"valid_key", "invalid_value\xff"}, + }; + auto resource = Resource::Create(attributes); + auto received_attributes = resource.GetAttributes(); + for (auto &e : received_attributes) + { + EXPECT_TRUE(expected_attributes.find(e.first) != expected_attributes.end()); + if (expected_attributes.find(e.first) != expected_attributes.end()) + { + EXPECT_EQ(opentelemetry::nostd::get(expected_attributes.find(e.first)->second), + opentelemetry::nostd::get(e.second)); + } + } + EXPECT_EQ(received_attributes.size(), expected_attributes.size()); +} + TEST(ResourceTest, Merge) { TestResource resource1(ResourceAttributes({{"service", "backend"}})); diff --git a/sdk/test/trace/tracer_test.cc b/sdk/test/trace/tracer_test.cc index 6e70c0130e..2c5314176f 100644 --- a/sdk/test/trace/tracer_test.cc +++ b/sdk/test/trace/tracer_test.cc @@ -398,6 +398,27 @@ TEST(Tracer, StartSpanWithAttributesCopy) ASSERT_EQ("c", strings[2]); } +TEST(Tracer, StartSpanWithInvalidAttributes) +{ + InMemorySpanExporter *exporter = new InMemorySpanExporter(); + std::shared_ptr span_data = exporter->GetData(); + auto tracer = initTracer(std::unique_ptr{exporter}); + + { + tracer + ->StartSpan("span 1", + { + {"attr1", "value1"}, + {"invalid_key\xff", "valid_value"}, + {"valid_key", "invalid_value\xff"}, + }) + ->End(); + } + + auto spans = span_data->GetSpans(); + ASSERT_EQ(1, spans.size()); +} + TEST(Tracer, GetSampler) { auto resource = Resource::Create({}); @@ -586,6 +607,30 @@ TEST(Tracer, StartSpanWithCustomConfig) #endif } +TEST(Tracer, SpanSetEventsWithInvalidAttributes) +{ + InMemorySpanExporter *exporter = new InMemorySpanExporter(); + std::shared_ptr span_data = exporter->GetData(); + auto tracer = initTracer(std::unique_ptr{exporter}); + + auto span = tracer->StartSpan("span 1"); + span->AddEvent("event 3", std::chrono::system_clock::now(), + { + {"attr1", 1}, + {"invalid_key\xff", "valid_value"}, + {"valid_key", "invalid_value\xff"}, + }); + span->End(); + + auto spans = span_data->GetSpans(); + ASSERT_EQ(1, spans.size()); + + auto &span_data_events = spans.at(0)->GetEvents(); + ASSERT_EQ(1, span_data_events.size()); + ASSERT_EQ("event 3", span_data_events[0].GetName()); + ASSERT_EQ(1, span_data_events[0].GetAttributes().size()); +} + TEST(Tracer, StartSpanWithCustomConfigDifferingConditionOrder) { std::shared_ptr noop_tracer = @@ -707,6 +752,27 @@ TEST(Tracer, SpanSetLinks) ASSERT_EQ(nostd::get(link2.GetAttributes().at("attr3")), "3"); ASSERT_EQ(nostd::get(link2.GetAttributes().at("attr4")), "4"); } + + { + + // Span link with invalid attributes + tracer + ->StartSpan("efg", {{"attr1", 1}}, + {{SpanContext(false, false), + { + {"attr2", 2}, + {"invalid_key\xff", "valid_value"}, + {"valid_key", "invalid_value\xff"}, + }}}) + ->End(); + auto spans = span_data->GetSpans(); + ASSERT_EQ(1, spans.size()); + + auto &span_data_links = spans.at(0)->GetLinks(); + ASSERT_EQ(1, span_data_links.size()); + auto link = span_data_links.at(0); + ASSERT_EQ(nostd::get(link.GetAttributes().at("attr2")), 2); + } } #if OPENTELEMETRY_ABI_VERSION_NO >= 2 From 823fbfb3978b2d3f00dd7dc65450b6c74e5334ff Mon Sep 17 00:00:00 2001 From: owent Date: Sat, 19 Jul 2025 16:45:52 +0800 Subject: [PATCH 06/23] Add CHANGELOG --- CHANGELOG.md | 3 ++ .../instrumentation_scope.h | 18 +++++++- .../sdk/metrics/view/attributes_processor.h | 8 +++- .../instrumentationscope_test.cc | 34 ++++++++++++++ sdk/test/metrics/meter_test.cc | 44 +++++++++++++++++++ 5 files changed, 103 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 877a0b6b6c..24dc4fdfe1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,9 @@ Increment the: * [SDK] Implements options for the ParentBasedSampler with default values [#3553](https://github.com/open-telemetry/opentelemetry-cpp/pull/3553) +* [SDK] Add bundle version of utf8_range to validate attributes + [#3512](https://github.com/open-telemetry/opentelemetry-cpp/pull/3512) + ## [1.22 2025-07-11] * [DOC] Udpate link to membership document diff --git a/sdk/include/opentelemetry/sdk/instrumentationscope/instrumentation_scope.h b/sdk/include/opentelemetry/sdk/instrumentationscope/instrumentation_scope.h index 6fc28da92b..2b18e9dc35 100644 --- a/sdk/include/opentelemetry/sdk/instrumentationscope/instrumentation_scope.h +++ b/sdk/include/opentelemetry/sdk/instrumentationscope/instrumentation_scope.h @@ -102,9 +102,16 @@ class InstrumentationScope result->attributes_.reserve(opentelemetry::nostd::size(arg)); for (auto &argv : arg) { + if (!common::AttributeValidator::IsValid(argv.first)) + { + OTEL_INTERNAL_LOG_WARN("[InstrumentationScope] Invalid attribute key " + << std::string{argv.first} << ". This attribute will be ignored."); + continue; + } + if (!common::AttributeValidator::IsValid(argv.second)) { - OTEL_INTERNAL_LOG_WARN("[InstrumentationScope] Invalid attribute value for: " + OTEL_INTERNAL_LOG_WARN("[InstrumentationScope] Invalid attribute value for " << std::string{argv.first} << ". This attribute will be ignored."); continue; } @@ -168,9 +175,16 @@ class InstrumentationScope void SetAttribute(nostd::string_view key, const opentelemetry::common::AttributeValue &value) noexcept { + if (!common::AttributeValidator::IsValid(key)) + { + OTEL_INTERNAL_LOG_WARN("[InstrumentationScope] Invalid attribute key " + << std::string{key} << ". This attribute will be ignored."); + return; + } + if (!common::AttributeValidator::IsValid(value)) { - OTEL_INTERNAL_LOG_WARN("[InstrumentationScope] Invalid attribute value for: " + OTEL_INTERNAL_LOG_WARN("[InstrumentationScope] Invalid attribute value for " << std::string{key} << ". This attribute will be ignored."); return; } diff --git a/sdk/include/opentelemetry/sdk/metrics/view/attributes_processor.h b/sdk/include/opentelemetry/sdk/metrics/view/attributes_processor.h index 7ab8cafb13..ae2d140d46 100644 --- a/sdk/include/opentelemetry/sdk/metrics/view/attributes_processor.h +++ b/sdk/include/opentelemetry/sdk/metrics/view/attributes_processor.h @@ -10,6 +10,7 @@ #include "opentelemetry/common/attribute_value.h" #include "opentelemetry/common/key_value_iterable.h" #include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/sdk/common/attribute_validity.h" #include "opentelemetry/sdk/metrics/state/filtered_ordered_attribute_map.h" #include "opentelemetry/version.h" @@ -50,7 +51,8 @@ class DefaultAttributesProcessor : public AttributesProcessor MetricAttributes process( const opentelemetry::common::KeyValueIterable &attributes) const noexcept override { - MetricAttributes result(attributes); + MetricAttributes result( + opentelemetry::sdk::common::KeyValueFilterIterable(attributes, "[Metrics] ")); return result; } @@ -78,7 +80,9 @@ class FilteringAttributesProcessor : public AttributesProcessor const opentelemetry::common::KeyValueIterable &attributes) const noexcept override { MetricAttributes result; - attributes.ForEachKeyValue( + opentelemetry::sdk::common::KeyValueFilterIterable validate_attributes{attributes, + "[Metrics] "}; + validate_attributes.ForEachKeyValue( [&](nostd::string_view key, opentelemetry::common::AttributeValue value) noexcept { if (allowed_attribute_keys_.find(key.data()) != allowed_attribute_keys_.end()) { diff --git a/sdk/test/instrumentationscope/instrumentationscope_test.cc b/sdk/test/instrumentationscope/instrumentationscope_test.cc index 3d3bf057c5..c5c8474e2b 100644 --- a/sdk/test/instrumentationscope/instrumentationscope_test.cc +++ b/sdk/test/instrumentationscope/instrumentationscope_test.cc @@ -61,6 +61,21 @@ TEST(InstrumentationScope, CreateInstrumentationScope) } } +TEST(InstrumentationScope, CreateInstrumentationScopeWithInvalidAttributes) +{ + std::string library_name = "opentelemetry-cpp"; + std::string library_version = "0.1.0"; + std::string schema_url = "https://opentelemetry.io/schemas/1.2.0"; + uint32_t attrubite_value3[] = {7, 8, 9}; + auto instrumentation_scope = + InstrumentationScope::Create(library_name, library_version, schema_url, + {{"attribute-key1", "attribute-value"}, + {"invalid-key\xff", "valid-value"}, + {"valid-key", "invalid-value\xff"}}); + + EXPECT_EQ(instrumentation_scope->GetAttributes().size(), 1); +} + TEST(InstrumentationScope, CreateInstrumentationScopeWithLoopForAttributes) { std::string library_name = "opentelemetry-cpp"; @@ -195,6 +210,25 @@ TEST(InstrumentationScope, SetAttribute) } } +TEST(InstrumentationScope, SetInvalidAttribute) +{ + std::string library_name = "opentelemetry-cpp"; + std::string library_version = "0.1.0"; + std::string schema_url = "https://opentelemetry.io/schemas/1.2.0"; + auto instrumentation_scope = + InstrumentationScope::Create(library_name, library_version, schema_url); + + EXPECT_EQ(instrumentation_scope->GetName(), library_name); + EXPECT_EQ(instrumentation_scope->GetVersion(), library_version); + EXPECT_EQ(instrumentation_scope->GetSchemaURL(), schema_url); + EXPECT_EQ(instrumentation_scope->GetAttributes().size(), 0); + + instrumentation_scope->SetAttribute("attribute-key1", "attribute-value"); + instrumentation_scope->SetAttribute("invalid-key\xff", "valid-value"); + instrumentation_scope->SetAttribute("valid-key", "invalid-value\xff"); + EXPECT_EQ(instrumentation_scope->GetAttributes().size(), 1); +} + TEST(InstrumentationScope, LegacyInstrumentationLibrary) { diff --git a/sdk/test/metrics/meter_test.cc b/sdk/test/metrics/meter_test.cc index a4212996a3..bfb48c061c 100644 --- a/sdk/test/metrics/meter_test.cc +++ b/sdk/test/metrics/meter_test.cc @@ -656,6 +656,50 @@ TEST_F(MeterCreateInstrumentTest, ViewCorrectedDuplicateSyncInstrumentsByDescrip }); } +TEST_F(MeterCreateInstrumentTest, SyncInstrumentWithInvalidAttributes) +{ + InstrumentDescriptor descriptor{"my_counter", "desc", "unit", InstrumentType::kCounter, + InstrumentValueType::kDouble}; + AddDescriptionCorrectionView(descriptor.name_, descriptor.unit_, descriptor.type_, + descriptor.description_); + + auto counter1 = meter_->CreateDoubleCounter("my_counter", "desc", "unit"); + counter1->Add( + 1, + {{"key", "value1"}, {"invalid-key\xff", "valid-value"}, {"valid-key", "invalid-value\xff"}}); + + metric_reader_ptr_->Collect([this](ResourceMetrics &metric_data) { + EXPECT_EQ(metric_data.scope_metric_data_.size(), 1); + // only one metric_data object expected after correction with the view + EXPECT_EQ(metric_data.scope_metric_data_[0].metric_data_.size(), 1); + EXPECT_EQ(metric_data.scope_metric_data_[0].metric_data_[0].point_data_attr_.size(), 1); + return true; + }); +} + +TEST_F(MeterCreateInstrumentTest, AsyncInstrumentWithInvalidAttributes) +{ + auto observable_counter1 = + meter_->CreateInt64ObservableCounter("observable_counter", "desc", "unit"); + auto callback1 = [](opentelemetry::metrics::ObserverResult observer, void * /* state */) { + auto observer_long = + nostd::get>>(observer); + observer_long->Observe(12, {{"key", "value1"}, + {"invalid-key\xff", "valid-value"}, + {"valid-key", "invalid-value\xff"}}); + }; + + observable_counter1->AddCallback(callback1, nullptr); + + metric_reader_ptr_->Collect([this](ResourceMetrics &metric_data) { + EXPECT_EQ(metric_data.scope_metric_data_.size(), 1); + EXPECT_EQ(metric_data.scope_metric_data_[0].metric_data_.size(), 1); + auto &point_data_attr = metric_data.scope_metric_data_[0].metric_data_[0].point_data_attr_; + EXPECT_EQ(point_data_attr.size(), 1); + return true; + }); +} + TEST_F(MeterCreateInstrumentTest, IdenticalAsyncInstruments) { auto observable_counter1 = From 1702bc56c21e7999b561dd1f1f96a3449bb411f8 Mon Sep 17 00:00:00 2001 From: owent Date: Sat, 19 Jul 2025 17:26:34 +0800 Subject: [PATCH 07/23] Fixes warnings --- sdk/test/metrics/meter_test.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/test/metrics/meter_test.cc b/sdk/test/metrics/meter_test.cc index bfb48c061c..df25ce4d86 100644 --- a/sdk/test/metrics/meter_test.cc +++ b/sdk/test/metrics/meter_test.cc @@ -668,7 +668,7 @@ TEST_F(MeterCreateInstrumentTest, SyncInstrumentWithInvalidAttributes) 1, {{"key", "value1"}, {"invalid-key\xff", "valid-value"}, {"valid-key", "invalid-value\xff"}}); - metric_reader_ptr_->Collect([this](ResourceMetrics &metric_data) { + metric_reader_ptr_->Collect([](ResourceMetrics &metric_data) { EXPECT_EQ(metric_data.scope_metric_data_.size(), 1); // only one metric_data object expected after correction with the view EXPECT_EQ(metric_data.scope_metric_data_[0].metric_data_.size(), 1); @@ -691,7 +691,7 @@ TEST_F(MeterCreateInstrumentTest, AsyncInstrumentWithInvalidAttributes) observable_counter1->AddCallback(callback1, nullptr); - metric_reader_ptr_->Collect([this](ResourceMetrics &metric_data) { + metric_reader_ptr_->Collect([](ResourceMetrics &metric_data) { EXPECT_EQ(metric_data.scope_metric_data_.size(), 1); EXPECT_EQ(metric_data.scope_metric_data_[0].metric_data_.size(), 1); auto &point_data_attr = metric_data.scope_metric_data_[0].metric_data_[0].point_data_attr_; From d0b4bfed7d445b9795f03340e0a67e2c047e3c5a Mon Sep 17 00:00:00 2001 From: owent Date: Sat, 19 Jul 2025 17:48:12 +0800 Subject: [PATCH 08/23] Fixes a ununsed warning --- sdk/test/instrumentationscope/instrumentationscope_test.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/sdk/test/instrumentationscope/instrumentationscope_test.cc b/sdk/test/instrumentationscope/instrumentationscope_test.cc index c5c8474e2b..c48520e623 100644 --- a/sdk/test/instrumentationscope/instrumentationscope_test.cc +++ b/sdk/test/instrumentationscope/instrumentationscope_test.cc @@ -66,7 +66,6 @@ TEST(InstrumentationScope, CreateInstrumentationScopeWithInvalidAttributes) std::string library_name = "opentelemetry-cpp"; std::string library_version = "0.1.0"; std::string schema_url = "https://opentelemetry.io/schemas/1.2.0"; - uint32_t attrubite_value3[] = {7, 8, 9}; auto instrumentation_scope = InstrumentationScope::Create(library_name, library_version, schema_url, {{"attribute-key1", "attribute-value"}, From 339c7b6400b22917b1ad50b421d9ce285c926624 Mon Sep 17 00:00:00 2001 From: owent Date: Fri, 15 Aug 2025 19:14:13 +0800 Subject: [PATCH 09/23] Fixes cppcheck warning --- sdk/include/opentelemetry/sdk/common/attribute_validity.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/include/opentelemetry/sdk/common/attribute_validity.h b/sdk/include/opentelemetry/sdk/common/attribute_validity.h index 3e7bbfcaac..634dfdc364 100644 --- a/sdk/include/opentelemetry/sdk/common/attribute_validity.h +++ b/sdk/include/opentelemetry/sdk/common/attribute_validity.h @@ -36,7 +36,7 @@ struct AttributeValidator bool operator()(uint64_t /*v*/) noexcept { return true; } bool operator()(double /*v*/) noexcept { return true; } bool operator()(nostd::string_view v) noexcept { return AttributeIsValidString(v); } - bool operator()(std::string v) noexcept { return AttributeIsValidString(v); } + bool operator()(const std::string &v) noexcept { return AttributeIsValidString(v); } bool operator()(const char *v) noexcept { return AttributeIsValidString(v); } bool operator()(nostd::span /*v*/) noexcept { return true; } bool operator()(nostd::span /*v*/) noexcept { return true; } From ff587083a8874d73092272c9bbaeb05a057cd036 Mon Sep 17 00:00:00 2001 From: owent Date: Sat, 30 Aug 2025 13:19:52 +0800 Subject: [PATCH 10/23] Fixes inline --- sdk/src/common/internal/utf8_range/utf8_range_neon.inc | 8 ++++---- sdk/src/common/internal/utf8_range/utf8_range_sse.inc | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sdk/src/common/internal/utf8_range/utf8_range_neon.inc b/sdk/src/common/internal/utf8_range/utf8_range_neon.inc index b1a8729549..dc8220a776 100644 --- a/sdk/src/common/internal/utf8_range/utf8_range_neon.inc +++ b/sdk/src/common/internal/utf8_range/utf8_range_neon.inc @@ -9,10 +9,10 @@ * straightforward. */ -static FORCE_INLINE_ATTR inline size_t utf8_range_ValidateUTF8Simd(const char *data_original, - const char *data, - const char *end, - int return_position) +static FORCE_INLINE_ATTR size_t utf8_range_ValidateUTF8Simd(const char *data_original, + const char *data, + const char *end, + int return_position) { const uint8x16_t first_len_tbl = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, diff --git a/sdk/src/common/internal/utf8_range/utf8_range_sse.inc b/sdk/src/common/internal/utf8_range/utf8_range_sse.inc index 90e5deb70e..e791db0b21 100644 --- a/sdk/src/common/internal/utf8_range/utf8_range_sse.inc +++ b/sdk/src/common/internal/utf8_range/utf8_range_sse.inc @@ -5,10 +5,10 @@ #include #include -static FORCE_INLINE_ATTR inline size_t utf8_range_ValidateUTF8Simd(const char *data_original, - const char *data, - const char *end, - int return_position) +static FORCE_INLINE_ATTR size_t utf8_range_ValidateUTF8Simd(const char *data_original, + const char *data, + const char *end, + int return_position) { /* This code checks that utf-8 ranges are structurally valid 16 bytes at once * using superscalar instructions. From 83cb1d314532a2405f527df9e19c7a19cf3a27da Mon Sep 17 00:00:00 2001 From: owent Date: Fri, 26 Sep 2025 17:31:47 +0800 Subject: [PATCH 11/23] Fixes markdownlint --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea55bdcf54..6d4d4d19c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,6 @@ Increment the: * [TEST] Remove workaround for metrics cardinality limit test [#3663](https://github.com/open-telemetry/opentelemetry-cpp/pull/3663) - ## [1.23 2025-09-25] * [CodeHealth] Fix clang-tidy warnings part 6 From e1af8720aff23619a60bff07ee323c005b0831a3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Oct 2025 15:02:07 +0100 Subject: [PATCH 12/23] Bump github/codeql-action from 4.30.9 to 4.31.0 (#3720) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.30.9 to 4.31.0. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/16140ae1a102900babc80a33c44059580f687047...4e94bd11f71e507f7f87df81788dff88d1dacbfb) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 4.31.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 6 +++--- .github/workflows/ossf-scorecard.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 9b32b93993..14eb276057 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -37,10 +37,10 @@ jobs: run: | sudo -E ./ci/setup_ci_environment.sh - name: Initialize CodeQL - uses: github/codeql-action/init@16140ae1a102900babc80a33c44059580f687047 # v4.30.9 + uses: github/codeql-action/init@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v4.31.0 with: languages: cpp - name: Autobuild - uses: github/codeql-action/autobuild@16140ae1a102900babc80a33c44059580f687047 # v4.30.9 + uses: github/codeql-action/autobuild@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v4.31.0 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@16140ae1a102900babc80a33c44059580f687047 # v4.30.9 + uses: github/codeql-action/analyze@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v4.31.0 diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index 508a5b79b3..7ace984e37 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -47,6 +47,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard (optional). # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@16140ae1a102900babc80a33c44059580f687047 # v4.30.9 + uses: github/codeql-action/upload-sarif@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v4.31.0 with: sarif_file: results.sarif From 29324becdf6c84de308fdae2ecf7348cf24dfc23 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Oct 2025 17:55:15 +0100 Subject: [PATCH 13/23] Bump actions/download-artifact from 5.0.0 to 6.0.0 (#3719) Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 5.0.0 to 6.0.0. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/634f93cb2916e3fdff6788551b99b062d0335ce0...018cc2cf5baa6db3ef3c5f8a56943fffe632ef53) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-version: 6.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/benchmark.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 3c65ea2035..7be1ddbdbb 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -60,7 +60,7 @@ jobs: egress-policy: audit - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - - uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # main March 2025 + - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # main March 2025 with: name: benchmark_results path: benchmarks From 1f0fb5839128072f41a1e3f04dd51248f88eda1b Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Mon, 27 Oct 2025 23:45:16 +0100 Subject: [PATCH 14/23] [CONFIGURATION] File configuration - prometheus translation (#3715) --- CHANGELOG.md | 3 ++ .../prometheus/src/prometheus_pull_builder.cc | 34 ++++++++++++- .../shelltests/kitchen-sink.test | 1 + .../prometheus_translation_broken.test | 8 +++ .../prometheus_translation_broken.yaml | 15 ++++++ .../shelltests/prometheus_translation_no.test | 10 ++++ .../shelltests/prometheus_translation_no.yaml | 17 +++++++ .../prometheus_translation_no_utf8.test | 9 ++++ .../prometheus_translation_no_utf8.yaml | 14 ++++++ .../prometheus_translation_with_suffixes.test | 8 +++ .../prometheus_translation_with_suffixes.yaml | 14 ++++++ ...ometheus_translation_without_suffixes.test | 8 +++ ...ometheus_translation_without_suffixes.yaml | 14 ++++++ .../src/test_exporters_prometheus_builder.cc | 8 ++- .../sdk/configuration/configuration_parser.h | 4 ++ ...theus_pull_metric_exporter_configuration.h | 7 +-- .../sdk/configuration/translation_strategy.h | 28 +++++++++++ sdk/src/configuration/configuration_parser.cc | 49 +++++++++++++++++-- sdk/test/configuration/yaml_metrics_test.cc | 27 +++++++--- 19 files changed, 257 insertions(+), 21 deletions(-) create mode 100644 functional/configuration/shelltests/prometheus_translation_broken.test create mode 100644 functional/configuration/shelltests/prometheus_translation_broken.yaml create mode 100644 functional/configuration/shelltests/prometheus_translation_no.test create mode 100644 functional/configuration/shelltests/prometheus_translation_no.yaml create mode 100644 functional/configuration/shelltests/prometheus_translation_no_utf8.test create mode 100644 functional/configuration/shelltests/prometheus_translation_no_utf8.yaml create mode 100644 functional/configuration/shelltests/prometheus_translation_with_suffixes.test create mode 100644 functional/configuration/shelltests/prometheus_translation_with_suffixes.yaml create mode 100644 functional/configuration/shelltests/prometheus_translation_without_suffixes.test create mode 100644 functional/configuration/shelltests/prometheus_translation_without_suffixes.yaml create mode 100644 sdk/include/opentelemetry/sdk/configuration/translation_strategy.h diff --git a/CHANGELOG.md b/CHANGELOG.md index 17c7eab092..b9c334575e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,9 @@ Increment the: * [CI] Upgrade tools/vcpkg to 2025.09.17 [#3701](https://github.com/open-telemetry/opentelemetry-cpp/pull/3701) +* [CONFIGURATION] File configuration - prometheus translation + [#3715](https://github.com/open-telemetry/opentelemetry-cpp/pull/3715) + ## [1.23 2025-09-25] * [CodeHealth] Fix clang-tidy warnings part 6 diff --git a/exporters/prometheus/src/prometheus_pull_builder.cc b/exporters/prometheus/src/prometheus_pull_builder.cc index 18cf814051..245a30f38e 100644 --- a/exporters/prometheus/src/prometheus_pull_builder.cc +++ b/exporters/prometheus/src/prometheus_pull_builder.cc @@ -8,9 +8,11 @@ #include "opentelemetry/exporters/prometheus/exporter_factory.h" #include "opentelemetry/exporters/prometheus/exporter_options.h" #include "opentelemetry/exporters/prometheus/prometheus_pull_builder.h" +#include "opentelemetry/sdk/common/global_log_handler.h" #include "opentelemetry/sdk/configuration/prometheus_pull_metric_exporter_builder.h" #include "opentelemetry/sdk/configuration/prometheus_pull_metric_exporter_configuration.h" #include "opentelemetry/sdk/configuration/registry.h" +#include "opentelemetry/sdk/configuration/translation_strategy.h" #include "opentelemetry/sdk/metrics/metric_reader.h" #include "opentelemetry/version.h" @@ -38,8 +40,36 @@ std::unique_ptr PrometheusPullBuilder options.url = url; options.populate_target_info = true; options.without_otel_scope = model->without_scope_info; - options.without_units = model->without_units; - options.without_type_suffix = model->without_type_suffix; + + switch (model->translation_strategy) + { + case sdk::configuration::TranslationStrategy::UnderscoreEscapingWithSuffixes: + options.without_units = false; + options.without_type_suffix = false; + break; + case sdk::configuration::TranslationStrategy::UnderscoreEscapingWithoutSuffixes: + options.without_units = true; + options.without_type_suffix = true; + break; + case sdk::configuration::TranslationStrategy::NoUTF8EscapingWithSuffixes: + // FIXME: no flag to disable UnderscoreEscaping + OTEL_INTERNAL_LOG_WARN("[Prometheus Exporter] NoUTF8EscapingWithSuffixes not supported"); + options.without_units = false; + options.without_type_suffix = false; + break; + case sdk::configuration::TranslationStrategy::NoTranslation: + // FIXME: no flag to disable UnderscoreEscaping + OTEL_INTERNAL_LOG_WARN("[Prometheus Exporter] NoTranslation not supported"); + options.without_units = true; + options.without_type_suffix = true; + break; + } + + if (model->with_resource_constant_labels != nullptr) + { + // FIXME: with_resource_constant_labels + OTEL_INTERNAL_LOG_WARN("[Prometheus Exporter] with_resource_constant_labels not supported"); + } return PrometheusExporterFactory::Create(options); } diff --git a/functional/configuration/shelltests/kitchen-sink.test b/functional/configuration/shelltests/kitchen-sink.test index b4e3c1f66d..1b14dd2843 100644 --- a/functional/configuration/shelltests/kitchen-sink.test +++ b/functional/configuration/shelltests/kitchen-sink.test @@ -6,6 +6,7 @@ $ example_yaml --test --yaml shelltests/kitchen-sink.yaml | egrep -v "(observed_ MODEL PARSED [WARNING] attribute_limits not supported, ignoring [WARNING] IncludeExclude attribute processor not supported, ignoring +[WARNING] [Prometheus Exporter] with_resource_constant_labels not supported [WARNING] metric producer not supported, ignoring [WARNING] metric producer not supported, ignoring [WARNING] [Periodic Exporting Metric Reader] Invalid configuration: export_timeout_millis_ should be less than export_interval_millis_, using default values diff --git a/functional/configuration/shelltests/prometheus_translation_broken.test b/functional/configuration/shelltests/prometheus_translation_broken.test new file mode 100644 index 0000000000..29eaa94153 --- /dev/null +++ b/functional/configuration/shelltests/prometheus_translation_broken.test @@ -0,0 +1,8 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +$ example_yaml --test --yaml shelltests/prometheus_translation_broken.yaml +> +[ERROR] :9[10](164): Illegal TranslationStrategy: broken +FAILED TO PARSE MODEL +>= 1 diff --git a/functional/configuration/shelltests/prometheus_translation_broken.yaml b/functional/configuration/shelltests/prometheus_translation_broken.yaml new file mode 100644 index 0000000000..655d7b59cf --- /dev/null +++ b/functional/configuration/shelltests/prometheus_translation_broken.yaml @@ -0,0 +1,15 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +file_format: "1.0" + +meter_provider: + readers: + - pull: + exporter: + prometheus/development: + host: localhost + port: 9464 + without_scope_info: false + # Must fail, invalid + translation_strategy: broken diff --git a/functional/configuration/shelltests/prometheus_translation_no.test b/functional/configuration/shelltests/prometheus_translation_no.test new file mode 100644 index 0000000000..f263713471 --- /dev/null +++ b/functional/configuration/shelltests/prometheus_translation_no.test @@ -0,0 +1,10 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +$ example_yaml --test --yaml shelltests/prometheus_translation_no.yaml +> +MODEL PARSED +[WARNING] [Prometheus Exporter] NoTranslation not supported +[WARNING] [Prometheus Exporter] with_resource_constant_labels not supported +SDK CREATED +>= 0 diff --git a/functional/configuration/shelltests/prometheus_translation_no.yaml b/functional/configuration/shelltests/prometheus_translation_no.yaml new file mode 100644 index 0000000000..189b89c335 --- /dev/null +++ b/functional/configuration/shelltests/prometheus_translation_no.yaml @@ -0,0 +1,17 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +file_format: "1.0" + +meter_provider: + readers: + - pull: + exporter: + prometheus/development: + host: localhost + port: 9464 + without_scope_info: false + translation_strategy: NoTranslation + with_resource_constant_labels: + included: + - "not supported" diff --git a/functional/configuration/shelltests/prometheus_translation_no_utf8.test b/functional/configuration/shelltests/prometheus_translation_no_utf8.test new file mode 100644 index 0000000000..253a1e9aef --- /dev/null +++ b/functional/configuration/shelltests/prometheus_translation_no_utf8.test @@ -0,0 +1,9 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +$ example_yaml --test --yaml shelltests/prometheus_translation_no_utf8.yaml +> +MODEL PARSED +[WARNING] [Prometheus Exporter] NoUTF8EscapingWithSuffixes not supported +SDK CREATED +>= 0 diff --git a/functional/configuration/shelltests/prometheus_translation_no_utf8.yaml b/functional/configuration/shelltests/prometheus_translation_no_utf8.yaml new file mode 100644 index 0000000000..2fcd54f9ce --- /dev/null +++ b/functional/configuration/shelltests/prometheus_translation_no_utf8.yaml @@ -0,0 +1,14 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +file_format: "1.0" + +meter_provider: + readers: + - pull: + exporter: + prometheus/development: + host: localhost + port: 9464 + without_scope_info: false + translation_strategy: NoUTF8EscapingWithSuffixes diff --git a/functional/configuration/shelltests/prometheus_translation_with_suffixes.test b/functional/configuration/shelltests/prometheus_translation_with_suffixes.test new file mode 100644 index 0000000000..90d20d4258 --- /dev/null +++ b/functional/configuration/shelltests/prometheus_translation_with_suffixes.test @@ -0,0 +1,8 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +$ example_yaml --test --yaml shelltests/prometheus_translation_with_suffixes.yaml +> +MODEL PARSED +SDK CREATED +>= 0 diff --git a/functional/configuration/shelltests/prometheus_translation_with_suffixes.yaml b/functional/configuration/shelltests/prometheus_translation_with_suffixes.yaml new file mode 100644 index 0000000000..3403c89648 --- /dev/null +++ b/functional/configuration/shelltests/prometheus_translation_with_suffixes.yaml @@ -0,0 +1,14 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +file_format: "1.0" + +meter_provider: + readers: + - pull: + exporter: + prometheus/development: + host: localhost + port: 9464 + without_scope_info: false + translation_strategy: UnderscoreEscapingWithSuffixes diff --git a/functional/configuration/shelltests/prometheus_translation_without_suffixes.test b/functional/configuration/shelltests/prometheus_translation_without_suffixes.test new file mode 100644 index 0000000000..89391906fc --- /dev/null +++ b/functional/configuration/shelltests/prometheus_translation_without_suffixes.test @@ -0,0 +1,8 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +$ example_yaml --test --yaml shelltests/prometheus_translation_without_suffixes.yaml +> +MODEL PARSED +SDK CREATED +>= 0 diff --git a/functional/configuration/shelltests/prometheus_translation_without_suffixes.yaml b/functional/configuration/shelltests/prometheus_translation_without_suffixes.yaml new file mode 100644 index 0000000000..3d8e7b36f2 --- /dev/null +++ b/functional/configuration/shelltests/prometheus_translation_without_suffixes.yaml @@ -0,0 +1,14 @@ +# Copyright The OpenTelemetry Authors +# SPDX-License-Identifier: Apache-2.0 + +file_format: "1.0" + +meter_provider: + readers: + - pull: + exporter: + prometheus/development: + host: localhost + port: 9464 + without_scope_info: false + translation_strategy: UnderscoreEscapingWithoutSuffixes diff --git a/install/test/src/test_exporters_prometheus_builder.cc b/install/test/src/test_exporters_prometheus_builder.cc index 231b526f7a..0f5781683b 100644 --- a/install/test/src/test_exporters_prometheus_builder.cc +++ b/install/test/src/test_exporters_prometheus_builder.cc @@ -11,11 +11,9 @@ TEST(ExportersPrometheusBuilderInstall, PrometheusPullBuilder) ASSERT_TRUE(builder != nullptr); opentelemetry::sdk::configuration::PrometheusPullMetricExporterConfiguration model; - model.host = "localhost"; - model.port = 1234; - model.without_scope_info = false; - model.without_units = false; - model.without_type_suffix = false; + model.host = "localhost"; + model.port = 1234; + model.without_scope_info = false; auto exporter = builder->Build(&model); ASSERT_TRUE(exporter != nullptr); diff --git a/sdk/include/opentelemetry/sdk/configuration/configuration_parser.h b/sdk/include/opentelemetry/sdk/configuration/configuration_parser.h index 3ed39aef69..eb2c7252a7 100644 --- a/sdk/include/opentelemetry/sdk/configuration/configuration_parser.h +++ b/sdk/include/opentelemetry/sdk/configuration/configuration_parser.h @@ -84,6 +84,7 @@ #include "opentelemetry/sdk/configuration/temporality_preference.h" #include "opentelemetry/sdk/configuration/trace_id_ratio_based_sampler_configuration.h" #include "opentelemetry/sdk/configuration/tracer_provider_configuration.h" +#include "opentelemetry/sdk/configuration/translation_strategy.h" #include "opentelemetry/sdk/configuration/view_configuration.h" #include "opentelemetry/sdk/configuration/view_selector_configuration.h" #include "opentelemetry/sdk/configuration/view_stream_configuration.h" @@ -171,6 +172,9 @@ class ConfigurationParser std::unique_ptr ParseConsolePushMetricExporterConfiguration(const std::unique_ptr &node) const; + TranslationStrategy ParseTranslationStrategy(const std::unique_ptr &node, + const std::string &name) const; + std::unique_ptr ParsePrometheusPullMetricExporterConfiguration(const std::unique_ptr &node) const; diff --git a/sdk/include/opentelemetry/sdk/configuration/prometheus_pull_metric_exporter_configuration.h b/sdk/include/opentelemetry/sdk/configuration/prometheus_pull_metric_exporter_configuration.h index 99b4fbcc85..296e55d36e 100644 --- a/sdk/include/opentelemetry/sdk/configuration/prometheus_pull_metric_exporter_configuration.h +++ b/sdk/include/opentelemetry/sdk/configuration/prometheus_pull_metric_exporter_configuration.h @@ -6,8 +6,10 @@ #include #include "opentelemetry/sdk/configuration/headers_configuration.h" +#include "opentelemetry/sdk/configuration/include_exclude_configuration.h" #include "opentelemetry/sdk/configuration/pull_metric_exporter_configuration.h" #include "opentelemetry/sdk/configuration/pull_metric_exporter_configuration_visitor.h" +#include "opentelemetry/sdk/configuration/translation_strategy.h" #include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE @@ -28,10 +30,9 @@ class PrometheusPullMetricExporterConfiguration : public PullMetricExporterConfi std::string host; std::size_t port{0}; - bool without_units{false}; - bool without_type_suffix{false}; bool without_scope_info{false}; - // FIXME: with_resource_constant_labels; + std::unique_ptr with_resource_constant_labels; + TranslationStrategy translation_strategy; }; } // namespace configuration diff --git a/sdk/include/opentelemetry/sdk/configuration/translation_strategy.h b/sdk/include/opentelemetry/sdk/configuration/translation_strategy.h new file mode 100644 index 0000000000..e6f1244b91 --- /dev/null +++ b/sdk/include/opentelemetry/sdk/configuration/translation_strategy.h @@ -0,0 +1,28 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +#pragma once + +#include + +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace sdk +{ +namespace configuration +{ + +// YAML-SCHEMA: schema/meter_provider.json +// YAML-NODE: ExperimentalPrometheusMetricExporter +enum class TranslationStrategy : std::uint8_t +{ + UnderscoreEscapingWithSuffixes, + UnderscoreEscapingWithoutSuffixes, + NoUTF8EscapingWithSuffixes, + NoTranslation +}; + +} // namespace configuration +} // namespace sdk +OPENTELEMETRY_END_NAMESPACE diff --git a/sdk/src/configuration/configuration_parser.cc b/sdk/src/configuration/configuration_parser.cc index 014ce84886..1ff55fa262 100644 --- a/sdk/src/configuration/configuration_parser.cc +++ b/sdk/src/configuration/configuration_parser.cc @@ -91,6 +91,7 @@ #include "opentelemetry/sdk/configuration/temporality_preference.h" #include "opentelemetry/sdk/configuration/trace_id_ratio_based_sampler_configuration.h" #include "opentelemetry/sdk/configuration/tracer_provider_configuration.h" +#include "opentelemetry/sdk/configuration/translation_strategy.h" #include "opentelemetry/sdk/configuration/view_configuration.h" #include "opentelemetry/sdk/configuration/view_selector_configuration.h" #include "opentelemetry/sdk/configuration/view_stream_configuration.h" @@ -609,17 +610,55 @@ ConfigurationParser::ParseConsolePushMetricExporterConfiguration( return model; } +TranslationStrategy ConfigurationParser::ParseTranslationStrategy( + const std::unique_ptr &node, + const std::string &name) const +{ + if (name == "UnderscoreEscapingWithSuffixes") + { + return TranslationStrategy::UnderscoreEscapingWithSuffixes; + } + + if (name == "UnderscoreEscapingWithoutSuffixes") + { + return TranslationStrategy::UnderscoreEscapingWithoutSuffixes; + } + + if (name == "NoUTF8EscapingWithSuffixes") + { + return TranslationStrategy::NoUTF8EscapingWithSuffixes; + } + + if (name == "NoTranslation") + { + return TranslationStrategy::NoTranslation; + } + + std::string message("Illegal TranslationStrategy: "); + message.append(name); + throw InvalidSchemaException(node->Location(), message); +} + std::unique_ptr ConfigurationParser::ParsePrometheusPullMetricExporterConfiguration( const std::unique_ptr &node) const { auto model = std::make_unique(); + std::unique_ptr child; + + model->host = node->GetString("host", "localhost"); + model->port = node->GetInteger("port", 9464); + model->without_scope_info = node->GetBoolean("without_scope_info", false); + + child = node->GetChildNode("with_resource_constant_labels"); + if (child) + { + model->with_resource_constant_labels = ParseIncludeExcludeConfiguration(child); + } - model->host = node->GetString("host", "localhost"); - model->port = node->GetInteger("port", 9464); - model->without_units = node->GetBoolean("without_units", false); - model->without_type_suffix = node->GetBoolean("without_type_suffix", false); - model->without_scope_info = node->GetBoolean("without_scope_info", false); + std::string translation_strategy = + node->GetString("translation_strategy", "UnderscoreEscapingWithSuffixes"); + model->translation_strategy = ParseTranslationStrategy(node, translation_strategy); return model; } diff --git a/sdk/test/configuration/yaml_metrics_test.cc b/sdk/test/configuration/yaml_metrics_test.cc index f063c55145..296405fc89 100644 --- a/sdk/test/configuration/yaml_metrics_test.cc +++ b/sdk/test/configuration/yaml_metrics_test.cc @@ -25,6 +25,7 @@ #include "opentelemetry/sdk/configuration/pull_metric_reader_configuration.h" #include "opentelemetry/sdk/configuration/string_array_configuration.h" #include "opentelemetry/sdk/configuration/temporality_preference.h" +#include "opentelemetry/sdk/configuration/translation_strategy.h" #include "opentelemetry/sdk/configuration/view_configuration.h" #include "opentelemetry/sdk/configuration/view_selector_configuration.h" #include "opentelemetry/sdk/configuration/view_stream_configuration.h" @@ -537,9 +538,10 @@ file_format: "1.0-metrics" opentelemetry::sdk::configuration::PrometheusPullMetricExporterConfiguration *>(exporter); ASSERT_EQ(prometheus->host, "localhost"); ASSERT_EQ(prometheus->port, 9464); - ASSERT_EQ(prometheus->without_units, false); - ASSERT_EQ(prometheus->without_type_suffix, false); ASSERT_EQ(prometheus->without_scope_info, false); + ASSERT_EQ(prometheus->translation_strategy, + opentelemetry::sdk::configuration::TranslationStrategy::UnderscoreEscapingWithSuffixes); + ASSERT_EQ(prometheus->with_resource_constant_labels, nullptr); } TEST(YamlMetrics, prometheus) @@ -553,9 +555,14 @@ file_format: "1.0-metrics" prometheus/development: host: "prometheus" port: 1234 - without_units: true - without_type_suffix: true without_scope_info: true + translation_strategy: NoUTF8EscapingWithSuffixes + with_resource_constant_labels: + included: + - "foo.in" + - "bar.in" + excluded: + - "baz.ex" )"; auto config = DoParse(yaml); @@ -573,9 +580,17 @@ file_format: "1.0-metrics" opentelemetry::sdk::configuration::PrometheusPullMetricExporterConfiguration *>(exporter); ASSERT_EQ(prometheus->host, "prometheus"); ASSERT_EQ(prometheus->port, 1234); - ASSERT_EQ(prometheus->without_units, true); - ASSERT_EQ(prometheus->without_type_suffix, true); ASSERT_EQ(prometheus->without_scope_info, true); + ASSERT_EQ(prometheus->translation_strategy, + opentelemetry::sdk::configuration::TranslationStrategy::NoUTF8EscapingWithSuffixes); + ASSERT_NE(prometheus->with_resource_constant_labels, nullptr); + ASSERT_NE(prometheus->with_resource_constant_labels->included, nullptr); + ASSERT_EQ(prometheus->with_resource_constant_labels->included->string_array.size(), 2); + ASSERT_EQ(prometheus->with_resource_constant_labels->included->string_array[0], "foo.in"); + ASSERT_EQ(prometheus->with_resource_constant_labels->included->string_array[1], "bar.in"); + ASSERT_NE(prometheus->with_resource_constant_labels->excluded, nullptr); + ASSERT_EQ(prometheus->with_resource_constant_labels->excluded->string_array.size(), 1); + ASSERT_EQ(prometheus->with_resource_constant_labels->excluded->string_array[0], "baz.ex"); } TEST(YamlMetrics, empty_views) From 9caafe6b8ef4df70dd3e06f168e0d83932c74b2e Mon Sep 17 00:00:00 2001 From: Rene Greiner Date: Tue, 28 Oct 2025 02:00:26 +0100 Subject: [PATCH 15/23] [SDK] Misc cleanup in attribute_utils.h (#3716) - prevent superfluous copy in construction of OwnedAttributeValue with std::string or span - combined identical lambdas of both lamdas - use const-ref - removed unneeded (stateless) members --- .../sdk/common/attribute_utils.h | 39 ++++++++----------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/sdk/include/opentelemetry/sdk/common/attribute_utils.h b/sdk/include/opentelemetry/sdk/common/attribute_utils.h index c2d0209a7d..a1ac74b239 100644 --- a/sdk/include/opentelemetry/sdk/common/attribute_utils.h +++ b/sdk/include/opentelemetry/sdk/common/attribute_utils.h @@ -83,7 +83,7 @@ struct AttributeConverter { return OwnedAttributeValue(std::string(v)); } - OwnedAttributeValue operator()(std::string v) { return OwnedAttributeValue(v); } + OwnedAttributeValue operator()(std::string v) { return OwnedAttributeValue(std::move(v)); } OwnedAttributeValue operator()(const char *v) { return OwnedAttributeValue(std::string(v)); } OwnedAttributeValue operator()(nostd::span v) { return convertSpan(v); } OwnedAttributeValue operator()(nostd::span v) { return convertSpan(v); } @@ -100,8 +100,7 @@ struct AttributeConverter template OwnedAttributeValue convertSpan(nostd::span vals) { - const std::vector copy(vals.begin(), vals.end()); - return OwnedAttributeValue(std::move(copy)); + return OwnedAttributeValue(std::vector(vals.begin(), vals.end())); } }; @@ -171,11 +170,7 @@ class AttributeMap : public std::unordered_map // Construct attribute map and populate with attributes AttributeMap(const opentelemetry::common::KeyValueIterable &attributes) : AttributeMap() { - attributes.ForEachKeyValue( - [&](nostd::string_view key, opentelemetry::common::AttributeValue value) noexcept { - SetAttribute(key, value); - return true; - }); + ConstructFrom(attributes); } // Construct attribute map and populate with optional attributes @@ -183,11 +178,7 @@ class AttributeMap : public std::unordered_map { if (attributes != nullptr) { - attributes->ForEachKeyValue( - [&](nostd::string_view key, opentelemetry::common::AttributeValue value) noexcept { - SetAttribute(key, value); - return true; - }); + ConstructFrom(*attributes); } } @@ -203,6 +194,15 @@ class AttributeMap : public std::unordered_map } } + void ConstructFrom(const opentelemetry::common::KeyValueIterable &attributes) + { + attributes.ForEachKeyValue( + [&](nostd::string_view key, const opentelemetry::common::AttributeValue &value) noexcept { + SetAttribute(key, value); + return true; + }); + } + // Returns a reference to this map const std::unordered_map &GetAttributes() const noexcept { @@ -213,7 +213,7 @@ class AttributeMap : public std::unordered_map void SetAttribute(nostd::string_view key, const opentelemetry::common::AttributeValue &value) noexcept { - (*this)[std::string(key)] = nostd::visit(converter_, value); + (*this)[std::string(key)] = nostd::visit(AttributeConverter(), value); } // Compare the attributes of this map with another KeyValueIterable @@ -235,7 +235,7 @@ class AttributeMap : public std::unordered_map { // Order of arguments is important here. OwnedAttributeValue is first then // AttributeValue AttributeEqualToVisitor does not support the reverse order - return nostd::visit(equal_to_visitor_, kv.second, value); + return nostd::visit(AttributeEqualToVisitor(), kv.second, value); } } return false; @@ -243,10 +243,6 @@ class AttributeMap : public std::unordered_map return is_equal; } - -private: - AttributeConverter converter_; - AttributeEqualToVisitor equal_to_visitor_; }; /** @@ -291,11 +287,8 @@ class OrderedAttributeMap : public std::map void SetAttribute(nostd::string_view key, const opentelemetry::common::AttributeValue &value) noexcept { - (*this)[std::string(key)] = nostd::visit(converter_, value); + (*this)[std::string(key)] = nostd::visit(AttributeConverter(), value); } - -private: - AttributeConverter converter_; }; } // namespace common From 86ca715f334c7d4131be9e03dd070ac48507b212 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Wed, 29 Oct 2025 17:39:49 +0100 Subject: [PATCH 16/23] [TEST] Disable test BasicCurlHttpTests.SendGetRequestAsync (#3722) --- ext/test/http/curl_http_test.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ext/test/http/curl_http_test.cc b/ext/test/http/curl_http_test.cc index fda9669287..9a4968e05f 100644 --- a/ext/test/http/curl_http_test.cc +++ b/ext/test/http/curl_http_test.cc @@ -217,6 +217,9 @@ class BasicCurlHttpTests : public ::testing::Test, public HTTP_SERVER_NS::HttpRe } }; +class DISABLED_BasicCurlHttpTests : public BasicCurlHttpTests +{}; + TEST_F(BasicCurlHttpTests, DoNothing) {} TEST_F(BasicCurlHttpTests, HttpRequest) @@ -495,7 +498,8 @@ TEST_F(BasicCurlHttpTests, GetBaseUri) "http://127.0.0.1:31339/"); } -TEST_F(BasicCurlHttpTests, SendGetRequestAsync) +// DISABLED, see https://github.com/open-telemetry/opentelemetry-cpp/issues/3535 +TEST_F(DISABLED_BasicCurlHttpTests, SendGetRequestAsync) { curl::HttpClient http_client; @@ -528,6 +532,8 @@ TEST_F(BasicCurlHttpTests, SendGetRequestAsync) ASSERT_FALSE(sessions[i]->IsSessionActive()); ASSERT_TRUE(handlers[i]->is_called_.load(std::memory_order_acquire)); + + // TODO: Spurious test failures here. ASSERT_TRUE(handlers[i]->got_response_.load(std::memory_order_acquire)); } From 879121e893d0c39308d99b3630b0aa05b5ea40b8 Mon Sep 17 00:00:00 2001 From: Tom Tan Date: Wed, 29 Oct 2025 18:01:46 -0700 Subject: [PATCH 17/23] [SDK] Add cardinality_limit to all derived classes of AggregationConfig (#3728) --- .../sdk/metrics/aggregation/aggregation_config.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sdk/include/opentelemetry/sdk/metrics/aggregation/aggregation_config.h b/sdk/include/opentelemetry/sdk/metrics/aggregation/aggregation_config.h index 2effa4933c..e64ce09c9d 100644 --- a/sdk/include/opentelemetry/sdk/metrics/aggregation/aggregation_config.h +++ b/sdk/include/opentelemetry/sdk/metrics/aggregation/aggregation_config.h @@ -37,6 +37,10 @@ class AggregationConfig class HistogramAggregationConfig : public AggregationConfig { public: + HistogramAggregationConfig(size_t cardinality_limit = kAggregationCardinalityLimit) + : AggregationConfig(cardinality_limit) + {} + std::vector boundaries_; bool record_min_max_ = true; }; @@ -44,6 +48,11 @@ class HistogramAggregationConfig : public AggregationConfig class Base2ExponentialHistogramAggregationConfig : public AggregationConfig { public: + Base2ExponentialHistogramAggregationConfig( + size_t cardinality_limit = kAggregationCardinalityLimit) + : AggregationConfig(cardinality_limit) + {} + size_t max_buckets_ = 160; int32_t max_scale_ = 20; bool record_min_max_ = true; From c94aab5b104045a9e03908fc2fad2ea2b3311d51 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 31 Oct 2025 09:23:58 +0100 Subject: [PATCH 18/23] Bump github/codeql-action from 4.31.0 to 4.31.2 (#3733) Bumps [github/codeql-action](https://github.com/github/codeql-action) from 4.31.0 to 4.31.2. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/4e94bd11f71e507f7f87df81788dff88d1dacbfb...0499de31b99561a6d14a36a5f662c2a54f91beee) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: 4.31.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 6 +++--- .github/workflows/ossf-scorecard.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 14eb276057..93f1f0a212 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -37,10 +37,10 @@ jobs: run: | sudo -E ./ci/setup_ci_environment.sh - name: Initialize CodeQL - uses: github/codeql-action/init@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v4.31.0 + uses: github/codeql-action/init@0499de31b99561a6d14a36a5f662c2a54f91beee # v4.31.2 with: languages: cpp - name: Autobuild - uses: github/codeql-action/autobuild@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v4.31.0 + uses: github/codeql-action/autobuild@0499de31b99561a6d14a36a5f662c2a54f91beee # v4.31.2 - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v4.31.0 + uses: github/codeql-action/analyze@0499de31b99561a6d14a36a5f662c2a54f91beee # v4.31.2 diff --git a/.github/workflows/ossf-scorecard.yml b/.github/workflows/ossf-scorecard.yml index 7ace984e37..4ca3473cc2 100644 --- a/.github/workflows/ossf-scorecard.yml +++ b/.github/workflows/ossf-scorecard.yml @@ -47,6 +47,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard (optional). # Commenting out will disable upload of results to your repo's Code Scanning dashboard - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@4e94bd11f71e507f7f87df81788dff88d1dacbfb # v4.31.0 + uses: github/codeql-action/upload-sarif@0499de31b99561a6d14a36a5f662c2a54f91beee # v4.31.2 with: sarif_file: results.sarif From 33c9782faf65af822dafb84fedbcc0b7e1f42c4a Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Fri, 31 Oct 2025 14:34:06 +0100 Subject: [PATCH 19/23] [BUILD] Upgrade to opentelemetry-proto 1.8.0 (#3730) --- .bazelversion | 2 +- CHANGELOG.md | 3 +++ MODULE.bazel | 2 +- install/cmake/third_party_latest | 2 +- third_party/opentelemetry-proto | 2 +- third_party_release | 2 +- 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.bazelversion b/.bazelversion index 21c8c7b46b..b26a34e470 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -7.1.1 +7.2.1 diff --git a/CHANGELOG.md b/CHANGELOG.md index b9c334575e..958b71dc71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,9 @@ Increment the: * [CONFIGURATION] File configuration - prometheus translation [#3715](https://github.com/open-telemetry/opentelemetry-cpp/pull/3715) +* [BUILD] Upgrade to opentelemetry-proto 1.8.0 + [#3730](https://github.com/open-telemetry/opentelemetry-cpp/pull/3730) + ## [1.23 2025-09-25] * [CodeHealth] Fix clang-tidy warnings part 6 diff --git a/MODULE.bazel b/MODULE.bazel index 191d6bb6e6..854ec59498 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -13,7 +13,7 @@ bazel_dep(name = "bazel_skylib", version = "1.7.1") bazel_dep(name = "curl", version = "8.8.0") bazel_dep(name = "grpc", version = "1.66.0.bcr.2", repo_name = "com_github_grpc_grpc") bazel_dep(name = "nlohmann_json", version = "3.12.0", repo_name = "github_nlohmann_json") -bazel_dep(name = "opentelemetry-proto", version = "1.7.0", repo_name = "com_github_opentelemetry_proto") +bazel_dep(name = "opentelemetry-proto", version = "1.8.0", repo_name = "com_github_opentelemetry_proto") bazel_dep(name = "opentracing-cpp", version = "1.6.0", repo_name = "com_github_opentracing") bazel_dep(name = "platforms", version = "0.0.11") bazel_dep(name = "prometheus-cpp", version = "1.3.0", repo_name = "com_github_jupp0r_prometheus_cpp") diff --git a/install/cmake/third_party_latest b/install/cmake/third_party_latest index 3dd9ef050b..c41dab1a1a 100644 --- a/install/cmake/third_party_latest +++ b/install/cmake/third_party_latest @@ -13,7 +13,7 @@ benchmark=v1.9.4 googletest=v1.17.0 ms-gsl=v4.2.0 nlohmann-json=v3.12.0 -opentelemetry-proto=v1.7.0 +opentelemetry-proto=v1.8.0 opentracing-cpp=v1.6.0 prometheus-cpp=v1.3.0 ryml=v0.9.0 diff --git a/third_party/opentelemetry-proto b/third_party/opentelemetry-proto index 8654ab7a5a..c0a98a1847 160000 --- a/third_party/opentelemetry-proto +++ b/third_party/opentelemetry-proto @@ -1 +1 @@ -Subproject commit 8654ab7a5a43ca25fe8046e59dcd6935c3f76de0 +Subproject commit c0a98a1847d3124ac5f9ecd02d0e2d2732bbb590 diff --git a/third_party_release b/third_party_release index 2bc8ef139c..76b8d189c5 100644 --- a/third_party_release +++ b/third_party_release @@ -22,7 +22,7 @@ benchmark=v1.9.4 googletest=v1.17.0 ms-gsl=v4.2.0 nlohmann-json=v3.12.0 -opentelemetry-proto=v1.7.0 +opentelemetry-proto=v1.8.0 opentracing-cpp=v1.6.0 prometheus-cpp=v1.3.0 ryml=v0.9.0 From 615311e986158842d6033aa27ed86b481224a9d7 Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Fri, 31 Oct 2025 16:42:11 +0100 Subject: [PATCH 20/23] [SEMANTIC CONVENTIONS] Upgrade to semantic conventions 1.38.0 (#3729) --- .../opentelemetry/semconv/http_attributes.h | 48 +- .../semconv/incubating/app_attributes.h | 18 + .../semconv/incubating/azure_attributes.h | 4 +- .../semconv/incubating/container_attributes.h | 11 +- .../semconv/incubating/container_metrics.h | 193 ++ .../semconv/incubating/db_attributes.h | 13 +- .../semconv/incubating/dns_attributes.h | 6 +- .../semconv/incubating/enduser_attributes.h | 3 +- .../semconv/incubating/event_attributes.h | 3 +- .../semconv/incubating/faas_attributes.h | 6 +- .../semconv/incubating/gcp_attributes.h | 156 + .../semconv/incubating/gen_ai_attributes.h | 89 +- .../semconv/incubating/http_attributes.h | 60 +- .../semconv/incubating/k8s_attributes.h | 82 +- .../semconv/incubating/k8s_metrics.h | 2683 ++++++++++++++--- .../semconv/incubating/messaging_attributes.h | 4 +- .../semconv/incubating/nfs_attributes.h | 35 + .../semconv/incubating/nfs_metrics.h | 692 +++++ .../semconv/incubating/onc_rpc_attributes.h | 44 + .../semconv/incubating/openshift_attributes.h | 34 + .../semconv/incubating/openshift_metrics.h | 1065 +++++++ .../semconv/incubating/peer_attributes.h | 7 +- .../semconv/incubating/pprof_attributes.h | 58 + .../semconv/incubating/process_attributes.h | 32 +- .../semconv/incubating/rpc_attributes.h | 22 +- .../semconv/incubating/rpc_metrics.h | 58 +- .../semconv/incubating/system_attributes.h | 46 +- .../semconv/incubating/system_metrics.h | 164 +- .../semconv/incubating/thread_attributes.h | 21 + .../semconv/incubating/vcs_attributes.h | 9 +- .../opentelemetry/semconv/schema_url.h | 2 +- buildscripts/semantic-convention/generate.sh | 4 +- 32 files changed, 5089 insertions(+), 583 deletions(-) create mode 100644 api/include/opentelemetry/semconv/incubating/nfs_attributes.h create mode 100644 api/include/opentelemetry/semconv/incubating/nfs_metrics.h create mode 100644 api/include/opentelemetry/semconv/incubating/onc_rpc_attributes.h create mode 100644 api/include/opentelemetry/semconv/incubating/openshift_attributes.h create mode 100644 api/include/opentelemetry/semconv/incubating/openshift_metrics.h create mode 100644 api/include/opentelemetry/semconv/incubating/pprof_attributes.h diff --git a/api/include/opentelemetry/semconv/http_attributes.h b/api/include/opentelemetry/semconv/http_attributes.h index 85e5244b08..b815b5d6b8 100644 --- a/api/include/opentelemetry/semconv/http_attributes.h +++ b/api/include/opentelemetry/semconv/http_attributes.h @@ -43,19 +43,23 @@ static constexpr const char *kHttpRequestHeader = "http.request.header";

HTTP request method value SHOULD be "known" to the instrumentation. By default, this convention defines "known" methods as the ones listed in RFC9110 and the PATCH method - defined in RFC5789.

If the HTTP - request method is not known to instrumentation, it MUST set the @code http.request.method @endcode - attribute to @code _OTHER @endcode.

If the HTTP instrumentation could end up converting valid - HTTP request methods to @code _OTHER @endcode, then it MUST provide a way to override the list of - known HTTP methods. If this override is done via environment variable, then the environment - variable MUST be named OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list - of case-sensitive known HTTP methods (this list MUST be a full override of the default known - method, it is not a list of known methods in addition to the defaults).

HTTP method names are - case-sensitive and @code http.request.method @endcode attribute value MUST match a known HTTP - method name exactly. Instrumentations for specific web frameworks that consider HTTP methods to be - case insensitive, SHOULD populate a canonical equivalent. Tracing instrumentations that do so, - MUST also set @code http.request.method_original @endcode to the original value. + href="https://www.rfc-editor.org/rfc/rfc9110.html#name-methods">RFC9110, the PATCH method + defined in RFC5789 and the QUERY method + defined in httpbis-safe-method-w-body. +

+ If the HTTP request method is not known to instrumentation, it MUST set the @code + http.request.method @endcode attribute to @code _OTHER @endcode.

If the HTTP instrumentation + could end up converting valid HTTP request methods to @code _OTHER @endcode, then it MUST provide + a way to override the list of known HTTP methods. If this override is done via environment + variable, then the environment variable MUST be named OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and + support a comma-separated list of case-sensitive known HTTP methods (this list MUST be a full + override of the default known method, it is not a list of known methods in addition to the + defaults).

HTTP method names are case-sensitive and @code http.request.method @endcode + attribute value MUST match a known HTTP method name exactly. Instrumentations for specific web + frameworks that consider HTTP methods to be case insensitive, SHOULD populate a canonical + equivalent. Tracing instrumentations that do so, MUST also set @code http.request.method_original + @endcode to the original value. */ static constexpr const char *kHttpRequestMethod = "http.request.method"; @@ -97,11 +101,19 @@ static constexpr const char *kHttpResponseHeader = "http.response.header"; static constexpr const char *kHttpResponseStatusCode = "http.response.status_code"; /** - The matched route, that is, the path template in the format used by the respective server - framework.

MUST NOT be populated when this is not supported by the HTTP server framework as - the route attribute should have low-cardinality and the URI path can NOT substitute it. SHOULD - include the application root if - there is one. + The matched route template for the request. This MUST be low-cardinality and include all static + path segments, with dynamic path segments represented with placeholders.

MUST NOT be populated + when this is not supported by the HTTP server framework as the route attribute should have + low-cardinality and the URI path can NOT substitute it. SHOULD include the application root if there is one.

+ A static path segment is a part of the route template with a fixed, low-cardinality value. This + includes literal strings like @code /users/ @endcode and placeholders that are constrained to a + finite, predefined set of values, e.g. @code {controller} @endcode or @code {action} @endcode.

+ A dynamic path segment is a placeholder for a value that can have high cardinality and is not + constrained to a predefined list like static path segments.

Instrumentations SHOULD use + routing information provided by the corresponding web framework. They SHOULD pick the most precise + source of routing information and MAY support custom route formatting. Instrumentations SHOULD + document the format and the API used to obtain the route string. */ static constexpr const char *kHttpRoute = "http.route"; diff --git a/api/include/opentelemetry/semconv/incubating/app_attributes.h b/api/include/opentelemetry/semconv/incubating/app_attributes.h index b8477ee3bb..dae548ec11 100644 --- a/api/include/opentelemetry/semconv/incubating/app_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/app_attributes.h @@ -80,6 +80,24 @@ static constexpr const char *kAppScreenCoordinateX = "app.screen.coordinate.x"; */ static constexpr const char *kAppScreenCoordinateY = "app.screen.coordinate.y"; +/** + An identifier that uniquely differentiates this screen from other screens in the same application. +

+ A screen represents only the part of the device display drawn by the app. It typically contains + multiple widgets or UI components and is larger in scope than individual widgets. Multiple screens + can coexist on the same display simultaneously (e.g., split view on tablets). + */ +static constexpr const char *kAppScreenId = "app.screen.id"; + +/** + The name of an application screen. +

+ A screen represents only the part of the device display drawn by the app. It typically contains + multiple widgets or UI components and is larger in scope than individual widgets. Multiple screens + can coexist on the same display simultaneously (e.g., split view on tablets). + */ +static constexpr const char *kAppScreenName = "app.screen.name"; + /** An identifier that uniquely differentiates this widget from other widgets in the same application.

diff --git a/api/include/opentelemetry/semconv/incubating/azure_attributes.h b/api/include/opentelemetry/semconv/incubating/azure_attributes.h index 1618050f9d..b8fa13674f 100644 --- a/api/include/opentelemetry/semconv/incubating/azure_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/azure_attributes.h @@ -39,8 +39,8 @@ static constexpr const char *kAzureCosmosdbConsistencyLevel = "azure.cosmosdb.co List of regions contacted during operation in the order that they were contacted. If there is more than one region listed, it indicates that the operation was performed on multiple regions i.e. cross-regional call.

Region name matches the format of @code displayName @endcode in Azure - Location API + href="https://learn.microsoft.com/rest/api/resources/subscriptions/list-locations">Azure Location + API */ static constexpr const char *kAzureCosmosdbOperationContactedRegions = "azure.cosmosdb.operation.contacted_regions"; diff --git a/api/include/opentelemetry/semconv/incubating/container_attributes.h b/api/include/opentelemetry/semconv/incubating/container_attributes.h index e0678618e2..4d18ce8b30 100644 --- a/api/include/opentelemetry/semconv/incubating/container_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/container_attributes.h @@ -73,7 +73,7 @@ static constexpr const char *kContainerId = "container.id";

Docker defines a sha256 of the image id; @code container.image.id @endcode corresponds to the @code Image @endcode field from the Docker container inspect API + href="https://docs.docker.com/reference/api/engine/version/v1.43/#tag/Container/operation/ContainerInspect">API endpoint. K8s defines a link to the container registry repository with digest @code "imageID": "registry.azurecr.io /namespace/service/dockerfile@sha256:bdeabd40c3a8a492eaf9e8e44d0ebbb84bac7ee25ac0cf8a7159d25f62555625" @@ -91,7 +91,8 @@ static constexpr const char *kContainerImageName = "container.image.name"; /** Repo digests of the container image as provided by the container runtime.

- Docker + Docker and CRI report those under the @code RepoDigests @endcode field. @@ -100,9 +101,9 @@ static constexpr const char *kContainerImageRepoDigests = "container.image.repo_ /** Container image tags. An example can be found in Docker Image - Inspect. Should be only the @code @endcode section of the full name for example from - @code registry.example.com/my-org/my-image: @endcode. + href="https://docs.docker.com/reference/api/engine/version/v1.43/#tag/Image/operation/ImageInspect">Docker + Image Inspect. Should be only the @code @endcode section of the full name for example + from @code registry.example.com/my-org/my-image: @endcode. */ static constexpr const char *kContainerImageTags = "container.image.tags"; diff --git a/api/include/opentelemetry/semconv/incubating/container_metrics.h b/api/include/opentelemetry/semconv/incubating/container_metrics.h index 1b86744224..9455503f91 100644 --- a/api/include/opentelemetry/semconv/incubating/container_metrics.h +++ b/api/include/opentelemetry/semconv/incubating/container_metrics.h @@ -289,6 +289,151 @@ CreateAsyncDoubleMetricContainerFilesystemUsage(metrics::Meter *meter) unitMetricContainerFilesystemUsage); } +/** + Container memory available. +

+ Available memory for use. This is defined as the memory limit - workingSetBytes. If memory limit + is undefined, the available bytes is omitted. In general, this metric can be derived from cadvisor + and by subtracting the @code container_memory_working_set_bytes @endcode metric from the @code + container_spec_memory_limit_bytes @endcode metric. In K8s, this metric is derived from the MemoryStats.AvailableBytes + field of the PodStats.Memory + of the Kubelet's stats API.

updowncounter + */ +static constexpr const char *kMetricContainerMemoryAvailable = "container.memory.available"; +static constexpr const char *descrMetricContainerMemoryAvailable = "Container memory available."; +static constexpr const char *unitMetricContainerMemoryAvailable = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricContainerMemoryAvailable(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricContainerMemoryAvailable, + descrMetricContainerMemoryAvailable, + unitMetricContainerMemoryAvailable); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricContainerMemoryAvailable(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricContainerMemoryAvailable, + descrMetricContainerMemoryAvailable, + unitMetricContainerMemoryAvailable); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricContainerMemoryAvailable(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricContainerMemoryAvailable, + descrMetricContainerMemoryAvailable, + unitMetricContainerMemoryAvailable); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricContainerMemoryAvailable(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricContainerMemoryAvailable, + descrMetricContainerMemoryAvailable, + unitMetricContainerMemoryAvailable); +} + +/** + Container memory paging faults. +

+ In general, this metric can be derived from cadvisor + and specifically the @code container_memory_failures_total{failure_type=pgfault, scope=container} + @endcode and @code container_memory_failures_total{failure_type=pgmajfault, scope=container} + @endcodemetric. In K8s, this metric is derived from the MemoryStats.PageFaults + and MemoryStats.MajorPageFaults + field of the PodStats.Memory + of the Kubelet's stats API.

counter + */ +static constexpr const char *kMetricContainerMemoryPagingFaults = "container.memory.paging.faults"; +static constexpr const char *descrMetricContainerMemoryPagingFaults = + "Container memory paging faults."; +static constexpr const char *unitMetricContainerMemoryPagingFaults = "{fault}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricContainerMemoryPagingFaults(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricContainerMemoryPagingFaults, + descrMetricContainerMemoryPagingFaults, + unitMetricContainerMemoryPagingFaults); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricContainerMemoryPagingFaults(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricContainerMemoryPagingFaults, + descrMetricContainerMemoryPagingFaults, + unitMetricContainerMemoryPagingFaults); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricContainerMemoryPagingFaults(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricContainerMemoryPagingFaults, + descrMetricContainerMemoryPagingFaults, + unitMetricContainerMemoryPagingFaults); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricContainerMemoryPagingFaults(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricContainerMemoryPagingFaults, + descrMetricContainerMemoryPagingFaults, + unitMetricContainerMemoryPagingFaults); +} + +/** + Container memory RSS. +

+ In general, this metric can be derived from cadvisor + and specifically the @code container_memory_rss @endcode metric. In K8s, this metric is derived + from the MemoryStats.RSSBytes + field of the PodStats.Memory + of the Kubelet's stats API.

updowncounter + */ +static constexpr const char *kMetricContainerMemoryRss = "container.memory.rss"; +static constexpr const char *descrMetricContainerMemoryRss = "Container memory RSS."; +static constexpr const char *unitMetricContainerMemoryRss = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricContainerMemoryRss(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricContainerMemoryRss, descrMetricContainerMemoryRss, + unitMetricContainerMemoryRss); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricContainerMemoryRss(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricContainerMemoryRss, descrMetricContainerMemoryRss, + unitMetricContainerMemoryRss); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricContainerMemoryRss(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricContainerMemoryRss, descrMetricContainerMemoryRss, unitMetricContainerMemoryRss); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricContainerMemoryRss(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricContainerMemoryRss, descrMetricContainerMemoryRss, unitMetricContainerMemoryRss); +} + /** Memory usage of the container.

@@ -328,6 +473,54 @@ CreateAsyncDoubleMetricContainerMemoryUsage(metrics::Meter *meter) kMetricContainerMemoryUsage, descrMetricContainerMemoryUsage, unitMetricContainerMemoryUsage); } +/** + Container memory working set. +

+ In general, this metric can be derived from cadvisor + and specifically the @code container_memory_working_set_bytes @endcode metric. In K8s, this metric + is derived from the MemoryStats.WorkingSetBytes + field of the PodStats.Memory + of the Kubelet's stats API.

updowncounter + */ +static constexpr const char *kMetricContainerMemoryWorkingSet = "container.memory.working_set"; +static constexpr const char *descrMetricContainerMemoryWorkingSet = "Container memory working set."; +static constexpr const char *unitMetricContainerMemoryWorkingSet = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricContainerMemoryWorkingSet(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricContainerMemoryWorkingSet, + descrMetricContainerMemoryWorkingSet, + unitMetricContainerMemoryWorkingSet); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricContainerMemoryWorkingSet(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricContainerMemoryWorkingSet, + descrMetricContainerMemoryWorkingSet, + unitMetricContainerMemoryWorkingSet); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricContainerMemoryWorkingSet(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricContainerMemoryWorkingSet, + descrMetricContainerMemoryWorkingSet, + unitMetricContainerMemoryWorkingSet); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricContainerMemoryWorkingSet(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricContainerMemoryWorkingSet, + descrMetricContainerMemoryWorkingSet, + unitMetricContainerMemoryWorkingSet); +} + /** Network bytes for the container.

diff --git a/api/include/opentelemetry/semconv/incubating/db_attributes.h b/api/include/opentelemetry/semconv/incubating/db_attributes.h index 31b8f2b74e..f6d81cba32 100644 --- a/api/include/opentelemetry/semconv/incubating/db_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/db_attributes.h @@ -229,8 +229,7 @@ OPENTELEMETRY_DEPRECATED static constexpr const char *kDbCosmosdbRequestContentL Deprecated, use @code db.response.status_code @endcode instead. @deprecated - {"note": "Replaced by @code db.response.status_code @endcode.", "reason": "renamed", "renamed_to": - "db.response.status_code"} + {"note": "Use @code db.response.status_code @endcode instead.", "reason": "uncategorized"} */ OPENTELEMETRY_DEPRECATED static constexpr const char *kDbCosmosdbStatusCode = "db.cosmosdb.status_code"; @@ -390,15 +389,18 @@ static constexpr const char *kDbOperationParameter = "db.operation.parameter"; @code db.query.parameter. @endcode SHOULD match up with the parameterized placeholders present in @code db.query.text @endcode.

+ It is RECOMMENDED to capture the value as provided by the application + without attempting to do any case normalization. +

@code db.query.parameter. @endcode SHOULD NOT be captured on batch operations.

Examples:

  • For a query @code SELECT * FROM users where username = %s @endcode with the parameter @code "jdoe" @endcode, the attribute @code db.query.parameter.0 @endcode SHOULD be set to @code "jdoe" - @endcode.
  • For a query @code "SELECT * FROM users WHERE username = %(username)s; @endcode + @endcode.
  • For a query @code "SELECT * FROM users WHERE username = %(userName)s; @endcode with parameter - @code username = "jdoe" @endcode, the attribute @code db.query.parameter.username @endcode SHOULD + @code userName = "jdoe" @endcode, the attribute @code db.query.parameter.userName @endcode SHOULD be set to @code "jdoe" @endcode.
*/ @@ -439,8 +441,7 @@ static constexpr const char *kDbQueryText = "db.query.text"; Deprecated, use @code db.namespace @endcode instead. @deprecated - {"note": "Replaced by @code db.namespace @endcode.", "reason": "renamed", "renamed_to": - "db.namespace"} + {"note": "Uncategorized.", "reason": "uncategorized"} */ OPENTELEMETRY_DEPRECATED static constexpr const char *kDbRedisDatabaseIndex = "db.redis.database_index"; diff --git a/api/include/opentelemetry/semconv/incubating/dns_attributes.h b/api/include/opentelemetry/semconv/incubating/dns_attributes.h index 827d4d51da..39dc7fe570 100644 --- a/api/include/opentelemetry/semconv/incubating/dns_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/dns_attributes.h @@ -27,10 +27,8 @@ static constexpr const char *kDnsAnswers = "dns.answers"; /** The name being queried.

- If the name field contains non-printable characters (below 32 or above 126), those characters - should be represented as escaped base 10 integers (\DDD). Back slashes and quotes should be - escaped. Tabs, carriage returns, and line feeds should be converted to \t, \r, and \n - respectively. + The name represents the queried domain name as it appears in the DNS query without any additional + normalization. */ static constexpr const char *kDnsQuestionName = "dns.question.name"; diff --git a/api/include/opentelemetry/semconv/incubating/enduser_attributes.h b/api/include/opentelemetry/semconv/incubating/enduser_attributes.h index d117dd268e..2487dbe791 100644 --- a/api/include/opentelemetry/semconv/incubating/enduser_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/enduser_attributes.h @@ -40,8 +40,7 @@ static constexpr const char *kEnduserPseudoId = "enduser.pseudo.id"; Deprecated, use @code user.roles @endcode instead. @deprecated - {"note": "Replaced by @code user.roles @endcode.", "reason": "renamed", "renamed_to": - "user.roles"} + {"note": "Use @code user.roles @endcode instead.", "reason": "uncategorized"} */ OPENTELEMETRY_DEPRECATED static constexpr const char *kEnduserRole = "enduser.role"; diff --git a/api/include/opentelemetry/semconv/incubating/event_attributes.h b/api/include/opentelemetry/semconv/incubating/event_attributes.h index de4d30a570..42ecce2c25 100644 --- a/api/include/opentelemetry/semconv/incubating/event_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/event_attributes.h @@ -23,7 +23,8 @@ namespace event Identifies the class / type of event. @deprecated - {"note": "Replaced by EventName top-level field on the LogRecord.\n", "reason": "uncategorized"} + {"note": "The value of this attribute MUST now be set as the value of the EventName field on the + LogRecord to indicate that the LogRecord represents an Event.\n", "reason": "uncategorized"} */ OPENTELEMETRY_DEPRECATED static constexpr const char *kEventName = "event.name"; diff --git a/api/include/opentelemetry/semconv/incubating/faas_attributes.h b/api/include/opentelemetry/semconv/incubating/faas_attributes.h index 9f9690824b..0427a12d57 100644 --- a/api/include/opentelemetry/semconv/incubating/faas_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/faas_attributes.h @@ -142,9 +142,9 @@ static constexpr const char *kFaasTrigger = "faas.trigger"; (Services): The revision (i.e., the function name plus the revision suffix).

  • Google Cloud Functions: The value of the @code - K_REVISION @endcode environment variable.
  • Azure Functions: Not - applicable. Do not set this attribute.
  • + href="https://cloud.google.com/run/docs/container-contract#services-env-vars">@code K_REVISION + @endcode environment variable.
  • Azure Functions: Not applicable. Do + not set this attribute.
  • */ static constexpr const char *kFaasVersion = "faas.version"; diff --git a/api/include/opentelemetry/semconv/incubating/gcp_attributes.h b/api/include/opentelemetry/semconv/incubating/gcp_attributes.h index 7be353eb7e..74ddef337d 100644 --- a/api/include/opentelemetry/semconv/incubating/gcp_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/gcp_attributes.h @@ -80,6 +80,66 @@ static constexpr const char *kGcpApphubWorkloadEnvironmentType = */ static constexpr const char *kGcpApphubWorkloadId = "gcp.apphub.workload.id"; +/** + The container within GCP where the AppHub destination application is defined. + */ +static constexpr const char *kGcpApphubDestinationApplicationContainer = + "gcp.apphub_destination.application.container"; + +/** + The name of the destination application as configured in AppHub. + */ +static constexpr const char *kGcpApphubDestinationApplicationId = + "gcp.apphub_destination.application.id"; + +/** + The GCP zone or region where the destination application is defined. + */ +static constexpr const char *kGcpApphubDestinationApplicationLocation = + "gcp.apphub_destination.application.location"; + +/** + Criticality of a destination workload indicates its importance to the business as specified in AppHub type + enum + */ +static constexpr const char *kGcpApphubDestinationServiceCriticalityType = + "gcp.apphub_destination.service.criticality_type"; + +/** + Software lifecycle stage of a destination service as defined AppHub + environment type + */ +static constexpr const char *kGcpApphubDestinationServiceEnvironmentType = + "gcp.apphub_destination.service.environment_type"; + +/** + The name of the destination service as configured in AppHub. + */ +static constexpr const char *kGcpApphubDestinationServiceId = "gcp.apphub_destination.service.id"; + +/** + Criticality of a destination workload indicates its importance to the business as specified in AppHub type + enum + */ +static constexpr const char *kGcpApphubDestinationWorkloadCriticalityType = + "gcp.apphub_destination.workload.criticality_type"; + +/** + Environment of a destination workload is the stage of a software lifecycle as provided in the AppHub + environment type + */ +static constexpr const char *kGcpApphubDestinationWorkloadEnvironmentType = + "gcp.apphub_destination.workload.environment_type"; + +/** + The name of the destination workload as configured in AppHub. + */ +static constexpr const char *kGcpApphubDestinationWorkloadId = "gcp.apphub_destination.workload.id"; + /** Identifies the Google Cloud service for which the official client library is intended.

    @@ -216,6 +276,102 @@ static constexpr const char *kDevelopment = "DEVELOPMENT"; } // namespace GcpApphubWorkloadEnvironmentTypeValues +namespace GcpApphubDestinationServiceCriticalityTypeValues +{ +/** + Mission critical service. + */ +static constexpr const char *kMissionCritical = "MISSION_CRITICAL"; + +/** + High impact. + */ +static constexpr const char *kHigh = "HIGH"; + +/** + Medium impact. + */ +static constexpr const char *kMedium = "MEDIUM"; + +/** + Low impact. + */ +static constexpr const char *kLow = "LOW"; + +} // namespace GcpApphubDestinationServiceCriticalityTypeValues + +namespace GcpApphubDestinationServiceEnvironmentTypeValues +{ +/** + Production environment. + */ +static constexpr const char *kProduction = "PRODUCTION"; + +/** + Staging environment. + */ +static constexpr const char *kStaging = "STAGING"; + +/** + Test environment. + */ +static constexpr const char *kTest = "TEST"; + +/** + Development environment. + */ +static constexpr const char *kDevelopment = "DEVELOPMENT"; + +} // namespace GcpApphubDestinationServiceEnvironmentTypeValues + +namespace GcpApphubDestinationWorkloadCriticalityTypeValues +{ +/** + Mission critical service. + */ +static constexpr const char *kMissionCritical = "MISSION_CRITICAL"; + +/** + High impact. + */ +static constexpr const char *kHigh = "HIGH"; + +/** + Medium impact. + */ +static constexpr const char *kMedium = "MEDIUM"; + +/** + Low impact. + */ +static constexpr const char *kLow = "LOW"; + +} // namespace GcpApphubDestinationWorkloadCriticalityTypeValues + +namespace GcpApphubDestinationWorkloadEnvironmentTypeValues +{ +/** + Production environment. + */ +static constexpr const char *kProduction = "PRODUCTION"; + +/** + Staging environment. + */ +static constexpr const char *kStaging = "STAGING"; + +/** + Test environment. + */ +static constexpr const char *kTest = "TEST"; + +/** + Development environment. + */ +static constexpr const char *kDevelopment = "DEVELOPMENT"; + +} // namespace GcpApphubDestinationWorkloadEnvironmentTypeValues + } // namespace gcp } // namespace semconv OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/gen_ai_attributes.h b/api/include/opentelemetry/semconv/incubating/gen_ai_attributes.h index 50bfff5317..711a8bf380 100644 --- a/api/include/opentelemetry/semconv/incubating/gen_ai_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/gen_ai_attributes.h @@ -61,6 +61,37 @@ static constexpr const char *kGenAiConversationId = "gen_ai.conversation.id"; */ static constexpr const char *kGenAiDataSourceId = "gen_ai.data_source.id"; +/** + The number of dimensions the resulting output embeddings should have. + */ +static constexpr const char *kGenAiEmbeddingsDimensionCount = "gen_ai.embeddings.dimension.count"; + +/** + A free-form explanation for the assigned score provided by the evaluator. + */ +static constexpr const char *kGenAiEvaluationExplanation = "gen_ai.evaluation.explanation"; + +/** + The name of the evaluation metric used for the GenAI response. + */ +static constexpr const char *kGenAiEvaluationName = "gen_ai.evaluation.name"; + +/** + Human readable label for evaluation. +

    + This attribute provides a human-readable interpretation of the evaluation score produced by an + evaluator. For example, a score value of 1 could mean "relevant" in one evaluation system and "not + relevant" in another, depending on the scoring range and evaluator. The label SHOULD have low + cardinality. Possible values depend on the evaluation metric and evaluator used; implementations + SHOULD document the possible values. + */ +static constexpr const char *kGenAiEvaluationScoreLabel = "gen_ai.evaluation.score.label"; + +/** + The evaluation score returned by the evaluator. + */ +static constexpr const char *kGenAiEvaluationScoreValue = "gen_ai.evaluation.score.value"; + /** The chat history provided to the model as an input.

    @@ -313,11 +344,52 @@ static constexpr const char *kGenAiSystemInstructions = "gen_ai.system_instructi */ static constexpr const char *kGenAiTokenType = "gen_ai.token.type"; +/** + Parameters passed to the tool call. +

    + [!WARNING] + This attribute may contain sensitive information.
    +

    + It's expected to be an object - in case a serialized string is available + to the instrumentation, the instrumentation SHOULD do the best effort to + deserialize it to an object. When recorded on spans, it MAY be recorded as a JSON string if + structured format is not supported and SHOULD be recorded in structured form otherwise. + */ +static constexpr const char *kGenAiToolCallArguments = "gen_ai.tool.call.arguments"; + /** The tool call identifier. */ static constexpr const char *kGenAiToolCallId = "gen_ai.tool.call.id"; +/** + The result returned by the tool call (if any and if execution was successful). +

    + [!WARNING] + This attribute may contain sensitive information.
    +

    + It's expected to be an object - in case a serialized string is available + to the instrumentation, the instrumentation SHOULD do the best effort to + deserialize it to an object. When recorded on spans, it MAY be recorded as a JSON string if + structured format is not supported and SHOULD be recorded in structured form otherwise. + */ +static constexpr const char *kGenAiToolCallResult = "gen_ai.tool.call.result"; + +/** + The list of source system tool definitions available to the GenAI agent or model. +

    + The value of this attribute matches source system tool definition format. +

    + It's expected to be an array of objects where each object represents a tool definition. In case a + serialized string is available to the instrumentation, the instrumentation SHOULD do the best + effort to deserialize it to an array. When recorded on spans, it MAY be recorded as a JSON string + if structured format is not supported and SHOULD be recorded in structured form otherwise.

    + Since this attribute could be large, it's NOT RECOMMENDED to populate + it by default. Instrumentations MAY provide a way to enable + populating this attribute. + */ +static constexpr const char *kGenAiToolDefinitions = "gen_ai.tool.definitions"; + /** The tool description. */ @@ -604,13 +676,21 @@ static constexpr const char *kCohere = "cohere"; /** Azure AI Inference + + @deprecated + {"note": "Replaced by @code azure.ai.inference @endcode.", "reason": "renamed", "renamed_to": + "azure.ai.inference"} */ -static constexpr const char *kAzAiInference = "az.ai.inference"; +OPENTELEMETRY_DEPRECATED static constexpr const char *kAzAiInference = "az.ai.inference"; /** Azure OpenAI + + @deprecated + {"note": "Replaced by @code azure.ai.openai @endcode.", "reason": "renamed", "renamed_to": + "azure.ai.openai"} */ -static constexpr const char *kAzAiOpenai = "az.ai.openai"; +OPENTELEMETRY_DEPRECATED static constexpr const char *kAzAiOpenai = "az.ai.openai"; /** Azure AI Inference @@ -639,11 +719,8 @@ static constexpr const char *kPerplexity = "perplexity"; /** xAI - - @deprecated - {"note": "Replaced by @code x_ai @endcode.", "reason": "renamed", "renamed_to": "x_ai"} */ -OPENTELEMETRY_DEPRECATED static constexpr const char *kXai = "xai"; +static constexpr const char *kXai = "xai"; /** DeepSeek diff --git a/api/include/opentelemetry/semconv/incubating/http_attributes.h b/api/include/opentelemetry/semconv/incubating/http_attributes.h index f8cebe1751..1af52bbb62 100644 --- a/api/include/opentelemetry/semconv/incubating/http_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/http_attributes.h @@ -34,11 +34,12 @@ OPENTELEMETRY_DEPRECATED static constexpr const char *kHttpClientIp = "http.clie static constexpr const char *kHttpConnectionState = "http.connection.state"; /** - Deprecated, use @code network.protocol.name @endcode instead. + Deprecated, use @code network.protocol.name @endcode and @code network.protocol.version @endcode + instead. @deprecated - {"note": "Replaced by @code network.protocol.name @endcode.", "reason": "renamed", "renamed_to": - "network.protocol.name"} + {"note": "Split into @code network.protocol.name @endcode and @code network.protocol.version + @endcode", "reason": "uncategorized"} */ OPENTELEMETRY_DEPRECATED static constexpr const char *kHttpFlavor = "http.flavor"; @@ -93,19 +94,23 @@ static constexpr const char *kHttpRequestHeader = "http.request.header";

    HTTP request method value SHOULD be "known" to the instrumentation. By default, this convention defines "known" methods as the ones listed in RFC9110 and the PATCH method - defined in RFC5789.

    If the HTTP - request method is not known to instrumentation, it MUST set the @code http.request.method @endcode - attribute to @code _OTHER @endcode.

    If the HTTP instrumentation could end up converting valid - HTTP request methods to @code _OTHER @endcode, then it MUST provide a way to override the list of - known HTTP methods. If this override is done via environment variable, then the environment - variable MUST be named OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list - of case-sensitive known HTTP methods (this list MUST be a full override of the default known - method, it is not a list of known methods in addition to the defaults).

    HTTP method names are - case-sensitive and @code http.request.method @endcode attribute value MUST match a known HTTP - method name exactly. Instrumentations for specific web frameworks that consider HTTP methods to be - case insensitive, SHOULD populate a canonical equivalent. Tracing instrumentations that do so, - MUST also set @code http.request.method_original @endcode to the original value. + href="https://www.rfc-editor.org/rfc/rfc9110.html#name-methods">RFC9110, the PATCH method + defined in RFC5789 and the QUERY method + defined in httpbis-safe-method-w-body. +

    + If the HTTP request method is not known to instrumentation, it MUST set the @code + http.request.method @endcode attribute to @code _OTHER @endcode.

    If the HTTP instrumentation + could end up converting valid HTTP request methods to @code _OTHER @endcode, then it MUST provide + a way to override the list of known HTTP methods. If this override is done via environment + variable, then the environment variable MUST be named OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and + support a comma-separated list of case-sensitive known HTTP methods (this list MUST be a full + override of the default known method, it is not a list of known methods in addition to the + defaults).

    HTTP method names are case-sensitive and @code http.request.method @endcode + attribute value MUST match a known HTTP method name exactly. Instrumentations for specific web + frameworks that consider HTTP methods to be case insensitive, SHOULD populate a canonical + equivalent. Tracing instrumentations that do so, MUST also set @code http.request.method_original + @endcode to the original value. */ static constexpr const char *kHttpRequestMethod = "http.request.method"; @@ -209,11 +214,19 @@ OPENTELEMETRY_DEPRECATED static constexpr const char *kHttpResponseContentLength "http.response_content_length_uncompressed"; /** - The matched route, that is, the path template in the format used by the respective server - framework.

    MUST NOT be populated when this is not supported by the HTTP server framework as - the route attribute should have low-cardinality and the URI path can NOT substitute it. SHOULD - include the application root if - there is one. + The matched route template for the request. This MUST be low-cardinality and include all static + path segments, with dynamic path segments represented with placeholders.

    MUST NOT be populated + when this is not supported by the HTTP server framework as the route attribute should have + low-cardinality and the URI path can NOT substitute it. SHOULD include the application root if there is one.

    + A static path segment is a part of the route template with a fixed, low-cardinality value. This + includes literal strings like @code /users/ @endcode and placeholders that are constrained to a + finite, predefined set of values, e.g. @code {controller} @endcode or @code {action} @endcode.

    + A dynamic path segment is a placeholder for a value that can have high cardinality and is not + constrained to a predefined list like static path segments.

    Instrumentations SHOULD use + routing information provided by the corresponding web framework. They SHOULD pick the most precise + source of routing information and MAY support custom route formatting. Instrumentations SHOULD + document the format and the API used to obtain the route string. */ static constexpr const char *kHttpRoute = "http.route"; @@ -364,6 +377,11 @@ static constexpr const char *kPut = "PUT"; */ static constexpr const char *kTrace = "TRACE"; +/** + QUERY method. + */ +static constexpr const char *kQuery = "QUERY"; + /** Any HTTP method that the instrumentation has no prior knowledge of. */ diff --git a/api/include/opentelemetry/semconv/incubating/k8s_attributes.h b/api/include/opentelemetry/semconv/incubating/k8s_attributes.h index 80ef2a964b..8f18cfa4fe 100644 --- a/api/include/opentelemetry/semconv/incubating/k8s_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/k8s_attributes.h @@ -391,6 +391,20 @@ OPENTELEMETRY_DEPRECATED static constexpr const char *kK8sPodLabels = "k8s.pod.l */ static constexpr const char *kK8sPodName = "k8s.pod.name"; +/** + The phase for the pod. Corresponds to the @code phase @endcode field of the: K8s + PodStatus + */ +static constexpr const char *kK8sPodStatusPhase = "k8s.pod.status.phase"; + +/** + The reason for the pod state. Corresponds to the @code reason @endcode field of the: K8s + PodStatus + */ +static constexpr const char *kK8sPodStatusReason = "k8s.pod.status.reason"; + /** The UID of the Pod. */ @@ -450,7 +464,7 @@ static constexpr const char *kK8sResourcequotaName = "k8s.resourcequota.name"; string (e.g., count/deployments.apps, count/pods), or, for certain core Kubernetes resources, just the resource name (e.g., pods, services, configmaps). Both forms are supported by Kubernetes for object count quotas. See Kubernetes + href="https://kubernetes.io/docs/concepts/policy/resource-quotas/#quota-on-object-count">Kubernetes Resource Quotas documentation for more details. */ static constexpr const char *kK8sResourcequotaResourceName = "k8s.resourcequota.resource_name"; @@ -633,6 +647,72 @@ static constexpr const char *kNetworkUnavailable = "NetworkUnavailable"; } // namespace K8sNodeConditionTypeValues +namespace K8sPodStatusPhaseValues +{ +/** + The pod has been accepted by the system, but one or more of the containers has not been started. + This includes time before being bound to a node, as well as time spent pulling images onto the + host. + */ +static constexpr const char *kPending = "Pending"; + +/** + The pod has been bound to a node and all of the containers have been started. At least one + container is still running or is in the process of being restarted. + */ +static constexpr const char *kRunning = "Running"; + +/** + All containers in the pod have voluntarily terminated with a container exit code of 0, and the + system is not going to restart any of these containers. + */ +static constexpr const char *kSucceeded = "Succeeded"; + +/** + All containers in the pod have terminated, and at least one container has terminated in a failure + (exited with a non-zero exit code or was stopped by the system). + */ +static constexpr const char *kFailed = "Failed"; + +/** + For some reason the state of the pod could not be obtained, typically due to an error in + communicating with the host of the pod. + */ +static constexpr const char *kUnknown = "Unknown"; + +} // namespace K8sPodStatusPhaseValues + +namespace K8sPodStatusReasonValues +{ +/** + The pod is evicted. + */ +static constexpr const char *kEvicted = "Evicted"; + +/** + The pod is in a status because of its node affinity + */ +static constexpr const char *kNodeAffinity = "NodeAffinity"; + +/** + The reason on a pod when its state cannot be confirmed as kubelet is unresponsive on the node it + is (was) running. + */ +static constexpr const char *kNodeLost = "NodeLost"; + +/** + The node is shutdown + */ +static constexpr const char *kShutdown = "Shutdown"; + +/** + The pod was rejected admission to the node because of an error during admission that could not be + categorized. + */ +static constexpr const char *kUnexpectedAdmissionError = "UnexpectedAdmissionError"; + +} // namespace K8sPodStatusReasonValues + namespace K8sVolumeTypeValues { /** diff --git a/api/include/opentelemetry/semconv/incubating/k8s_metrics.h b/api/include/opentelemetry/semconv/incubating/k8s_metrics.h index 678b24ff85..e925e6a8ff 100644 --- a/api/include/opentelemetry/semconv/incubating/k8s_metrics.h +++ b/api/include/opentelemetry/semconv/incubating/k8s_metrics.h @@ -60,6 +60,53 @@ CreateAsyncDoubleMetricK8sContainerCpuLimit(metrics::Meter *meter) kMetricK8sContainerCpuLimit, descrMetricK8sContainerCpuLimit, unitMetricK8sContainerCpuLimit); } +/** + The ratio of container CPU usage to its CPU limit. +

    + The value range is [0.0,1.0]. A value of 1.0 means the container is using 100% of its CPU limit. + If the CPU limit is not set, this metric SHOULD NOT be emitted for that container.

    gauge + */ +static constexpr const char *kMetricK8sContainerCpuLimitUtilization = + "k8s.container.cpu.limit_utilization"; +static constexpr const char *descrMetricK8sContainerCpuLimitUtilization = + "The ratio of container CPU usage to its CPU limit."; +static constexpr const char *unitMetricK8sContainerCpuLimitUtilization = "1"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sContainerCpuLimitUtilization(metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricK8sContainerCpuLimitUtilization, + descrMetricK8sContainerCpuLimitUtilization, + unitMetricK8sContainerCpuLimitUtilization); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sContainerCpuLimitUtilization(metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricK8sContainerCpuLimitUtilization, + descrMetricK8sContainerCpuLimitUtilization, + unitMetricK8sContainerCpuLimitUtilization); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sContainerCpuLimitUtilization(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricK8sContainerCpuLimitUtilization, + descrMetricK8sContainerCpuLimitUtilization, + unitMetricK8sContainerCpuLimitUtilization); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sContainerCpuLimitUtilization(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricK8sContainerCpuLimitUtilization, + descrMetricK8sContainerCpuLimitUtilization, + unitMetricK8sContainerCpuLimitUtilization); +} + /** CPU resource requested for the container.

    @@ -104,6 +151,52 @@ CreateAsyncDoubleMetricK8sContainerCpuRequest(metrics::Meter *meter) unitMetricK8sContainerCpuRequest); } +/** + The ratio of container CPU usage to its CPU request. +

    + gauge + */ +static constexpr const char *kMetricK8sContainerCpuRequestUtilization = + "k8s.container.cpu.request_utilization"; +static constexpr const char *descrMetricK8sContainerCpuRequestUtilization = + "The ratio of container CPU usage to its CPU request."; +static constexpr const char *unitMetricK8sContainerCpuRequestUtilization = "1"; + +#if OPENTELEMETRY_ABI_VERSION_NO >= 2 + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sContainerCpuRequestUtilization(metrics::Meter *meter) +{ + return meter->CreateInt64Gauge(kMetricK8sContainerCpuRequestUtilization, + descrMetricK8sContainerCpuRequestUtilization, + unitMetricK8sContainerCpuRequestUtilization); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sContainerCpuRequestUtilization(metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricK8sContainerCpuRequestUtilization, + descrMetricK8sContainerCpuRequestUtilization, + unitMetricK8sContainerCpuRequestUtilization); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sContainerCpuRequestUtilization(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricK8sContainerCpuRequestUtilization, + descrMetricK8sContainerCpuRequestUtilization, + unitMetricK8sContainerCpuRequestUtilization); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sContainerCpuRequestUtilization(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge(kMetricK8sContainerCpuRequestUtilization, + descrMetricK8sContainerCpuRequestUtilization, + unitMetricK8sContainerCpuRequestUtilization); +} + /** Maximum ephemeral storage resource limit set for the container.

    @@ -548,40 +641,42 @@ CreateAsyncDoubleMetricK8sContainerStorageRequest(metrics::Meter *meter) } /** - The number of actively running jobs for a cronjob. -

    - This metric aligns with the @code active @endcode field of the - This metric aligns with the @code active @endcode field of the K8s CronJobStatus.

    updowncounter */ -static constexpr const char *kMetricK8sCronjobActiveJobs = "k8s.cronjob.active_jobs"; -static constexpr const char *descrMetricK8sCronjobActiveJobs = - "The number of actively running jobs for a cronjob."; -static constexpr const char *unitMetricK8sCronjobActiveJobs = "{job}"; +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sCronjobActiveJobs = + "k8s.cronjob.active_jobs"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sCronjobActiveJobs = + "Deprecated, use `k8s.cronjob.job.active` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sCronjobActiveJobs = "{job}"; -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricK8sCronjobActiveJobs(metrics::Meter *meter) { return meter->CreateInt64UpDownCounter( kMetricK8sCronjobActiveJobs, descrMetricK8sCronjobActiveJobs, unitMetricK8sCronjobActiveJobs); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sCronjobActiveJobs(metrics::Meter *meter) { return meter->CreateDoubleUpDownCounter( kMetricK8sCronjobActiveJobs, descrMetricK8sCronjobActiveJobs, unitMetricK8sCronjobActiveJobs); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncInt64MetricK8sCronjobActiveJobs(metrics::Meter *meter) { return meter->CreateInt64ObservableUpDownCounter( kMetricK8sCronjobActiveJobs, descrMetricK8sCronjobActiveJobs, unitMetricK8sCronjobActiveJobs); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sCronjobActiveJobs(metrics::Meter *meter) { return meter->CreateDoubleObservableUpDownCounter( @@ -589,21 +684,64 @@ CreateAsyncDoubleMetricK8sCronjobActiveJobs(metrics::Meter *meter) } /** - Number of nodes that are running at least 1 daemon pod and are supposed to run the daemon pod. + The number of actively running jobs for a cronjob.

    - This metric aligns with the @code currentNumberScheduled @endcode field of the + This metric aligns with the @code active @endcode field of the K8s + CronJobStatus.

    updowncounter + */ +static constexpr const char *kMetricK8sCronjobJobActive = "k8s.cronjob.job.active"; +static constexpr const char *descrMetricK8sCronjobJobActive = + "The number of actively running jobs for a cronjob."; +static constexpr const char *unitMetricK8sCronjobJobActive = "{job}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sCronjobJobActive(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sCronjobJobActive, descrMetricK8sCronjobJobActive, + unitMetricK8sCronjobJobActive); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sCronjobJobActive(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter( + kMetricK8sCronjobJobActive, descrMetricK8sCronjobJobActive, unitMetricK8sCronjobJobActive); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sCronjobJobActive(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricK8sCronjobJobActive, descrMetricK8sCronjobJobActive, unitMetricK8sCronjobJobActive); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sCronjobJobActive(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricK8sCronjobJobActive, descrMetricK8sCronjobJobActive, unitMetricK8sCronjobJobActive); +} + +/** + Deprecated, use @code k8s.daemonset.node.current_scheduled @endcode instead. + + @deprecated + {"note": "Replaced by @code k8s.daemonset.node.current_scheduled @endcode.", "reason": "renamed", + "renamed_to": "k8s.daemonset.node.current_scheduled"}

    This metric aligns with the @code + currentNumberScheduled @endcode field of the K8s DaemonSetStatus.

    updowncounter */ -static constexpr const char *kMetricK8sDaemonsetCurrentScheduledNodes = +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sDaemonsetCurrentScheduledNodes = "k8s.daemonset.current_scheduled_nodes"; -static constexpr const char *descrMetricK8sDaemonsetCurrentScheduledNodes = - "Number of nodes that are running at least 1 daemon pod and are supposed to run the daemon " - "pod."; -static constexpr const char *unitMetricK8sDaemonsetCurrentScheduledNodes = "{node}"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sDaemonsetCurrentScheduledNodes = + "Deprecated, use `k8s.daemonset.node.current_scheduled` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sDaemonsetCurrentScheduledNodes = + "{node}"; -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricK8sDaemonsetCurrentScheduledNodes(metrics::Meter *meter) { return meter->CreateInt64UpDownCounter(kMetricK8sDaemonsetCurrentScheduledNodes, @@ -611,7 +749,7 @@ CreateSyncInt64MetricK8sDaemonsetCurrentScheduledNodes(metrics::Meter *meter) unitMetricK8sDaemonsetCurrentScheduledNodes); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sDaemonsetCurrentScheduledNodes(metrics::Meter *meter) { return meter->CreateDoubleUpDownCounter(kMetricK8sDaemonsetCurrentScheduledNodes, @@ -619,7 +757,7 @@ CreateSyncDoubleMetricK8sDaemonsetCurrentScheduledNodes(metrics::Meter *meter) unitMetricK8sDaemonsetCurrentScheduledNodes); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncInt64MetricK8sDaemonsetCurrentScheduledNodes(metrics::Meter *meter) { return meter->CreateInt64ObservableUpDownCounter(kMetricK8sDaemonsetCurrentScheduledNodes, @@ -627,7 +765,7 @@ CreateAsyncInt64MetricK8sDaemonsetCurrentScheduledNodes(metrics::Meter *meter) unitMetricK8sDaemonsetCurrentScheduledNodes); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sDaemonsetCurrentScheduledNodes(metrics::Meter *meter) { return meter->CreateDoubleObservableUpDownCounter(kMetricK8sDaemonsetCurrentScheduledNodes, @@ -636,19 +774,23 @@ CreateAsyncDoubleMetricK8sDaemonsetCurrentScheduledNodes(metrics::Meter *meter) } /** - Number of nodes that should be running the daemon pod (including nodes currently running the - daemon pod).

    This metric aligns with the @code desiredNumberScheduled @endcode field of the This metric aligns with the @code + desiredNumberScheduled @endcode field of the K8s DaemonSetStatus.

    updowncounter */ -static constexpr const char *kMetricK8sDaemonsetDesiredScheduledNodes = +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sDaemonsetDesiredScheduledNodes = "k8s.daemonset.desired_scheduled_nodes"; -static constexpr const char *descrMetricK8sDaemonsetDesiredScheduledNodes = - "Number of nodes that should be running the daemon pod (including nodes currently running the " - "daemon pod)."; -static constexpr const char *unitMetricK8sDaemonsetDesiredScheduledNodes = "{node}"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sDaemonsetDesiredScheduledNodes = + "Deprecated, use `k8s.daemonset.node.desired_scheduled` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sDaemonsetDesiredScheduledNodes = + "{node}"; -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricK8sDaemonsetDesiredScheduledNodes(metrics::Meter *meter) { return meter->CreateInt64UpDownCounter(kMetricK8sDaemonsetDesiredScheduledNodes, @@ -656,7 +798,7 @@ CreateSyncInt64MetricK8sDaemonsetDesiredScheduledNodes(metrics::Meter *meter) unitMetricK8sDaemonsetDesiredScheduledNodes); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sDaemonsetDesiredScheduledNodes(metrics::Meter *meter) { return meter->CreateDoubleUpDownCounter(kMetricK8sDaemonsetDesiredScheduledNodes, @@ -664,7 +806,7 @@ CreateSyncDoubleMetricK8sDaemonsetDesiredScheduledNodes(metrics::Meter *meter) unitMetricK8sDaemonsetDesiredScheduledNodes); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncInt64MetricK8sDaemonsetDesiredScheduledNodes(metrics::Meter *meter) { return meter->CreateInt64ObservableUpDownCounter(kMetricK8sDaemonsetDesiredScheduledNodes, @@ -672,7 +814,7 @@ CreateAsyncInt64MetricK8sDaemonsetDesiredScheduledNodes(metrics::Meter *meter) unitMetricK8sDaemonsetDesiredScheduledNodes); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sDaemonsetDesiredScheduledNodes(metrics::Meter *meter) { return meter->CreateDoubleObservableUpDownCounter(kMetricK8sDaemonsetDesiredScheduledNodes, @@ -681,20 +823,23 @@ CreateAsyncDoubleMetricK8sDaemonsetDesiredScheduledNodes(metrics::Meter *meter) } /** - Number of nodes that are running the daemon pod, but are not supposed to run the daemon pod. -

    - This metric aligns with the @code numberMisscheduled @endcode field of the - This metric aligns with the @code + numberMisscheduled @endcode field of the K8s DaemonSetStatus.

    updowncounter */ -static constexpr const char *kMetricK8sDaemonsetMisscheduledNodes = +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sDaemonsetMisscheduledNodes = "k8s.daemonset.misscheduled_nodes"; -static constexpr const char *descrMetricK8sDaemonsetMisscheduledNodes = - "Number of nodes that are running the daemon pod, but are not supposed to run the daemon pod."; -static constexpr const char *unitMetricK8sDaemonsetMisscheduledNodes = "{node}"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sDaemonsetMisscheduledNodes = + "Deprecated, use `k8s.daemonset.node.misscheduled` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sDaemonsetMisscheduledNodes = + "{node}"; -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricK8sDaemonsetMisscheduledNodes(metrics::Meter *meter) { return meter->CreateInt64UpDownCounter(kMetricK8sDaemonsetMisscheduledNodes, @@ -702,7 +847,7 @@ CreateSyncInt64MetricK8sDaemonsetMisscheduledNodes(metrics::Meter *meter) unitMetricK8sDaemonsetMisscheduledNodes); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sDaemonsetMisscheduledNodes(metrics::Meter *meter) { return meter->CreateDoubleUpDownCounter(kMetricK8sDaemonsetMisscheduledNodes, @@ -710,7 +855,7 @@ CreateSyncDoubleMetricK8sDaemonsetMisscheduledNodes(metrics::Meter *meter) unitMetricK8sDaemonsetMisscheduledNodes); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncInt64MetricK8sDaemonsetMisscheduledNodes(metrics::Meter *meter) { return meter->CreateInt64ObservableUpDownCounter(kMetricK8sDaemonsetMisscheduledNodes, @@ -718,7 +863,7 @@ CreateAsyncInt64MetricK8sDaemonsetMisscheduledNodes(metrics::Meter *meter) unitMetricK8sDaemonsetMisscheduledNodes); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sDaemonsetMisscheduledNodes(metrics::Meter *meter) { return meter->CreateDoubleObservableUpDownCounter(kMetricK8sDaemonsetMisscheduledNodes, @@ -727,212 +872,503 @@ CreateAsyncDoubleMetricK8sDaemonsetMisscheduledNodes(metrics::Meter *meter) } /** - Number of nodes that should be running the daemon pod and have one or more of the daemon pod - running and ready.

    This metric aligns with the @code numberReady @endcode field of the + This metric aligns with the @code currentNumberScheduled @endcode field of the + K8s DaemonSetStatus.

    updowncounter */ -static constexpr const char *kMetricK8sDaemonsetReadyNodes = "k8s.daemonset.ready_nodes"; -static constexpr const char *descrMetricK8sDaemonsetReadyNodes = - "Number of nodes that should be running the daemon pod and have one or more of the daemon pod " - "running and ready."; -static constexpr const char *unitMetricK8sDaemonsetReadyNodes = "{node}"; +static constexpr const char *kMetricK8sDaemonsetNodeCurrentScheduled = + "k8s.daemonset.node.current_scheduled"; +static constexpr const char *descrMetricK8sDaemonsetNodeCurrentScheduled = + "Number of nodes that are running at least 1 daemon pod and are supposed to run the daemon " + "pod."; +static constexpr const char *unitMetricK8sDaemonsetNodeCurrentScheduled = "{node}"; static inline nostd::unique_ptr> -CreateSyncInt64MetricK8sDaemonsetReadyNodes(metrics::Meter *meter) +CreateSyncInt64MetricK8sDaemonsetNodeCurrentScheduled(metrics::Meter *meter) { - return meter->CreateInt64UpDownCounter(kMetricK8sDaemonsetReadyNodes, - descrMetricK8sDaemonsetReadyNodes, - unitMetricK8sDaemonsetReadyNodes); + return meter->CreateInt64UpDownCounter(kMetricK8sDaemonsetNodeCurrentScheduled, + descrMetricK8sDaemonsetNodeCurrentScheduled, + unitMetricK8sDaemonsetNodeCurrentScheduled); } static inline nostd::unique_ptr> -CreateSyncDoubleMetricK8sDaemonsetReadyNodes(metrics::Meter *meter) +CreateSyncDoubleMetricK8sDaemonsetNodeCurrentScheduled(metrics::Meter *meter) { - return meter->CreateDoubleUpDownCounter(kMetricK8sDaemonsetReadyNodes, - descrMetricK8sDaemonsetReadyNodes, - unitMetricK8sDaemonsetReadyNodes); + return meter->CreateDoubleUpDownCounter(kMetricK8sDaemonsetNodeCurrentScheduled, + descrMetricK8sDaemonsetNodeCurrentScheduled, + unitMetricK8sDaemonsetNodeCurrentScheduled); } static inline nostd::shared_ptr -CreateAsyncInt64MetricK8sDaemonsetReadyNodes(metrics::Meter *meter) +CreateAsyncInt64MetricK8sDaemonsetNodeCurrentScheduled(metrics::Meter *meter) { - return meter->CreateInt64ObservableUpDownCounter(kMetricK8sDaemonsetReadyNodes, - descrMetricK8sDaemonsetReadyNodes, - unitMetricK8sDaemonsetReadyNodes); + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sDaemonsetNodeCurrentScheduled, + descrMetricK8sDaemonsetNodeCurrentScheduled, + unitMetricK8sDaemonsetNodeCurrentScheduled); } static inline nostd::shared_ptr -CreateAsyncDoubleMetricK8sDaemonsetReadyNodes(metrics::Meter *meter) +CreateAsyncDoubleMetricK8sDaemonsetNodeCurrentScheduled(metrics::Meter *meter) { - return meter->CreateDoubleObservableUpDownCounter(kMetricK8sDaemonsetReadyNodes, - descrMetricK8sDaemonsetReadyNodes, - unitMetricK8sDaemonsetReadyNodes); + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sDaemonsetNodeCurrentScheduled, + descrMetricK8sDaemonsetNodeCurrentScheduled, + unitMetricK8sDaemonsetNodeCurrentScheduled); } /** - Total number of available replica pods (ready for at least minReadySeconds) targeted by this - deployment.

    This metric aligns with the @code availableReplicas @endcode field of the K8s - DeploymentStatus.

    updowncounter + Number of nodes that should be running the daemon pod (including nodes currently running the + daemon pod).

    This metric aligns with the @code desiredNumberScheduled @endcode field of the K8s + DaemonSetStatus.

    updowncounter */ -static constexpr const char *kMetricK8sDeploymentAvailablePods = "k8s.deployment.available_pods"; -static constexpr const char *descrMetricK8sDeploymentAvailablePods = - "Total number of available replica pods (ready for at least minReadySeconds) targeted by this " - "deployment."; -static constexpr const char *unitMetricK8sDeploymentAvailablePods = "{pod}"; +static constexpr const char *kMetricK8sDaemonsetNodeDesiredScheduled = + "k8s.daemonset.node.desired_scheduled"; +static constexpr const char *descrMetricK8sDaemonsetNodeDesiredScheduled = + "Number of nodes that should be running the daemon pod (including nodes currently running the " + "daemon pod)."; +static constexpr const char *unitMetricK8sDaemonsetNodeDesiredScheduled = "{node}"; static inline nostd::unique_ptr> -CreateSyncInt64MetricK8sDeploymentAvailablePods(metrics::Meter *meter) +CreateSyncInt64MetricK8sDaemonsetNodeDesiredScheduled(metrics::Meter *meter) { - return meter->CreateInt64UpDownCounter(kMetricK8sDeploymentAvailablePods, - descrMetricK8sDeploymentAvailablePods, - unitMetricK8sDeploymentAvailablePods); + return meter->CreateInt64UpDownCounter(kMetricK8sDaemonsetNodeDesiredScheduled, + descrMetricK8sDaemonsetNodeDesiredScheduled, + unitMetricK8sDaemonsetNodeDesiredScheduled); } static inline nostd::unique_ptr> -CreateSyncDoubleMetricK8sDeploymentAvailablePods(metrics::Meter *meter) +CreateSyncDoubleMetricK8sDaemonsetNodeDesiredScheduled(metrics::Meter *meter) { - return meter->CreateDoubleUpDownCounter(kMetricK8sDeploymentAvailablePods, - descrMetricK8sDeploymentAvailablePods, - unitMetricK8sDeploymentAvailablePods); + return meter->CreateDoubleUpDownCounter(kMetricK8sDaemonsetNodeDesiredScheduled, + descrMetricK8sDaemonsetNodeDesiredScheduled, + unitMetricK8sDaemonsetNodeDesiredScheduled); } static inline nostd::shared_ptr -CreateAsyncInt64MetricK8sDeploymentAvailablePods(metrics::Meter *meter) +CreateAsyncInt64MetricK8sDaemonsetNodeDesiredScheduled(metrics::Meter *meter) { - return meter->CreateInt64ObservableUpDownCounter(kMetricK8sDeploymentAvailablePods, - descrMetricK8sDeploymentAvailablePods, - unitMetricK8sDeploymentAvailablePods); + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sDaemonsetNodeDesiredScheduled, + descrMetricK8sDaemonsetNodeDesiredScheduled, + unitMetricK8sDaemonsetNodeDesiredScheduled); } static inline nostd::shared_ptr -CreateAsyncDoubleMetricK8sDeploymentAvailablePods(metrics::Meter *meter) +CreateAsyncDoubleMetricK8sDaemonsetNodeDesiredScheduled(metrics::Meter *meter) { - return meter->CreateDoubleObservableUpDownCounter(kMetricK8sDeploymentAvailablePods, - descrMetricK8sDeploymentAvailablePods, - unitMetricK8sDeploymentAvailablePods); + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sDaemonsetNodeDesiredScheduled, + descrMetricK8sDaemonsetNodeDesiredScheduled, + unitMetricK8sDaemonsetNodeDesiredScheduled); } /** - Number of desired replica pods in this deployment. + Number of nodes that are running the daemon pod, but are not supposed to run the daemon pod.

    - This metric aligns with the @code replicas @endcode field of the + This metric aligns with the @code numberMisscheduled @endcode field of the K8s - DeploymentSpec.

    updowncounter + href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps">K8s + DaemonSetStatus.

    updowncounter */ -static constexpr const char *kMetricK8sDeploymentDesiredPods = "k8s.deployment.desired_pods"; -static constexpr const char *descrMetricK8sDeploymentDesiredPods = - "Number of desired replica pods in this deployment."; -static constexpr const char *unitMetricK8sDeploymentDesiredPods = "{pod}"; +static constexpr const char *kMetricK8sDaemonsetNodeMisscheduled = + "k8s.daemonset.node.misscheduled"; +static constexpr const char *descrMetricK8sDaemonsetNodeMisscheduled = + "Number of nodes that are running the daemon pod, but are not supposed to run the daemon pod."; +static constexpr const char *unitMetricK8sDaemonsetNodeMisscheduled = "{node}"; static inline nostd::unique_ptr> -CreateSyncInt64MetricK8sDeploymentDesiredPods(metrics::Meter *meter) +CreateSyncInt64MetricK8sDaemonsetNodeMisscheduled(metrics::Meter *meter) { - return meter->CreateInt64UpDownCounter(kMetricK8sDeploymentDesiredPods, - descrMetricK8sDeploymentDesiredPods, - unitMetricK8sDeploymentDesiredPods); + return meter->CreateInt64UpDownCounter(kMetricK8sDaemonsetNodeMisscheduled, + descrMetricK8sDaemonsetNodeMisscheduled, + unitMetricK8sDaemonsetNodeMisscheduled); } static inline nostd::unique_ptr> -CreateSyncDoubleMetricK8sDeploymentDesiredPods(metrics::Meter *meter) +CreateSyncDoubleMetricK8sDaemonsetNodeMisscheduled(metrics::Meter *meter) { - return meter->CreateDoubleUpDownCounter(kMetricK8sDeploymentDesiredPods, - descrMetricK8sDeploymentDesiredPods, - unitMetricK8sDeploymentDesiredPods); + return meter->CreateDoubleUpDownCounter(kMetricK8sDaemonsetNodeMisscheduled, + descrMetricK8sDaemonsetNodeMisscheduled, + unitMetricK8sDaemonsetNodeMisscheduled); } static inline nostd::shared_ptr -CreateAsyncInt64MetricK8sDeploymentDesiredPods(metrics::Meter *meter) +CreateAsyncInt64MetricK8sDaemonsetNodeMisscheduled(metrics::Meter *meter) { - return meter->CreateInt64ObservableUpDownCounter(kMetricK8sDeploymentDesiredPods, - descrMetricK8sDeploymentDesiredPods, - unitMetricK8sDeploymentDesiredPods); + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sDaemonsetNodeMisscheduled, + descrMetricK8sDaemonsetNodeMisscheduled, + unitMetricK8sDaemonsetNodeMisscheduled); } static inline nostd::shared_ptr -CreateAsyncDoubleMetricK8sDeploymentDesiredPods(metrics::Meter *meter) +CreateAsyncDoubleMetricK8sDaemonsetNodeMisscheduled(metrics::Meter *meter) { - return meter->CreateDoubleObservableUpDownCounter(kMetricK8sDeploymentDesiredPods, - descrMetricK8sDeploymentDesiredPods, - unitMetricK8sDeploymentDesiredPods); + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sDaemonsetNodeMisscheduled, + descrMetricK8sDaemonsetNodeMisscheduled, + unitMetricK8sDaemonsetNodeMisscheduled); } /** - Current number of replica pods managed by this horizontal pod autoscaler, as last seen by the - autoscaler.

    This metric aligns with the @code currentReplicas @endcode field of the K8s - HorizontalPodAutoscalerStatus

    updowncounter + Number of nodes that should be running the daemon pod and have one or more of the daemon pod + running and ready.

    This metric aligns with the @code numberReady @endcode field of the K8s + DaemonSetStatus.

    updowncounter */ -static constexpr const char *kMetricK8sHpaCurrentPods = "k8s.hpa.current_pods"; -static constexpr const char *descrMetricK8sHpaCurrentPods = - "Current number of replica pods managed by this horizontal pod autoscaler, as last seen by the " - "autoscaler."; -static constexpr const char *unitMetricK8sHpaCurrentPods = "{pod}"; +static constexpr const char *kMetricK8sDaemonsetNodeReady = "k8s.daemonset.node.ready"; +static constexpr const char *descrMetricK8sDaemonsetNodeReady = + "Number of nodes that should be running the daemon pod and have one or more of the daemon pod " + "running and ready."; +static constexpr const char *unitMetricK8sDaemonsetNodeReady = "{node}"; static inline nostd::unique_ptr> -CreateSyncInt64MetricK8sHpaCurrentPods(metrics::Meter *meter) +CreateSyncInt64MetricK8sDaemonsetNodeReady(metrics::Meter *meter) { - return meter->CreateInt64UpDownCounter(kMetricK8sHpaCurrentPods, descrMetricK8sHpaCurrentPods, - unitMetricK8sHpaCurrentPods); + return meter->CreateInt64UpDownCounter(kMetricK8sDaemonsetNodeReady, + descrMetricK8sDaemonsetNodeReady, + unitMetricK8sDaemonsetNodeReady); } static inline nostd::unique_ptr> -CreateSyncDoubleMetricK8sHpaCurrentPods(metrics::Meter *meter) +CreateSyncDoubleMetricK8sDaemonsetNodeReady(metrics::Meter *meter) { - return meter->CreateDoubleUpDownCounter(kMetricK8sHpaCurrentPods, descrMetricK8sHpaCurrentPods, - unitMetricK8sHpaCurrentPods); + return meter->CreateDoubleUpDownCounter(kMetricK8sDaemonsetNodeReady, + descrMetricK8sDaemonsetNodeReady, + unitMetricK8sDaemonsetNodeReady); } static inline nostd::shared_ptr -CreateAsyncInt64MetricK8sHpaCurrentPods(metrics::Meter *meter) +CreateAsyncInt64MetricK8sDaemonsetNodeReady(metrics::Meter *meter) { - return meter->CreateInt64ObservableUpDownCounter( - kMetricK8sHpaCurrentPods, descrMetricK8sHpaCurrentPods, unitMetricK8sHpaCurrentPods); + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sDaemonsetNodeReady, + descrMetricK8sDaemonsetNodeReady, + unitMetricK8sDaemonsetNodeReady); } static inline nostd::shared_ptr -CreateAsyncDoubleMetricK8sHpaCurrentPods(metrics::Meter *meter) +CreateAsyncDoubleMetricK8sDaemonsetNodeReady(metrics::Meter *meter) { - return meter->CreateDoubleObservableUpDownCounter( - kMetricK8sHpaCurrentPods, descrMetricK8sHpaCurrentPods, unitMetricK8sHpaCurrentPods); + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sDaemonsetNodeReady, + descrMetricK8sDaemonsetNodeReady, + unitMetricK8sDaemonsetNodeReady); } /** - Desired number of replica pods managed by this horizontal pod autoscaler, as last calculated by - the autoscaler.

    This metric aligns with the @code desiredReplicas @endcode field of the K8s - HorizontalPodAutoscalerStatus

    updowncounter + Deprecated, use @code k8s.daemonset.node.ready @endcode instead. + + @deprecated + {"note": "Replaced by @code k8s.daemonset.node.ready @endcode.", "reason": "renamed", + "renamed_to": "k8s.daemonset.node.ready"}

    This metric aligns with the @code numberReady + @endcode field of the K8s + DaemonSetStatus.

    updowncounter */ -static constexpr const char *kMetricK8sHpaDesiredPods = "k8s.hpa.desired_pods"; -static constexpr const char *descrMetricK8sHpaDesiredPods = - "Desired number of replica pods managed by this horizontal pod autoscaler, as last calculated " - "by the autoscaler."; -static constexpr const char *unitMetricK8sHpaDesiredPods = "{pod}"; +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sDaemonsetReadyNodes = + "k8s.daemonset.ready_nodes"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sDaemonsetReadyNodes = + "Deprecated, use `k8s.daemonset.node.ready` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sDaemonsetReadyNodes = "{node}"; -static inline nostd::unique_ptr> -CreateSyncInt64MetricK8sHpaDesiredPods(metrics::Meter *meter) +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sDaemonsetReadyNodes(metrics::Meter *meter) { - return meter->CreateInt64UpDownCounter(kMetricK8sHpaDesiredPods, descrMetricK8sHpaDesiredPods, - unitMetricK8sHpaDesiredPods); + return meter->CreateInt64UpDownCounter(kMetricK8sDaemonsetReadyNodes, + descrMetricK8sDaemonsetReadyNodes, + unitMetricK8sDaemonsetReadyNodes); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sDaemonsetReadyNodes(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sDaemonsetReadyNodes, + descrMetricK8sDaemonsetReadyNodes, + unitMetricK8sDaemonsetReadyNodes); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sDaemonsetReadyNodes(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sDaemonsetReadyNodes, + descrMetricK8sDaemonsetReadyNodes, + unitMetricK8sDaemonsetReadyNodes); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sDaemonsetReadyNodes(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sDaemonsetReadyNodes, + descrMetricK8sDaemonsetReadyNodes, + unitMetricK8sDaemonsetReadyNodes); +} + +/** + Deprecated, use @code k8s.deployment.pod.available @endcode instead. + + @deprecated + {"note": "Replaced by @code k8s.deployment.pod.available @endcode.", "reason": "renamed", + "renamed_to": "k8s.deployment.pod.available"}

    This metric aligns with the @code + availableReplicas @endcode field of the K8s + DeploymentStatus.

    updowncounter + */ +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sDeploymentAvailablePods = + "k8s.deployment.available_pods"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sDeploymentAvailablePods = + "Deprecated, use `k8s.deployment.pod.available` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sDeploymentAvailablePods = + "{pod}"; + +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sDeploymentAvailablePods(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sDeploymentAvailablePods, + descrMetricK8sDeploymentAvailablePods, + unitMetricK8sDeploymentAvailablePods); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sDeploymentAvailablePods(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sDeploymentAvailablePods, + descrMetricK8sDeploymentAvailablePods, + unitMetricK8sDeploymentAvailablePods); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sDeploymentAvailablePods(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sDeploymentAvailablePods, + descrMetricK8sDeploymentAvailablePods, + unitMetricK8sDeploymentAvailablePods); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sDeploymentAvailablePods(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sDeploymentAvailablePods, + descrMetricK8sDeploymentAvailablePods, + unitMetricK8sDeploymentAvailablePods); +} + +/** + Deprecated, use @code k8s.deployment.pod.desired @endcode instead. + + @deprecated + {"note": "Replaced by @code k8s.deployment.pod.desired @endcode.", "reason": "renamed", + "renamed_to": "k8s.deployment.pod.desired"}

    This metric aligns with the @code replicas + @endcode field of the K8s + DeploymentSpec.

    updowncounter + */ +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sDeploymentDesiredPods = + "k8s.deployment.desired_pods"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sDeploymentDesiredPods = + "Deprecated, use `k8s.deployment.pod.desired` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sDeploymentDesiredPods = "{pod}"; + +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sDeploymentDesiredPods(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sDeploymentDesiredPods, + descrMetricK8sDeploymentDesiredPods, + unitMetricK8sDeploymentDesiredPods); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sDeploymentDesiredPods(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sDeploymentDesiredPods, + descrMetricK8sDeploymentDesiredPods, + unitMetricK8sDeploymentDesiredPods); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sDeploymentDesiredPods(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sDeploymentDesiredPods, + descrMetricK8sDeploymentDesiredPods, + unitMetricK8sDeploymentDesiredPods); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sDeploymentDesiredPods(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sDeploymentDesiredPods, + descrMetricK8sDeploymentDesiredPods, + unitMetricK8sDeploymentDesiredPods); +} + +/** + Total number of available replica pods (ready for at least minReadySeconds) targeted by this + deployment.

    This metric aligns with the @code availableReplicas @endcode field of the K8s + DeploymentStatus.

    updowncounter + */ +static constexpr const char *kMetricK8sDeploymentPodAvailable = "k8s.deployment.pod.available"; +static constexpr const char *descrMetricK8sDeploymentPodAvailable = + "Total number of available replica pods (ready for at least minReadySeconds) targeted by this " + "deployment."; +static constexpr const char *unitMetricK8sDeploymentPodAvailable = "{pod}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sDeploymentPodAvailable(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sDeploymentPodAvailable, + descrMetricK8sDeploymentPodAvailable, + unitMetricK8sDeploymentPodAvailable); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sDeploymentPodAvailable(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sDeploymentPodAvailable, + descrMetricK8sDeploymentPodAvailable, + unitMetricK8sDeploymentPodAvailable); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sDeploymentPodAvailable(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sDeploymentPodAvailable, + descrMetricK8sDeploymentPodAvailable, + unitMetricK8sDeploymentPodAvailable); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sDeploymentPodAvailable(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sDeploymentPodAvailable, + descrMetricK8sDeploymentPodAvailable, + unitMetricK8sDeploymentPodAvailable); +} + +/** + Number of desired replica pods in this deployment. +

    + This metric aligns with the @code replicas @endcode field of the + K8s + DeploymentSpec.

    updowncounter + */ +static constexpr const char *kMetricK8sDeploymentPodDesired = "k8s.deployment.pod.desired"; +static constexpr const char *descrMetricK8sDeploymentPodDesired = + "Number of desired replica pods in this deployment."; +static constexpr const char *unitMetricK8sDeploymentPodDesired = "{pod}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sDeploymentPodDesired(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sDeploymentPodDesired, + descrMetricK8sDeploymentPodDesired, + unitMetricK8sDeploymentPodDesired); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sDeploymentPodDesired(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sDeploymentPodDesired, + descrMetricK8sDeploymentPodDesired, + unitMetricK8sDeploymentPodDesired); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sDeploymentPodDesired(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sDeploymentPodDesired, + descrMetricK8sDeploymentPodDesired, + unitMetricK8sDeploymentPodDesired); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sDeploymentPodDesired(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sDeploymentPodDesired, + descrMetricK8sDeploymentPodDesired, + unitMetricK8sDeploymentPodDesired); +} + +/** + Deprecated, use @code k8s.hpa.pod.current @endcode instead. + + @deprecated + {"note": "Replaced by @code k8s.hpa.pod.current @endcode.", "reason": "renamed", "renamed_to": + "k8s.hpa.pod.current"}

    This metric aligns with the @code currentReplicas @endcode field of the + K8s + HorizontalPodAutoscalerStatus

    updowncounter + */ +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sHpaCurrentPods = + "k8s.hpa.current_pods"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sHpaCurrentPods = + "Deprecated, use `k8s.hpa.pod.current` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sHpaCurrentPods = "{pod}"; + +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sHpaCurrentPods(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sHpaCurrentPods, descrMetricK8sHpaCurrentPods, + unitMetricK8sHpaCurrentPods); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sHpaCurrentPods(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sHpaCurrentPods, descrMetricK8sHpaCurrentPods, + unitMetricK8sHpaCurrentPods); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sHpaCurrentPods(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricK8sHpaCurrentPods, descrMetricK8sHpaCurrentPods, unitMetricK8sHpaCurrentPods); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sHpaCurrentPods(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricK8sHpaCurrentPods, descrMetricK8sHpaCurrentPods, unitMetricK8sHpaCurrentPods); +} + +/** + Deprecated, use @code k8s.hpa.pod.desired @endcode instead. + + @deprecated + {"note": "Replaced by @code k8s.hpa.pod.desired @endcode.", "reason": "renamed", "renamed_to": + "k8s.hpa.pod.desired"}

    This metric aligns with the @code desiredReplicas @endcode field of the + K8s + HorizontalPodAutoscalerStatus

    updowncounter + */ +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sHpaDesiredPods = + "k8s.hpa.desired_pods"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sHpaDesiredPods = + "Deprecated, use `k8s.hpa.pod.desired` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sHpaDesiredPods = "{pod}"; + +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sHpaDesiredPods(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sHpaDesiredPods, descrMetricK8sHpaDesiredPods, + unitMetricK8sHpaDesiredPods); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sHpaDesiredPods(metrics::Meter *meter) { return meter->CreateDoubleUpDownCounter(kMetricK8sHpaDesiredPods, descrMetricK8sHpaDesiredPods, unitMetricK8sHpaDesiredPods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncInt64MetricK8sHpaDesiredPods(metrics::Meter *meter) { return meter->CreateInt64ObservableUpDownCounter( kMetricK8sHpaDesiredPods, descrMetricK8sHpaDesiredPods, unitMetricK8sHpaDesiredPods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sHpaDesiredPods(metrics::Meter *meter) { return meter->CreateDoubleObservableUpDownCounter( @@ -940,41 +1376,42 @@ CreateAsyncDoubleMetricK8sHpaDesiredPods(metrics::Meter *meter) } /** - The upper limit for the number of replica pods to which the autoscaler can scale up. -

    - This metric aligns with the @code maxReplicas @endcode field of the - This metric aligns with the @code maxReplicas @endcode field of the K8s HorizontalPodAutoscalerSpec

    updowncounter */ -static constexpr const char *kMetricK8sHpaMaxPods = "k8s.hpa.max_pods"; -static constexpr const char *descrMetricK8sHpaMaxPods = - "The upper limit for the number of replica pods to which the autoscaler can scale up."; -static constexpr const char *unitMetricK8sHpaMaxPods = "{pod}"; +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sHpaMaxPods = "k8s.hpa.max_pods"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sHpaMaxPods = + "Deprecated, use `k8s.hpa.pod.max` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sHpaMaxPods = "{pod}"; -static inline nostd::unique_ptr> CreateSyncInt64MetricK8sHpaMaxPods( - metrics::Meter *meter) +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sHpaMaxPods(metrics::Meter *meter) { return meter->CreateInt64UpDownCounter(kMetricK8sHpaMaxPods, descrMetricK8sHpaMaxPods, unitMetricK8sHpaMaxPods); } -static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sHpaMaxPods( - metrics::Meter *meter) +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sHpaMaxPods(metrics::Meter *meter) { return meter->CreateDoubleUpDownCounter(kMetricK8sHpaMaxPods, descrMetricK8sHpaMaxPods, unitMetricK8sHpaMaxPods); } -static inline nostd::shared_ptr CreateAsyncInt64MetricK8sHpaMaxPods( - metrics::Meter *meter) +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sHpaMaxPods(metrics::Meter *meter) { return meter->CreateInt64ObservableUpDownCounter(kMetricK8sHpaMaxPods, descrMetricK8sHpaMaxPods, unitMetricK8sHpaMaxPods); } -static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sHpaMaxPods( - metrics::Meter *meter) +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sHpaMaxPods(metrics::Meter *meter) { return meter->CreateDoubleObservableUpDownCounter(kMetricK8sHpaMaxPods, descrMetricK8sHpaMaxPods, unitMetricK8sHpaMaxPods); @@ -1136,81 +1573,246 @@ CreateAsyncDoubleMetricK8sHpaMetricTargetCpuValue(metrics::Meter *meter) } /** - The lower limit for the number of replica pods to which the autoscaler can scale down. -

    - This metric aligns with the @code minReplicas @endcode field of the - This metric aligns with the @code minReplicas @endcode field of the K8s HorizontalPodAutoscalerSpec

    updowncounter */ -static constexpr const char *kMetricK8sHpaMinPods = "k8s.hpa.min_pods"; -static constexpr const char *descrMetricK8sHpaMinPods = - "The lower limit for the number of replica pods to which the autoscaler can scale down."; -static constexpr const char *unitMetricK8sHpaMinPods = "{pod}"; +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sHpaMinPods = "k8s.hpa.min_pods"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sHpaMinPods = + "Deprecated, use `k8s.hpa.pod.min` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sHpaMinPods = "{pod}"; -static inline nostd::unique_ptr> CreateSyncInt64MetricK8sHpaMinPods( - metrics::Meter *meter) +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sHpaMinPods(metrics::Meter *meter) { return meter->CreateInt64UpDownCounter(kMetricK8sHpaMinPods, descrMetricK8sHpaMinPods, unitMetricK8sHpaMinPods); } -static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sHpaMinPods( - metrics::Meter *meter) +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sHpaMinPods(metrics::Meter *meter) { return meter->CreateDoubleUpDownCounter(kMetricK8sHpaMinPods, descrMetricK8sHpaMinPods, unitMetricK8sHpaMinPods); } -static inline nostd::shared_ptr CreateAsyncInt64MetricK8sHpaMinPods( - metrics::Meter *meter) +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sHpaMinPods(metrics::Meter *meter) { return meter->CreateInt64ObservableUpDownCounter(kMetricK8sHpaMinPods, descrMetricK8sHpaMinPods, unitMetricK8sHpaMinPods); } -static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sHpaMinPods( - metrics::Meter *meter) +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sHpaMinPods(metrics::Meter *meter) { return meter->CreateDoubleObservableUpDownCounter(kMetricK8sHpaMinPods, descrMetricK8sHpaMinPods, unitMetricK8sHpaMinPods); } /** - The number of pending and actively running pods for a job. -

    - This metric aligns with the @code active @endcode field of the - K8s - JobStatus.

    updowncounter + Current number of replica pods managed by this horizontal pod autoscaler, as last seen by the + autoscaler.

    This metric aligns with the @code currentReplicas @endcode field of the K8s + HorizontalPodAutoscalerStatus

    updowncounter */ -static constexpr const char *kMetricK8sJobActivePods = "k8s.job.active_pods"; -static constexpr const char *descrMetricK8sJobActivePods = - "The number of pending and actively running pods for a job."; -static constexpr const char *unitMetricK8sJobActivePods = "{pod}"; +static constexpr const char *kMetricK8sHpaPodCurrent = "k8s.hpa.pod.current"; +static constexpr const char *descrMetricK8sHpaPodCurrent = + "Current number of replica pods managed by this horizontal pod autoscaler, as last seen by the " + "autoscaler."; +static constexpr const char *unitMetricK8sHpaPodCurrent = "{pod}"; static inline nostd::unique_ptr> -CreateSyncInt64MetricK8sJobActivePods(metrics::Meter *meter) +CreateSyncInt64MetricK8sHpaPodCurrent(metrics::Meter *meter) { - return meter->CreateInt64UpDownCounter(kMetricK8sJobActivePods, descrMetricK8sJobActivePods, - unitMetricK8sJobActivePods); + return meter->CreateInt64UpDownCounter(kMetricK8sHpaPodCurrent, descrMetricK8sHpaPodCurrent, + unitMetricK8sHpaPodCurrent); } static inline nostd::unique_ptr> -CreateSyncDoubleMetricK8sJobActivePods(metrics::Meter *meter) +CreateSyncDoubleMetricK8sHpaPodCurrent(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sHpaPodCurrent, descrMetricK8sHpaPodCurrent, + unitMetricK8sHpaPodCurrent); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sHpaPodCurrent(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricK8sHpaPodCurrent, descrMetricK8sHpaPodCurrent, unitMetricK8sHpaPodCurrent); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sHpaPodCurrent(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricK8sHpaPodCurrent, descrMetricK8sHpaPodCurrent, unitMetricK8sHpaPodCurrent); +} + +/** + Desired number of replica pods managed by this horizontal pod autoscaler, as last calculated by + the autoscaler.

    This metric aligns with the @code desiredReplicas @endcode field of the K8s + HorizontalPodAutoscalerStatus

    updowncounter + */ +static constexpr const char *kMetricK8sHpaPodDesired = "k8s.hpa.pod.desired"; +static constexpr const char *descrMetricK8sHpaPodDesired = + "Desired number of replica pods managed by this horizontal pod autoscaler, as last calculated " + "by the autoscaler."; +static constexpr const char *unitMetricK8sHpaPodDesired = "{pod}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sHpaPodDesired(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sHpaPodDesired, descrMetricK8sHpaPodDesired, + unitMetricK8sHpaPodDesired); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sHpaPodDesired(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sHpaPodDesired, descrMetricK8sHpaPodDesired, + unitMetricK8sHpaPodDesired); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sHpaPodDesired(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricK8sHpaPodDesired, descrMetricK8sHpaPodDesired, unitMetricK8sHpaPodDesired); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sHpaPodDesired(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricK8sHpaPodDesired, descrMetricK8sHpaPodDesired, unitMetricK8sHpaPodDesired); +} + +/** + The upper limit for the number of replica pods to which the autoscaler can scale up. +

    + This metric aligns with the @code maxReplicas @endcode field of the + K8s + HorizontalPodAutoscalerSpec

    updowncounter + */ +static constexpr const char *kMetricK8sHpaPodMax = "k8s.hpa.pod.max"; +static constexpr const char *descrMetricK8sHpaPodMax = + "The upper limit for the number of replica pods to which the autoscaler can scale up."; +static constexpr const char *unitMetricK8sHpaPodMax = "{pod}"; + +static inline nostd::unique_ptr> CreateSyncInt64MetricK8sHpaPodMax( + metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sHpaPodMax, descrMetricK8sHpaPodMax, + unitMetricK8sHpaPodMax); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sHpaPodMax( + metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sHpaPodMax, descrMetricK8sHpaPodMax, + unitMetricK8sHpaPodMax); +} + +static inline nostd::shared_ptr CreateAsyncInt64MetricK8sHpaPodMax( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sHpaPodMax, descrMetricK8sHpaPodMax, + unitMetricK8sHpaPodMax); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sHpaPodMax( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sHpaPodMax, descrMetricK8sHpaPodMax, + unitMetricK8sHpaPodMax); +} + +/** + The lower limit for the number of replica pods to which the autoscaler can scale down. +

    + This metric aligns with the @code minReplicas @endcode field of the + K8s + HorizontalPodAutoscalerSpec

    updowncounter + */ +static constexpr const char *kMetricK8sHpaPodMin = "k8s.hpa.pod.min"; +static constexpr const char *descrMetricK8sHpaPodMin = + "The lower limit for the number of replica pods to which the autoscaler can scale down."; +static constexpr const char *unitMetricK8sHpaPodMin = "{pod}"; + +static inline nostd::unique_ptr> CreateSyncInt64MetricK8sHpaPodMin( + metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sHpaPodMin, descrMetricK8sHpaPodMin, + unitMetricK8sHpaPodMin); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sHpaPodMin( + metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sHpaPodMin, descrMetricK8sHpaPodMin, + unitMetricK8sHpaPodMin); +} + +static inline nostd::shared_ptr CreateAsyncInt64MetricK8sHpaPodMin( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sHpaPodMin, descrMetricK8sHpaPodMin, + unitMetricK8sHpaPodMin); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sHpaPodMin( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sHpaPodMin, descrMetricK8sHpaPodMin, + unitMetricK8sHpaPodMin); +} + +/** + Deprecated, use @code k8s.job.pod.active @endcode instead. + + @deprecated + {"note": "Replaced by @code k8s.job.pod.active @endcode.", "reason": "renamed", "renamed_to": + "k8s.job.pod.active"}

    This metric aligns with the @code active @endcode field of the K8s + JobStatus.

    updowncounter + */ +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sJobActivePods = + "k8s.job.active_pods"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sJobActivePods = + "Deprecated, use `k8s.job.pod.active` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sJobActivePods = "{pod}"; + +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sJobActivePods(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sJobActivePods, descrMetricK8sJobActivePods, + unitMetricK8sJobActivePods); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sJobActivePods(metrics::Meter *meter) { return meter->CreateDoubleUpDownCounter(kMetricK8sJobActivePods, descrMetricK8sJobActivePods, unitMetricK8sJobActivePods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncInt64MetricK8sJobActivePods(metrics::Meter *meter) { return meter->CreateInt64ObservableUpDownCounter( kMetricK8sJobActivePods, descrMetricK8sJobActivePods, unitMetricK8sJobActivePods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sJobActivePods(metrics::Meter *meter) { return meter->CreateDoubleObservableUpDownCounter( @@ -1218,19 +1820,23 @@ CreateAsyncDoubleMetricK8sJobActivePods(metrics::Meter *meter) } /** - The desired number of successfully finished pods the job should be run with. -

    - This metric aligns with the @code completions @endcode field of the - This metric aligns with the @code completions + @endcode field of the K8s JobSpec..

    updowncounter */ -static constexpr const char *kMetricK8sJobDesiredSuccessfulPods = "k8s.job.desired_successful_pods"; -static constexpr const char *descrMetricK8sJobDesiredSuccessfulPods = - "The desired number of successfully finished pods the job should be run with."; -static constexpr const char *unitMetricK8sJobDesiredSuccessfulPods = "{pod}"; +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sJobDesiredSuccessfulPods = + "k8s.job.desired_successful_pods"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sJobDesiredSuccessfulPods = + "Deprecated, use `k8s.job.pod.desired_successful` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sJobDesiredSuccessfulPods = + "{pod}"; -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricK8sJobDesiredSuccessfulPods(metrics::Meter *meter) { return meter->CreateInt64UpDownCounter(kMetricK8sJobDesiredSuccessfulPods, @@ -1238,7 +1844,7 @@ CreateSyncInt64MetricK8sJobDesiredSuccessfulPods(metrics::Meter *meter) unitMetricK8sJobDesiredSuccessfulPods); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sJobDesiredSuccessfulPods(metrics::Meter *meter) { return meter->CreateDoubleUpDownCounter(kMetricK8sJobDesiredSuccessfulPods, @@ -1246,7 +1852,7 @@ CreateSyncDoubleMetricK8sJobDesiredSuccessfulPods(metrics::Meter *meter) unitMetricK8sJobDesiredSuccessfulPods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncInt64MetricK8sJobDesiredSuccessfulPods(metrics::Meter *meter) { return meter->CreateInt64ObservableUpDownCounter(kMetricK8sJobDesiredSuccessfulPods, @@ -1254,7 +1860,7 @@ CreateAsyncInt64MetricK8sJobDesiredSuccessfulPods(metrics::Meter *meter) unitMetricK8sJobDesiredSuccessfulPods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sJobDesiredSuccessfulPods(metrics::Meter *meter) { return meter->CreateDoubleObservableUpDownCounter(kMetricK8sJobDesiredSuccessfulPods, @@ -1263,46 +1869,223 @@ CreateAsyncDoubleMetricK8sJobDesiredSuccessfulPods(metrics::Meter *meter) } /** - The number of pods which reached phase Failed for a job. -

    - This metric aligns with the @code failed @endcode field of the - This metric aligns with the @code failed @endcode field of the K8s JobStatus.

    updowncounter */ -static constexpr const char *kMetricK8sJobFailedPods = "k8s.job.failed_pods"; -static constexpr const char *descrMetricK8sJobFailedPods = - "The number of pods which reached phase Failed for a job."; -static constexpr const char *unitMetricK8sJobFailedPods = "{pod}"; +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sJobFailedPods = + "k8s.job.failed_pods"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sJobFailedPods = + "Deprecated, use `k8s.job.pod.failed` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sJobFailedPods = "{pod}"; -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricK8sJobFailedPods(metrics::Meter *meter) { return meter->CreateInt64UpDownCounter(kMetricK8sJobFailedPods, descrMetricK8sJobFailedPods, unitMetricK8sJobFailedPods); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sJobFailedPods(metrics::Meter *meter) { return meter->CreateDoubleUpDownCounter(kMetricK8sJobFailedPods, descrMetricK8sJobFailedPods, unitMetricK8sJobFailedPods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncInt64MetricK8sJobFailedPods(metrics::Meter *meter) { return meter->CreateInt64ObservableUpDownCounter( kMetricK8sJobFailedPods, descrMetricK8sJobFailedPods, unitMetricK8sJobFailedPods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sJobFailedPods(metrics::Meter *meter) { return meter->CreateDoubleObservableUpDownCounter( kMetricK8sJobFailedPods, descrMetricK8sJobFailedPods, unitMetricK8sJobFailedPods); } +/** + Deprecated, use @code k8s.job.pod.max_parallel @endcode instead. + + @deprecated + {"note": "Replaced by @code k8s.job.pod.max_parallel @endcode.", "reason": "renamed", + "renamed_to": "k8s.job.pod.max_parallel"}

    This metric aligns with the @code parallelism + @endcode field of the K8s + JobSpec.

    updowncounter + */ +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sJobMaxParallelPods = + "k8s.job.max_parallel_pods"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sJobMaxParallelPods = + "Deprecated, use `k8s.job.pod.max_parallel` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sJobMaxParallelPods = "{pod}"; + +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sJobMaxParallelPods(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sJobMaxParallelPods, + descrMetricK8sJobMaxParallelPods, + unitMetricK8sJobMaxParallelPods); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sJobMaxParallelPods(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sJobMaxParallelPods, + descrMetricK8sJobMaxParallelPods, + unitMetricK8sJobMaxParallelPods); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sJobMaxParallelPods(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sJobMaxParallelPods, + descrMetricK8sJobMaxParallelPods, + unitMetricK8sJobMaxParallelPods); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sJobMaxParallelPods(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sJobMaxParallelPods, + descrMetricK8sJobMaxParallelPods, + unitMetricK8sJobMaxParallelPods); +} + +/** + The number of pending and actively running pods for a job. +

    + This metric aligns with the @code active @endcode field of the + K8s + JobStatus.

    updowncounter + */ +static constexpr const char *kMetricK8sJobPodActive = "k8s.job.pod.active"; +static constexpr const char *descrMetricK8sJobPodActive = + "The number of pending and actively running pods for a job."; +static constexpr const char *unitMetricK8sJobPodActive = "{pod}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sJobPodActive(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sJobPodActive, descrMetricK8sJobPodActive, + unitMetricK8sJobPodActive); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sJobPodActive(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sJobPodActive, descrMetricK8sJobPodActive, + unitMetricK8sJobPodActive); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sJobPodActive(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricK8sJobPodActive, descrMetricK8sJobPodActive, unitMetricK8sJobPodActive); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sJobPodActive(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricK8sJobPodActive, descrMetricK8sJobPodActive, unitMetricK8sJobPodActive); +} + +/** + The desired number of successfully finished pods the job should be run with. +

    + This metric aligns with the @code completions @endcode field of the + K8s + JobSpec..

    updowncounter + */ +static constexpr const char *kMetricK8sJobPodDesiredSuccessful = "k8s.job.pod.desired_successful"; +static constexpr const char *descrMetricK8sJobPodDesiredSuccessful = + "The desired number of successfully finished pods the job should be run with."; +static constexpr const char *unitMetricK8sJobPodDesiredSuccessful = "{pod}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sJobPodDesiredSuccessful(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sJobPodDesiredSuccessful, + descrMetricK8sJobPodDesiredSuccessful, + unitMetricK8sJobPodDesiredSuccessful); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sJobPodDesiredSuccessful(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sJobPodDesiredSuccessful, + descrMetricK8sJobPodDesiredSuccessful, + unitMetricK8sJobPodDesiredSuccessful); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sJobPodDesiredSuccessful(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sJobPodDesiredSuccessful, + descrMetricK8sJobPodDesiredSuccessful, + unitMetricK8sJobPodDesiredSuccessful); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sJobPodDesiredSuccessful(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sJobPodDesiredSuccessful, + descrMetricK8sJobPodDesiredSuccessful, + unitMetricK8sJobPodDesiredSuccessful); +} + +/** + The number of pods which reached phase Failed for a job. +

    + This metric aligns with the @code failed @endcode field of the + K8s + JobStatus.

    updowncounter + */ +static constexpr const char *kMetricK8sJobPodFailed = "k8s.job.pod.failed"; +static constexpr const char *descrMetricK8sJobPodFailed = + "The number of pods which reached phase Failed for a job."; +static constexpr const char *unitMetricK8sJobPodFailed = "{pod}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sJobPodFailed(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sJobPodFailed, descrMetricK8sJobPodFailed, + unitMetricK8sJobPodFailed); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sJobPodFailed(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sJobPodFailed, descrMetricK8sJobPodFailed, + unitMetricK8sJobPodFailed); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sJobPodFailed(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricK8sJobPodFailed, descrMetricK8sJobPodFailed, unitMetricK8sJobPodFailed); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sJobPodFailed(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricK8sJobPodFailed, descrMetricK8sJobPodFailed, unitMetricK8sJobPodFailed); +} + /** The max desired number of pods the job should run at any given time.

    @@ -1311,78 +2094,117 @@ CreateAsyncDoubleMetricK8sJobFailedPods(metrics::Meter *meter) href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#jobspec-v1-batch">K8s JobSpec.

    updowncounter */ -static constexpr const char *kMetricK8sJobMaxParallelPods = "k8s.job.max_parallel_pods"; -static constexpr const char *descrMetricK8sJobMaxParallelPods = +static constexpr const char *kMetricK8sJobPodMaxParallel = "k8s.job.pod.max_parallel"; +static constexpr const char *descrMetricK8sJobPodMaxParallel = "The max desired number of pods the job should run at any given time."; -static constexpr const char *unitMetricK8sJobMaxParallelPods = "{pod}"; +static constexpr const char *unitMetricK8sJobPodMaxParallel = "{pod}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sJobPodMaxParallel(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter( + kMetricK8sJobPodMaxParallel, descrMetricK8sJobPodMaxParallel, unitMetricK8sJobPodMaxParallel); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sJobPodMaxParallel(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter( + kMetricK8sJobPodMaxParallel, descrMetricK8sJobPodMaxParallel, unitMetricK8sJobPodMaxParallel); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sJobPodMaxParallel(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricK8sJobPodMaxParallel, descrMetricK8sJobPodMaxParallel, unitMetricK8sJobPodMaxParallel); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sJobPodMaxParallel(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricK8sJobPodMaxParallel, descrMetricK8sJobPodMaxParallel, unitMetricK8sJobPodMaxParallel); +} + +/** + The number of pods which reached phase Succeeded for a job. +

    + This metric aligns with the @code succeeded @endcode field of the + K8s + JobStatus.

    updowncounter + */ +static constexpr const char *kMetricK8sJobPodSuccessful = "k8s.job.pod.successful"; +static constexpr const char *descrMetricK8sJobPodSuccessful = + "The number of pods which reached phase Succeeded for a job."; +static constexpr const char *unitMetricK8sJobPodSuccessful = "{pod}"; static inline nostd::unique_ptr> -CreateSyncInt64MetricK8sJobMaxParallelPods(metrics::Meter *meter) +CreateSyncInt64MetricK8sJobPodSuccessful(metrics::Meter *meter) { - return meter->CreateInt64UpDownCounter(kMetricK8sJobMaxParallelPods, - descrMetricK8sJobMaxParallelPods, - unitMetricK8sJobMaxParallelPods); + return meter->CreateInt64UpDownCounter(kMetricK8sJobPodSuccessful, descrMetricK8sJobPodSuccessful, + unitMetricK8sJobPodSuccessful); } static inline nostd::unique_ptr> -CreateSyncDoubleMetricK8sJobMaxParallelPods(metrics::Meter *meter) +CreateSyncDoubleMetricK8sJobPodSuccessful(metrics::Meter *meter) { - return meter->CreateDoubleUpDownCounter(kMetricK8sJobMaxParallelPods, - descrMetricK8sJobMaxParallelPods, - unitMetricK8sJobMaxParallelPods); + return meter->CreateDoubleUpDownCounter( + kMetricK8sJobPodSuccessful, descrMetricK8sJobPodSuccessful, unitMetricK8sJobPodSuccessful); } static inline nostd::shared_ptr -CreateAsyncInt64MetricK8sJobMaxParallelPods(metrics::Meter *meter) +CreateAsyncInt64MetricK8sJobPodSuccessful(metrics::Meter *meter) { - return meter->CreateInt64ObservableUpDownCounter(kMetricK8sJobMaxParallelPods, - descrMetricK8sJobMaxParallelPods, - unitMetricK8sJobMaxParallelPods); + return meter->CreateInt64ObservableUpDownCounter( + kMetricK8sJobPodSuccessful, descrMetricK8sJobPodSuccessful, unitMetricK8sJobPodSuccessful); } static inline nostd::shared_ptr -CreateAsyncDoubleMetricK8sJobMaxParallelPods(metrics::Meter *meter) +CreateAsyncDoubleMetricK8sJobPodSuccessful(metrics::Meter *meter) { - return meter->CreateDoubleObservableUpDownCounter(kMetricK8sJobMaxParallelPods, - descrMetricK8sJobMaxParallelPods, - unitMetricK8sJobMaxParallelPods); + return meter->CreateDoubleObservableUpDownCounter( + kMetricK8sJobPodSuccessful, descrMetricK8sJobPodSuccessful, unitMetricK8sJobPodSuccessful); } /** - The number of pods which reached phase Succeeded for a job. -

    - This metric aligns with the @code succeeded @endcode field of the - This metric aligns with the @code succeeded @endcode field of the K8s JobStatus.

    updowncounter */ -static constexpr const char *kMetricK8sJobSuccessfulPods = "k8s.job.successful_pods"; -static constexpr const char *descrMetricK8sJobSuccessfulPods = - "The number of pods which reached phase Succeeded for a job."; -static constexpr const char *unitMetricK8sJobSuccessfulPods = "{pod}"; +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sJobSuccessfulPods = + "k8s.job.successful_pods"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sJobSuccessfulPods = + "Deprecated, use `k8s.job.pod.successful` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sJobSuccessfulPods = "{pod}"; -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricK8sJobSuccessfulPods(metrics::Meter *meter) { return meter->CreateInt64UpDownCounter( kMetricK8sJobSuccessfulPods, descrMetricK8sJobSuccessfulPods, unitMetricK8sJobSuccessfulPods); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sJobSuccessfulPods(metrics::Meter *meter) { return meter->CreateDoubleUpDownCounter( kMetricK8sJobSuccessfulPods, descrMetricK8sJobSuccessfulPods, unitMetricK8sJobSuccessfulPods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncInt64MetricK8sJobSuccessfulPods(metrics::Meter *meter) { return meter->CreateInt64ObservableUpDownCounter( kMetricK8sJobSuccessfulPods, descrMetricK8sJobSuccessfulPods, unitMetricK8sJobSuccessfulPods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sJobSuccessfulPods(metrics::Meter *meter) { return meter->CreateDoubleObservableUpDownCounter( @@ -1428,16 +2250,19 @@ CreateAsyncDoubleMetricK8sNamespacePhase(metrics::Meter *meter) } /** - Amount of cpu allocatable on the node. -

    - updowncounter + Deprecated, use @code k8s.node.cpu.allocatable @endcode instead. + + @deprecated + {"note": "Replaced by @code k8s.node.cpu.allocatable @endcode.", "reason": "renamed", + "renamed_to": "k8s.node.cpu.allocatable"}

    updowncounter */ -static constexpr const char *kMetricK8sNodeAllocatableCpu = "k8s.node.allocatable.cpu"; -static constexpr const char *descrMetricK8sNodeAllocatableCpu = - "Amount of cpu allocatable on the node."; -static constexpr const char *unitMetricK8sNodeAllocatableCpu = "{cpu}"; +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sNodeAllocatableCpu = + "k8s.node.allocatable.cpu"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sNodeAllocatableCpu = + "Deprecated, use `k8s.node.cpu.allocatable` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sNodeAllocatableCpu = "{cpu}"; -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricK8sNodeAllocatableCpu(metrics::Meter *meter) { return meter->CreateInt64UpDownCounter(kMetricK8sNodeAllocatableCpu, @@ -1445,7 +2270,7 @@ CreateSyncInt64MetricK8sNodeAllocatableCpu(metrics::Meter *meter) unitMetricK8sNodeAllocatableCpu); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sNodeAllocatableCpu(metrics::Meter *meter) { return meter->CreateDoubleUpDownCounter(kMetricK8sNodeAllocatableCpu, @@ -1453,7 +2278,7 @@ CreateSyncDoubleMetricK8sNodeAllocatableCpu(metrics::Meter *meter) unitMetricK8sNodeAllocatableCpu); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncInt64MetricK8sNodeAllocatableCpu(metrics::Meter *meter) { return meter->CreateInt64ObservableUpDownCounter(kMetricK8sNodeAllocatableCpu, @@ -1461,7 +2286,7 @@ CreateAsyncInt64MetricK8sNodeAllocatableCpu(metrics::Meter *meter) unitMetricK8sNodeAllocatableCpu); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sNodeAllocatableCpu(metrics::Meter *meter) { return meter->CreateDoubleObservableUpDownCounter(kMetricK8sNodeAllocatableCpu, @@ -1470,17 +2295,21 @@ CreateAsyncDoubleMetricK8sNodeAllocatableCpu(metrics::Meter *meter) } /** - Amount of ephemeral-storage allocatable on the node. -

    - updowncounter + Deprecated, use @code k8s.node.ephemeral_storage.allocatable @endcode instead. + + @deprecated + {"note": "Replaced by @code k8s.node.ephemeral_storage.allocatable @endcode.", "reason": + "renamed", "renamed_to": "k8s.node.ephemeral_storage.allocatable"}

    updowncounter */ -static constexpr const char *kMetricK8sNodeAllocatableEphemeralStorage = +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sNodeAllocatableEphemeralStorage = "k8s.node.allocatable.ephemeral_storage"; -static constexpr const char *descrMetricK8sNodeAllocatableEphemeralStorage = - "Amount of ephemeral-storage allocatable on the node."; -static constexpr const char *unitMetricK8sNodeAllocatableEphemeralStorage = "By"; +OPENTELEMETRY_DEPRECATED static constexpr const char + *descrMetricK8sNodeAllocatableEphemeralStorage = + "Deprecated, use `k8s.node.ephemeral_storage.allocatable` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sNodeAllocatableEphemeralStorage = + "By"; -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricK8sNodeAllocatableEphemeralStorage(metrics::Meter *meter) { return meter->CreateInt64UpDownCounter(kMetricK8sNodeAllocatableEphemeralStorage, @@ -1488,7 +2317,7 @@ CreateSyncInt64MetricK8sNodeAllocatableEphemeralStorage(metrics::Meter *meter) unitMetricK8sNodeAllocatableEphemeralStorage); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sNodeAllocatableEphemeralStorage(metrics::Meter *meter) { return meter->CreateDoubleUpDownCounter(kMetricK8sNodeAllocatableEphemeralStorage, @@ -1496,7 +2325,7 @@ CreateSyncDoubleMetricK8sNodeAllocatableEphemeralStorage(metrics::Meter *meter) unitMetricK8sNodeAllocatableEphemeralStorage); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncInt64MetricK8sNodeAllocatableEphemeralStorage(metrics::Meter *meter) { return meter->CreateInt64ObservableUpDownCounter(kMetricK8sNodeAllocatableEphemeralStorage, @@ -1504,7 +2333,7 @@ CreateAsyncInt64MetricK8sNodeAllocatableEphemeralStorage(metrics::Meter *meter) unitMetricK8sNodeAllocatableEphemeralStorage); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sNodeAllocatableEphemeralStorage(metrics::Meter *meter) { return meter->CreateDoubleObservableUpDownCounter(kMetricK8sNodeAllocatableEphemeralStorage, @@ -1513,16 +2342,19 @@ CreateAsyncDoubleMetricK8sNodeAllocatableEphemeralStorage(metrics::Meter *meter) } /** - Amount of memory allocatable on the node. -

    - updowncounter + Deprecated, use @code k8s.node.memory.allocatable @endcode instead. + + @deprecated + {"note": "Replaced by @code k8s.node.memory.allocatable @endcode.", "reason": "renamed", + "renamed_to": "k8s.node.memory.allocatable"}

    updowncounter */ -static constexpr const char *kMetricK8sNodeAllocatableMemory = "k8s.node.allocatable.memory"; -static constexpr const char *descrMetricK8sNodeAllocatableMemory = - "Amount of memory allocatable on the node."; -static constexpr const char *unitMetricK8sNodeAllocatableMemory = "By"; +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sNodeAllocatableMemory = + "k8s.node.allocatable.memory"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sNodeAllocatableMemory = + "Deprecated, use `k8s.node.memory.allocatable` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sNodeAllocatableMemory = "By"; -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricK8sNodeAllocatableMemory(metrics::Meter *meter) { return meter->CreateInt64UpDownCounter(kMetricK8sNodeAllocatableMemory, @@ -1530,7 +2362,7 @@ CreateSyncInt64MetricK8sNodeAllocatableMemory(metrics::Meter *meter) unitMetricK8sNodeAllocatableMemory); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sNodeAllocatableMemory(metrics::Meter *meter) { return meter->CreateDoubleUpDownCounter(kMetricK8sNodeAllocatableMemory, @@ -1538,7 +2370,7 @@ CreateSyncDoubleMetricK8sNodeAllocatableMemory(metrics::Meter *meter) unitMetricK8sNodeAllocatableMemory); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncInt64MetricK8sNodeAllocatableMemory(metrics::Meter *meter) { return meter->CreateInt64ObservableUpDownCounter(kMetricK8sNodeAllocatableMemory, @@ -1546,7 +2378,7 @@ CreateAsyncInt64MetricK8sNodeAllocatableMemory(metrics::Meter *meter) unitMetricK8sNodeAllocatableMemory); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sNodeAllocatableMemory(metrics::Meter *meter) { return meter->CreateDoubleObservableUpDownCounter(kMetricK8sNodeAllocatableMemory, @@ -1555,16 +2387,19 @@ CreateAsyncDoubleMetricK8sNodeAllocatableMemory(metrics::Meter *meter) } /** - Amount of pods allocatable on the node. -

    - updowncounter + Deprecated, use @code k8s.node.pod.allocatable @endcode instead. + + @deprecated + {"note": "Replaced by @code k8s.node.pod.allocatable @endcode.", "reason": "renamed", + "renamed_to": "k8s.node.pod.allocatable"}

    updowncounter */ -static constexpr const char *kMetricK8sNodeAllocatablePods = "k8s.node.allocatable.pods"; -static constexpr const char *descrMetricK8sNodeAllocatablePods = - "Amount of pods allocatable on the node."; -static constexpr const char *unitMetricK8sNodeAllocatablePods = "{pod}"; +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sNodeAllocatablePods = + "k8s.node.allocatable.pods"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sNodeAllocatablePods = + "Deprecated, use `k8s.node.pod.allocatable` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sNodeAllocatablePods = "{pod}"; -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricK8sNodeAllocatablePods(metrics::Meter *meter) { return meter->CreateInt64UpDownCounter(kMetricK8sNodeAllocatablePods, @@ -1572,7 +2407,7 @@ CreateSyncInt64MetricK8sNodeAllocatablePods(metrics::Meter *meter) unitMetricK8sNodeAllocatablePods); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sNodeAllocatablePods(metrics::Meter *meter) { return meter->CreateDoubleUpDownCounter(kMetricK8sNodeAllocatablePods, @@ -1580,7 +2415,7 @@ CreateSyncDoubleMetricK8sNodeAllocatablePods(metrics::Meter *meter) unitMetricK8sNodeAllocatablePods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncInt64MetricK8sNodeAllocatablePods(metrics::Meter *meter) { return meter->CreateInt64ObservableUpDownCounter(kMetricK8sNodeAllocatablePods, @@ -1588,7 +2423,7 @@ CreateAsyncInt64MetricK8sNodeAllocatablePods(metrics::Meter *meter) unitMetricK8sNodeAllocatablePods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sNodeAllocatablePods(metrics::Meter *meter) { return meter->CreateDoubleObservableUpDownCounter(kMetricK8sNodeAllocatablePods, @@ -1640,6 +2475,48 @@ CreateAsyncDoubleMetricK8sNodeConditionStatus(metrics::Meter *meter) unitMetricK8sNodeConditionStatus); } +/** + Amount of cpu allocatable on the node. +

    + updowncounter + */ +static constexpr const char *kMetricK8sNodeCpuAllocatable = "k8s.node.cpu.allocatable"; +static constexpr const char *descrMetricK8sNodeCpuAllocatable = + "Amount of cpu allocatable on the node."; +static constexpr const char *unitMetricK8sNodeCpuAllocatable = "{cpu}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sNodeCpuAllocatable(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sNodeCpuAllocatable, + descrMetricK8sNodeCpuAllocatable, + unitMetricK8sNodeCpuAllocatable); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sNodeCpuAllocatable(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sNodeCpuAllocatable, + descrMetricK8sNodeCpuAllocatable, + unitMetricK8sNodeCpuAllocatable); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sNodeCpuAllocatable(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sNodeCpuAllocatable, + descrMetricK8sNodeCpuAllocatable, + unitMetricK8sNodeCpuAllocatable); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sNodeCpuAllocatable(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sNodeCpuAllocatable, + descrMetricK8sNodeCpuAllocatable, + unitMetricK8sNodeCpuAllocatable); +} + /** Total CPU time consumed.

    @@ -1722,6 +2599,49 @@ CreateAsyncDoubleMetricK8sNodeCpuUsage(metrics::Meter *meter) unitMetricK8sNodeCpuUsage); } +/** + Amount of ephemeral-storage allocatable on the node. +

    + updowncounter + */ +static constexpr const char *kMetricK8sNodeEphemeralStorageAllocatable = + "k8s.node.ephemeral_storage.allocatable"; +static constexpr const char *descrMetricK8sNodeEphemeralStorageAllocatable = + "Amount of ephemeral-storage allocatable on the node."; +static constexpr const char *unitMetricK8sNodeEphemeralStorageAllocatable = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sNodeEphemeralStorageAllocatable(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sNodeEphemeralStorageAllocatable, + descrMetricK8sNodeEphemeralStorageAllocatable, + unitMetricK8sNodeEphemeralStorageAllocatable); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sNodeEphemeralStorageAllocatable(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sNodeEphemeralStorageAllocatable, + descrMetricK8sNodeEphemeralStorageAllocatable, + unitMetricK8sNodeEphemeralStorageAllocatable); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sNodeEphemeralStorageAllocatable(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sNodeEphemeralStorageAllocatable, + descrMetricK8sNodeEphemeralStorageAllocatable, + unitMetricK8sNodeEphemeralStorageAllocatable); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sNodeEphemeralStorageAllocatable(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sNodeEphemeralStorageAllocatable, + descrMetricK8sNodeEphemeralStorageAllocatable, + unitMetricK8sNodeEphemeralStorageAllocatable); +} + /** Node filesystem available bytes.

    @@ -1869,6 +2789,184 @@ CreateAsyncDoubleMetricK8sNodeFilesystemUsage(metrics::Meter *meter) unitMetricK8sNodeFilesystemUsage); } +/** + Amount of memory allocatable on the node. +

    + updowncounter + */ +static constexpr const char *kMetricK8sNodeMemoryAllocatable = "k8s.node.memory.allocatable"; +static constexpr const char *descrMetricK8sNodeMemoryAllocatable = + "Amount of memory allocatable on the node."; +static constexpr const char *unitMetricK8sNodeMemoryAllocatable = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sNodeMemoryAllocatable(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sNodeMemoryAllocatable, + descrMetricK8sNodeMemoryAllocatable, + unitMetricK8sNodeMemoryAllocatable); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sNodeMemoryAllocatable(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sNodeMemoryAllocatable, + descrMetricK8sNodeMemoryAllocatable, + unitMetricK8sNodeMemoryAllocatable); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sNodeMemoryAllocatable(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sNodeMemoryAllocatable, + descrMetricK8sNodeMemoryAllocatable, + unitMetricK8sNodeMemoryAllocatable); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sNodeMemoryAllocatable(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sNodeMemoryAllocatable, + descrMetricK8sNodeMemoryAllocatable, + unitMetricK8sNodeMemoryAllocatable); +} + +/** + Node memory available. +

    + Available memory for use. This is defined as the memory limit - workingSetBytes. If memory limit + is undefined, the available bytes is omitted. This metric is derived from the MemoryStats.AvailableBytes + field of the NodeStats.Memory + of the Kubelet's stats API.

    updowncounter + */ +static constexpr const char *kMetricK8sNodeMemoryAvailable = "k8s.node.memory.available"; +static constexpr const char *descrMetricK8sNodeMemoryAvailable = "Node memory available."; +static constexpr const char *unitMetricK8sNodeMemoryAvailable = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sNodeMemoryAvailable(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sNodeMemoryAvailable, + descrMetricK8sNodeMemoryAvailable, + unitMetricK8sNodeMemoryAvailable); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sNodeMemoryAvailable(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sNodeMemoryAvailable, + descrMetricK8sNodeMemoryAvailable, + unitMetricK8sNodeMemoryAvailable); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sNodeMemoryAvailable(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sNodeMemoryAvailable, + descrMetricK8sNodeMemoryAvailable, + unitMetricK8sNodeMemoryAvailable); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sNodeMemoryAvailable(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sNodeMemoryAvailable, + descrMetricK8sNodeMemoryAvailable, + unitMetricK8sNodeMemoryAvailable); +} + +/** + Node memory paging faults. +

    + Cumulative number of major/minor page faults. + This metric is derived from the MemoryStats.PageFaults + and MemoryStats.MajorPageFaults + fields of the NodeStats.Memory + of the Kubelet's stats API.

    counter + */ +static constexpr const char *kMetricK8sNodeMemoryPagingFaults = "k8s.node.memory.paging.faults"; +static constexpr const char *descrMetricK8sNodeMemoryPagingFaults = "Node memory paging faults."; +static constexpr const char *unitMetricK8sNodeMemoryPagingFaults = "{fault}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sNodeMemoryPagingFaults(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricK8sNodeMemoryPagingFaults, + descrMetricK8sNodeMemoryPagingFaults, + unitMetricK8sNodeMemoryPagingFaults); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sNodeMemoryPagingFaults(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricK8sNodeMemoryPagingFaults, + descrMetricK8sNodeMemoryPagingFaults, + unitMetricK8sNodeMemoryPagingFaults); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sNodeMemoryPagingFaults(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricK8sNodeMemoryPagingFaults, + descrMetricK8sNodeMemoryPagingFaults, + unitMetricK8sNodeMemoryPagingFaults); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sNodeMemoryPagingFaults(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricK8sNodeMemoryPagingFaults, + descrMetricK8sNodeMemoryPagingFaults, + unitMetricK8sNodeMemoryPagingFaults); +} + +/** + Node memory RSS. +

    + The amount of anonymous and swap cache memory (includes transparent hugepages). + This metric is derived from the MemoryStats.RSSBytes + field of the NodeStats.Memory + of the Kubelet's stats API.

    updowncounter + */ +static constexpr const char *kMetricK8sNodeMemoryRss = "k8s.node.memory.rss"; +static constexpr const char *descrMetricK8sNodeMemoryRss = "Node memory RSS."; +static constexpr const char *unitMetricK8sNodeMemoryRss = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sNodeMemoryRss(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sNodeMemoryRss, descrMetricK8sNodeMemoryRss, + unitMetricK8sNodeMemoryRss); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sNodeMemoryRss(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sNodeMemoryRss, descrMetricK8sNodeMemoryRss, + unitMetricK8sNodeMemoryRss); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sNodeMemoryRss(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricK8sNodeMemoryRss, descrMetricK8sNodeMemoryRss, unitMetricK8sNodeMemoryRss); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sNodeMemoryRss(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricK8sNodeMemoryRss, descrMetricK8sNodeMemoryRss, unitMetricK8sNodeMemoryRss); +} + /** Memory usage of the Node.

    @@ -1885,30 +2983,76 @@ static constexpr const char *unitMetricK8sNodeMemoryUsage = "By"; static inline nostd::unique_ptr> CreateSyncInt64MetricK8sNodeMemoryUsage( metrics::Meter *meter) { - return meter->CreateInt64Gauge(kMetricK8sNodeMemoryUsage, descrMetricK8sNodeMemoryUsage, - unitMetricK8sNodeMemoryUsage); + return meter->CreateInt64Gauge(kMetricK8sNodeMemoryUsage, descrMetricK8sNodeMemoryUsage, + unitMetricK8sNodeMemoryUsage); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sNodeMemoryUsage( + metrics::Meter *meter) +{ + return meter->CreateDoubleGauge(kMetricK8sNodeMemoryUsage, descrMetricK8sNodeMemoryUsage, + unitMetricK8sNodeMemoryUsage); +} +#endif /* OPENTELEMETRY_ABI_VERSION_NO */ + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sNodeMemoryUsage(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableGauge(kMetricK8sNodeMemoryUsage, descrMetricK8sNodeMemoryUsage, + unitMetricK8sNodeMemoryUsage); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sNodeMemoryUsage(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableGauge( + kMetricK8sNodeMemoryUsage, descrMetricK8sNodeMemoryUsage, unitMetricK8sNodeMemoryUsage); +} + +/** + Node memory working set. +

    + The amount of working set memory. This includes recently accessed memory, dirty memory, and kernel + memory. WorkingSetBytes is <= UsageBytes. This metric is derived from the MemoryStats.WorkingSetBytes + field of the NodeStats.Memory + of the Kubelet's stats API.

    updowncounter + */ +static constexpr const char *kMetricK8sNodeMemoryWorkingSet = "k8s.node.memory.working_set"; +static constexpr const char *descrMetricK8sNodeMemoryWorkingSet = "Node memory working set."; +static constexpr const char *unitMetricK8sNodeMemoryWorkingSet = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sNodeMemoryWorkingSet(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sNodeMemoryWorkingSet, + descrMetricK8sNodeMemoryWorkingSet, + unitMetricK8sNodeMemoryWorkingSet); } -static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sNodeMemoryUsage( - metrics::Meter *meter) +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sNodeMemoryWorkingSet(metrics::Meter *meter) { - return meter->CreateDoubleGauge(kMetricK8sNodeMemoryUsage, descrMetricK8sNodeMemoryUsage, - unitMetricK8sNodeMemoryUsage); + return meter->CreateDoubleUpDownCounter(kMetricK8sNodeMemoryWorkingSet, + descrMetricK8sNodeMemoryWorkingSet, + unitMetricK8sNodeMemoryWorkingSet); } -#endif /* OPENTELEMETRY_ABI_VERSION_NO */ static inline nostd::shared_ptr -CreateAsyncInt64MetricK8sNodeMemoryUsage(metrics::Meter *meter) +CreateAsyncInt64MetricK8sNodeMemoryWorkingSet(metrics::Meter *meter) { - return meter->CreateInt64ObservableGauge(kMetricK8sNodeMemoryUsage, descrMetricK8sNodeMemoryUsage, - unitMetricK8sNodeMemoryUsage); + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sNodeMemoryWorkingSet, + descrMetricK8sNodeMemoryWorkingSet, + unitMetricK8sNodeMemoryWorkingSet); } static inline nostd::shared_ptr -CreateAsyncDoubleMetricK8sNodeMemoryUsage(metrics::Meter *meter) +CreateAsyncDoubleMetricK8sNodeMemoryWorkingSet(metrics::Meter *meter) { - return meter->CreateDoubleObservableGauge( - kMetricK8sNodeMemoryUsage, descrMetricK8sNodeMemoryUsage, unitMetricK8sNodeMemoryUsage); + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sNodeMemoryWorkingSet, + descrMetricK8sNodeMemoryWorkingSet, + unitMetricK8sNodeMemoryWorkingSet); } /** @@ -1985,6 +3129,48 @@ CreateAsyncDoubleMetricK8sNodeNetworkIo(metrics::Meter *meter) unitMetricK8sNodeNetworkIo); } +/** + Amount of pods allocatable on the node. +

    + updowncounter + */ +static constexpr const char *kMetricK8sNodePodAllocatable = "k8s.node.pod.allocatable"; +static constexpr const char *descrMetricK8sNodePodAllocatable = + "Amount of pods allocatable on the node."; +static constexpr const char *unitMetricK8sNodePodAllocatable = "{pod}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sNodePodAllocatable(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sNodePodAllocatable, + descrMetricK8sNodePodAllocatable, + unitMetricK8sNodePodAllocatable); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sNodePodAllocatable(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sNodePodAllocatable, + descrMetricK8sNodePodAllocatable, + unitMetricK8sNodePodAllocatable); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sNodePodAllocatable(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sNodePodAllocatable, + descrMetricK8sNodePodAllocatable, + unitMetricK8sNodePodAllocatable); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sNodePodAllocatable(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sNodePodAllocatable, + descrMetricK8sNodePodAllocatable, + unitMetricK8sNodePodAllocatable); +} + /** The time the Node has been running.

    @@ -2256,6 +3442,142 @@ CreateAsyncDoubleMetricK8sPodFilesystemUsage(metrics::Meter *meter) unitMetricK8sPodFilesystemUsage); } +/** + Pod memory available. +

    + Available memory for use. This is defined as the memory limit - workingSetBytes. If memory limit + is undefined, the available bytes is omitted. This metric is derived from the MemoryStats.AvailableBytes + field of the PodStats.Memory + of the Kubelet's stats API.

    updowncounter + */ +static constexpr const char *kMetricK8sPodMemoryAvailable = "k8s.pod.memory.available"; +static constexpr const char *descrMetricK8sPodMemoryAvailable = "Pod memory available."; +static constexpr const char *unitMetricK8sPodMemoryAvailable = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sPodMemoryAvailable(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sPodMemoryAvailable, + descrMetricK8sPodMemoryAvailable, + unitMetricK8sPodMemoryAvailable); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sPodMemoryAvailable(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sPodMemoryAvailable, + descrMetricK8sPodMemoryAvailable, + unitMetricK8sPodMemoryAvailable); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sPodMemoryAvailable(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sPodMemoryAvailable, + descrMetricK8sPodMemoryAvailable, + unitMetricK8sPodMemoryAvailable); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sPodMemoryAvailable(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sPodMemoryAvailable, + descrMetricK8sPodMemoryAvailable, + unitMetricK8sPodMemoryAvailable); +} + +/** + Pod memory paging faults. +

    + Cumulative number of major/minor page faults. + This metric is derived from the MemoryStats.PageFaults + and MemoryStats.MajorPageFaults + field of the PodStats.Memory + of the Kubelet's stats API.

    counter + */ +static constexpr const char *kMetricK8sPodMemoryPagingFaults = "k8s.pod.memory.paging.faults"; +static constexpr const char *descrMetricK8sPodMemoryPagingFaults = "Pod memory paging faults."; +static constexpr const char *unitMetricK8sPodMemoryPagingFaults = "{fault}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sPodMemoryPagingFaults(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricK8sPodMemoryPagingFaults, + descrMetricK8sPodMemoryPagingFaults, + unitMetricK8sPodMemoryPagingFaults); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sPodMemoryPagingFaults(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricK8sPodMemoryPagingFaults, + descrMetricK8sPodMemoryPagingFaults, + unitMetricK8sPodMemoryPagingFaults); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sPodMemoryPagingFaults(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricK8sPodMemoryPagingFaults, + descrMetricK8sPodMemoryPagingFaults, + unitMetricK8sPodMemoryPagingFaults); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sPodMemoryPagingFaults(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricK8sPodMemoryPagingFaults, + descrMetricK8sPodMemoryPagingFaults, + unitMetricK8sPodMemoryPagingFaults); +} + +/** + Pod memory RSS. +

    + The amount of anonymous and swap cache memory (includes transparent hugepages). + This metric is derived from the MemoryStats.RSSBytes + field of the PodStats.Memory + of the Kubelet's stats API.

    updowncounter + */ +static constexpr const char *kMetricK8sPodMemoryRss = "k8s.pod.memory.rss"; +static constexpr const char *descrMetricK8sPodMemoryRss = "Pod memory RSS."; +static constexpr const char *unitMetricK8sPodMemoryRss = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sPodMemoryRss(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sPodMemoryRss, descrMetricK8sPodMemoryRss, + unitMetricK8sPodMemoryRss); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sPodMemoryRss(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sPodMemoryRss, descrMetricK8sPodMemoryRss, + unitMetricK8sPodMemoryRss); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sPodMemoryRss(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricK8sPodMemoryRss, descrMetricK8sPodMemoryRss, unitMetricK8sPodMemoryRss); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sPodMemoryRss(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricK8sPodMemoryRss, descrMetricK8sPodMemoryRss, unitMetricK8sPodMemoryRss); +} + /** Memory usage of the Pod.

    @@ -2298,6 +3620,52 @@ CreateAsyncDoubleMetricK8sPodMemoryUsage(metrics::Meter *meter) unitMetricK8sPodMemoryUsage); } +/** + Pod memory working set. +

    + The amount of working set memory. This includes recently accessed memory, dirty memory, and kernel + memory. WorkingSetBytes is <= UsageBytes. This metric is derived from the MemoryStats.WorkingSetBytes + field of the PodStats.Memory + of the Kubelet's stats API.

    updowncounter + */ +static constexpr const char *kMetricK8sPodMemoryWorkingSet = "k8s.pod.memory.working_set"; +static constexpr const char *descrMetricK8sPodMemoryWorkingSet = "Pod memory working set."; +static constexpr const char *unitMetricK8sPodMemoryWorkingSet = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sPodMemoryWorkingSet(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sPodMemoryWorkingSet, + descrMetricK8sPodMemoryWorkingSet, + unitMetricK8sPodMemoryWorkingSet); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sPodMemoryWorkingSet(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sPodMemoryWorkingSet, + descrMetricK8sPodMemoryWorkingSet, + unitMetricK8sPodMemoryWorkingSet); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sPodMemoryWorkingSet(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sPodMemoryWorkingSet, + descrMetricK8sPodMemoryWorkingSet, + unitMetricK8sPodMemoryWorkingSet); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sPodMemoryWorkingSet(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sPodMemoryWorkingSet, + descrMetricK8sPodMemoryWorkingSet, + unitMetricK8sPodMemoryWorkingSet); +} + /** Pod network errors.

    @@ -2372,6 +3740,88 @@ CreateAsyncDoubleMetricK8sPodNetworkIo(metrics::Meter *meter) unitMetricK8sPodNetworkIo); } +/** + Describes number of K8s Pods that are currently in a given phase. +

    + All possible pod phases will be reported at each time interval to avoid missing metrics. + Only the value corresponding to the current phase will be non-zero. +

    + updowncounter + */ +static constexpr const char *kMetricK8sPodStatusPhase = "k8s.pod.status.phase"; +static constexpr const char *descrMetricK8sPodStatusPhase = + "Describes number of K8s Pods that are currently in a given phase."; +static constexpr const char *unitMetricK8sPodStatusPhase = "{pod}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sPodStatusPhase(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sPodStatusPhase, descrMetricK8sPodStatusPhase, + unitMetricK8sPodStatusPhase); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sPodStatusPhase(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sPodStatusPhase, descrMetricK8sPodStatusPhase, + unitMetricK8sPodStatusPhase); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sPodStatusPhase(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricK8sPodStatusPhase, descrMetricK8sPodStatusPhase, unitMetricK8sPodStatusPhase); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sPodStatusPhase(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricK8sPodStatusPhase, descrMetricK8sPodStatusPhase, unitMetricK8sPodStatusPhase); +} + +/** + Describes the number of K8s Pods that are currently in a state for a given reason. +

    + All possible pod status reasons will be reported at each time interval to avoid missing metrics. + Only the value corresponding to the current reason will be non-zero. +

    + updowncounter + */ +static constexpr const char *kMetricK8sPodStatusReason = "k8s.pod.status.reason"; +static constexpr const char *descrMetricK8sPodStatusReason = + "Describes the number of K8s Pods that are currently in a state for a given reason."; +static constexpr const char *unitMetricK8sPodStatusReason = "{pod}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sPodStatusReason(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sPodStatusReason, descrMetricK8sPodStatusReason, + unitMetricK8sPodStatusReason); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sPodStatusReason(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sPodStatusReason, descrMetricK8sPodStatusReason, + unitMetricK8sPodStatusReason); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sPodStatusReason(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricK8sPodStatusReason, descrMetricK8sPodStatusReason, unitMetricK8sPodStatusReason); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sPodStatusReason(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricK8sPodStatusReason, descrMetricK8sPodStatusReason, unitMetricK8sPodStatusReason); +} + /** The time the Pod has been running.

    @@ -2690,18 +4140,23 @@ CreateAsyncDoubleMetricK8sPodVolumeUsage(metrics::Meter *meter) } /** - Total number of available replica pods (ready for at least minReadySeconds) targeted by this - replicaset.

    This metric aligns with the @code availableReplicas @endcode field of the This metric aligns with the @code + availableReplicas @endcode field of the K8s ReplicaSetStatus.

    updowncounter */ -static constexpr const char *kMetricK8sReplicasetAvailablePods = "k8s.replicaset.available_pods"; -static constexpr const char *descrMetricK8sReplicasetAvailablePods = - "Total number of available replica pods (ready for at least minReadySeconds) targeted by this " - "replicaset."; -static constexpr const char *unitMetricK8sReplicasetAvailablePods = "{pod}"; +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sReplicasetAvailablePods = + "k8s.replicaset.available_pods"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sReplicasetAvailablePods = + "Deprecated, use `k8s.replicaset.pod.available` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sReplicasetAvailablePods = + "{pod}"; -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricK8sReplicasetAvailablePods(metrics::Meter *meter) { return meter->CreateInt64UpDownCounter(kMetricK8sReplicasetAvailablePods, @@ -2709,7 +4164,7 @@ CreateSyncInt64MetricK8sReplicasetAvailablePods(metrics::Meter *meter) unitMetricK8sReplicasetAvailablePods); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sReplicasetAvailablePods(metrics::Meter *meter) { return meter->CreateDoubleUpDownCounter(kMetricK8sReplicasetAvailablePods, @@ -2717,7 +4172,7 @@ CreateSyncDoubleMetricK8sReplicasetAvailablePods(metrics::Meter *meter) unitMetricK8sReplicasetAvailablePods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncInt64MetricK8sReplicasetAvailablePods(metrics::Meter *meter) { return meter->CreateInt64ObservableUpDownCounter(kMetricK8sReplicasetAvailablePods, @@ -2725,7 +4180,7 @@ CreateAsyncInt64MetricK8sReplicasetAvailablePods(metrics::Meter *meter) unitMetricK8sReplicasetAvailablePods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sReplicasetAvailablePods(metrics::Meter *meter) { return meter->CreateDoubleObservableUpDownCounter(kMetricK8sReplicasetAvailablePods, @@ -2734,19 +4189,22 @@ CreateAsyncDoubleMetricK8sReplicasetAvailablePods(metrics::Meter *meter) } /** - Number of desired replica pods in this replicaset. -

    - This metric aligns with the @code replicas @endcode field of the - This metric aligns with the @code replicas + @endcode field of the K8s ReplicaSetSpec.

    updowncounter */ -static constexpr const char *kMetricK8sReplicasetDesiredPods = "k8s.replicaset.desired_pods"; -static constexpr const char *descrMetricK8sReplicasetDesiredPods = - "Number of desired replica pods in this replicaset."; -static constexpr const char *unitMetricK8sReplicasetDesiredPods = "{pod}"; +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sReplicasetDesiredPods = + "k8s.replicaset.desired_pods"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sReplicasetDesiredPods = + "Deprecated, use `k8s.replicaset.pod.desired` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sReplicasetDesiredPods = "{pod}"; -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricK8sReplicasetDesiredPods(metrics::Meter *meter) { return meter->CreateInt64UpDownCounter(kMetricK8sReplicasetDesiredPods, @@ -2754,42 +4212,131 @@ CreateSyncInt64MetricK8sReplicasetDesiredPods(metrics::Meter *meter) unitMetricK8sReplicasetDesiredPods); } +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sReplicasetDesiredPods(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sReplicasetDesiredPods, + descrMetricK8sReplicasetDesiredPods, + unitMetricK8sReplicasetDesiredPods); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sReplicasetDesiredPods(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sReplicasetDesiredPods, + descrMetricK8sReplicasetDesiredPods, + unitMetricK8sReplicasetDesiredPods); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sReplicasetDesiredPods(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sReplicasetDesiredPods, + descrMetricK8sReplicasetDesiredPods, + unitMetricK8sReplicasetDesiredPods); +} + +/** + Total number of available replica pods (ready for at least minReadySeconds) targeted by this + replicaset.

    This metric aligns with the @code availableReplicas @endcode field of the K8s + ReplicaSetStatus.

    updowncounter + */ +static constexpr const char *kMetricK8sReplicasetPodAvailable = "k8s.replicaset.pod.available"; +static constexpr const char *descrMetricK8sReplicasetPodAvailable = + "Total number of available replica pods (ready for at least minReadySeconds) targeted by this " + "replicaset."; +static constexpr const char *unitMetricK8sReplicasetPodAvailable = "{pod}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sReplicasetPodAvailable(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sReplicasetPodAvailable, + descrMetricK8sReplicasetPodAvailable, + unitMetricK8sReplicasetPodAvailable); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sReplicasetPodAvailable(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sReplicasetPodAvailable, + descrMetricK8sReplicasetPodAvailable, + unitMetricK8sReplicasetPodAvailable); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sReplicasetPodAvailable(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sReplicasetPodAvailable, + descrMetricK8sReplicasetPodAvailable, + unitMetricK8sReplicasetPodAvailable); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sReplicasetPodAvailable(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sReplicasetPodAvailable, + descrMetricK8sReplicasetPodAvailable, + unitMetricK8sReplicasetPodAvailable); +} + +/** + Number of desired replica pods in this replicaset. +

    + This metric aligns with the @code replicas @endcode field of the + K8s + ReplicaSetSpec.

    updowncounter + */ +static constexpr const char *kMetricK8sReplicasetPodDesired = "k8s.replicaset.pod.desired"; +static constexpr const char *descrMetricK8sReplicasetPodDesired = + "Number of desired replica pods in this replicaset."; +static constexpr const char *unitMetricK8sReplicasetPodDesired = "{pod}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sReplicasetPodDesired(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sReplicasetPodDesired, + descrMetricK8sReplicasetPodDesired, + unitMetricK8sReplicasetPodDesired); +} + static inline nostd::unique_ptr> -CreateSyncDoubleMetricK8sReplicasetDesiredPods(metrics::Meter *meter) +CreateSyncDoubleMetricK8sReplicasetPodDesired(metrics::Meter *meter) { - return meter->CreateDoubleUpDownCounter(kMetricK8sReplicasetDesiredPods, - descrMetricK8sReplicasetDesiredPods, - unitMetricK8sReplicasetDesiredPods); + return meter->CreateDoubleUpDownCounter(kMetricK8sReplicasetPodDesired, + descrMetricK8sReplicasetPodDesired, + unitMetricK8sReplicasetPodDesired); } static inline nostd::shared_ptr -CreateAsyncInt64MetricK8sReplicasetDesiredPods(metrics::Meter *meter) +CreateAsyncInt64MetricK8sReplicasetPodDesired(metrics::Meter *meter) { - return meter->CreateInt64ObservableUpDownCounter(kMetricK8sReplicasetDesiredPods, - descrMetricK8sReplicasetDesiredPods, - unitMetricK8sReplicasetDesiredPods); + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sReplicasetPodDesired, + descrMetricK8sReplicasetPodDesired, + unitMetricK8sReplicasetPodDesired); } static inline nostd::shared_ptr -CreateAsyncDoubleMetricK8sReplicasetDesiredPods(metrics::Meter *meter) +CreateAsyncDoubleMetricK8sReplicasetPodDesired(metrics::Meter *meter) { - return meter->CreateDoubleObservableUpDownCounter(kMetricK8sReplicasetDesiredPods, - descrMetricK8sReplicasetDesiredPods, - unitMetricK8sReplicasetDesiredPods); + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sReplicasetPodDesired, + descrMetricK8sReplicasetPodDesired, + unitMetricK8sReplicasetPodDesired); } /** - Deprecated, use @code k8s.replicationcontroller.available_pods @endcode instead. + Deprecated, use @code k8s.replicationcontroller.pod.available @endcode instead. @deprecated - {"note": "Replaced by @code k8s.replicationcontroller.available_pods @endcode.", "reason": - "renamed", "renamed_to": "k8s.replicationcontroller.available_pods"}

    updowncounter + {"note": "Replaced by @code k8s.replicationcontroller.pod.available @endcode.", "reason": + "renamed", "renamed_to": "k8s.replicationcontroller.pod.available"}

    updowncounter */ OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sReplicationControllerAvailablePods = "k8s.replication_controller.available_pods"; OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sReplicationControllerAvailablePods = - "Deprecated, use `k8s.replicationcontroller.available_pods` instead."; + "Deprecated, use `k8s.replicationcontroller.pod.available` instead."; OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sReplicationControllerAvailablePods = "{pod}"; @@ -2827,17 +4374,17 @@ CreateAsyncDoubleMetricK8sReplicationControllerAvailablePods(metrics::Meter *met } /** - Deprecated, use @code k8s.replicationcontroller.desired_pods @endcode instead. + Deprecated, use @code k8s.replicationcontroller.pod.desired @endcode instead. @deprecated - {"note": "Replaced by @code k8s.replicationcontroller.desired_pods @endcode.", "reason": - "renamed", "renamed_to": "k8s.replicationcontroller.desired_pods"}

    updowncounter + {"note": "Replaced by @code k8s.replicationcontroller.pod.desired @endcode.", "reason": "renamed", + "renamed_to": "k8s.replicationcontroller.pod.desired"}

    updowncounter */ OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sReplicationControllerDesiredPods = "k8s.replication_controller.desired_pods"; OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sReplicationControllerDesiredPods = - "Deprecated, use `k8s.replicationcontroller.desired_pods` instead."; + "Deprecated, use `k8s.replicationcontroller.pod.desired` instead."; OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sReplicationControllerDesiredPods = "{pod}"; @@ -2874,20 +4421,21 @@ CreateAsyncDoubleMetricK8sReplicationControllerDesiredPods(metrics::Meter *meter } /** - Total number of available replica pods (ready for at least minReadySeconds) targeted by this - replication controller.

    This metric aligns with the @code availableReplicas @endcode field of - the K8s - ReplicationControllerStatus

    updowncounter + Deprecated, use @code k8s.replicationcontroller.pod.available @endcode instead. + + @deprecated + {"note": "Replaced by @code k8s.replicationcontroller.pod.available @endcode.", "reason": + "renamed", "renamed_to": "k8s.replicationcontroller.pod.available"}

    updowncounter */ -static constexpr const char *kMetricK8sReplicationcontrollerAvailablePods = +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sReplicationcontrollerAvailablePods = "k8s.replicationcontroller.available_pods"; -static constexpr const char *descrMetricK8sReplicationcontrollerAvailablePods = - "Total number of available replica pods (ready for at least minReadySeconds) targeted by this " - "replication controller."; -static constexpr const char *unitMetricK8sReplicationcontrollerAvailablePods = "{pod}"; +OPENTELEMETRY_DEPRECATED static constexpr const char + *descrMetricK8sReplicationcontrollerAvailablePods = + "Deprecated, use `k8s.replicationcontroller.pod.available` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char + *unitMetricK8sReplicationcontrollerAvailablePods = "{pod}"; -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricK8sReplicationcontrollerAvailablePods(metrics::Meter *meter) { return meter->CreateInt64UpDownCounter(kMetricK8sReplicationcontrollerAvailablePods, @@ -2895,7 +4443,7 @@ CreateSyncInt64MetricK8sReplicationcontrollerAvailablePods(metrics::Meter *meter unitMetricK8sReplicationcontrollerAvailablePods); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sReplicationcontrollerAvailablePods(metrics::Meter *meter) { return meter->CreateDoubleUpDownCounter(kMetricK8sReplicationcontrollerAvailablePods, @@ -2903,7 +4451,7 @@ CreateSyncDoubleMetricK8sReplicationcontrollerAvailablePods(metrics::Meter *mete unitMetricK8sReplicationcontrollerAvailablePods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncInt64MetricK8sReplicationcontrollerAvailablePods(metrics::Meter *meter) { return meter->CreateInt64ObservableUpDownCounter(kMetricK8sReplicationcontrollerAvailablePods, @@ -2911,7 +4459,7 @@ CreateAsyncInt64MetricK8sReplicationcontrollerAvailablePods(metrics::Meter *mete unitMetricK8sReplicationcontrollerAvailablePods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sReplicationcontrollerAvailablePods(metrics::Meter *meter) { return meter->CreateDoubleObservableUpDownCounter( @@ -2921,20 +4469,21 @@ CreateAsyncDoubleMetricK8sReplicationcontrollerAvailablePods(metrics::Meter *met } /** - Number of desired replica pods in this replication controller. -

    - This metric aligns with the @code replicas @endcode field of the - K8s - ReplicationControllerSpec

    updowncounter + Deprecated, use @code k8s.replicationcontroller.pod.desired @endcode instead. + + @deprecated + {"note": "Replaced by @code k8s.replicationcontroller.pod.desired @endcode.", "reason": "renamed", + "renamed_to": "k8s.replicationcontroller.pod.desired"}

    updowncounter */ -static constexpr const char *kMetricK8sReplicationcontrollerDesiredPods = +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sReplicationcontrollerDesiredPods = "k8s.replicationcontroller.desired_pods"; -static constexpr const char *descrMetricK8sReplicationcontrollerDesiredPods = - "Number of desired replica pods in this replication controller."; -static constexpr const char *unitMetricK8sReplicationcontrollerDesiredPods = "{pod}"; +OPENTELEMETRY_DEPRECATED static constexpr const char + *descrMetricK8sReplicationcontrollerDesiredPods = + "Deprecated, use `k8s.replicationcontroller.pod.desired` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char + *unitMetricK8sReplicationcontrollerDesiredPods = "{pod}"; -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricK8sReplicationcontrollerDesiredPods(metrics::Meter *meter) { return meter->CreateInt64UpDownCounter(kMetricK8sReplicationcontrollerDesiredPods, @@ -2942,7 +4491,7 @@ CreateSyncInt64MetricK8sReplicationcontrollerDesiredPods(metrics::Meter *meter) unitMetricK8sReplicationcontrollerDesiredPods); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sReplicationcontrollerDesiredPods(metrics::Meter *meter) { return meter->CreateDoubleUpDownCounter(kMetricK8sReplicationcontrollerDesiredPods, @@ -2950,7 +4499,7 @@ CreateSyncDoubleMetricK8sReplicationcontrollerDesiredPods(metrics::Meter *meter) unitMetricK8sReplicationcontrollerDesiredPods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncInt64MetricK8sReplicationcontrollerDesiredPods(metrics::Meter *meter) { return meter->CreateInt64ObservableUpDownCounter(kMetricK8sReplicationcontrollerDesiredPods, @@ -2958,7 +4507,7 @@ CreateAsyncInt64MetricK8sReplicationcontrollerDesiredPods(metrics::Meter *meter) unitMetricK8sReplicationcontrollerDesiredPods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sReplicationcontrollerDesiredPods(metrics::Meter *meter) { return meter->CreateDoubleObservableUpDownCounter(kMetricK8sReplicationcontrollerDesiredPods, @@ -2966,6 +4515,98 @@ CreateAsyncDoubleMetricK8sReplicationcontrollerDesiredPods(metrics::Meter *meter unitMetricK8sReplicationcontrollerDesiredPods); } +/** + Total number of available replica pods (ready for at least minReadySeconds) targeted by this + replication controller.

    This metric aligns with the @code availableReplicas @endcode field of + the K8s + ReplicationControllerStatus

    updowncounter + */ +static constexpr const char *kMetricK8sReplicationcontrollerPodAvailable = + "k8s.replicationcontroller.pod.available"; +static constexpr const char *descrMetricK8sReplicationcontrollerPodAvailable = + "Total number of available replica pods (ready for at least minReadySeconds) targeted by this " + "replication controller."; +static constexpr const char *unitMetricK8sReplicationcontrollerPodAvailable = "{pod}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sReplicationcontrollerPodAvailable(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sReplicationcontrollerPodAvailable, + descrMetricK8sReplicationcontrollerPodAvailable, + unitMetricK8sReplicationcontrollerPodAvailable); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sReplicationcontrollerPodAvailable(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sReplicationcontrollerPodAvailable, + descrMetricK8sReplicationcontrollerPodAvailable, + unitMetricK8sReplicationcontrollerPodAvailable); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sReplicationcontrollerPodAvailable(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sReplicationcontrollerPodAvailable, + descrMetricK8sReplicationcontrollerPodAvailable, + unitMetricK8sReplicationcontrollerPodAvailable); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sReplicationcontrollerPodAvailable(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sReplicationcontrollerPodAvailable, + descrMetricK8sReplicationcontrollerPodAvailable, + unitMetricK8sReplicationcontrollerPodAvailable); +} + +/** + Number of desired replica pods in this replication controller. +

    + This metric aligns with the @code replicas @endcode field of the + K8s + ReplicationControllerSpec

    updowncounter + */ +static constexpr const char *kMetricK8sReplicationcontrollerPodDesired = + "k8s.replicationcontroller.pod.desired"; +static constexpr const char *descrMetricK8sReplicationcontrollerPodDesired = + "Number of desired replica pods in this replication controller."; +static constexpr const char *unitMetricK8sReplicationcontrollerPodDesired = "{pod}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sReplicationcontrollerPodDesired(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sReplicationcontrollerPodDesired, + descrMetricK8sReplicationcontrollerPodDesired, + unitMetricK8sReplicationcontrollerPodDesired); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sReplicationcontrollerPodDesired(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sReplicationcontrollerPodDesired, + descrMetricK8sReplicationcontrollerPodDesired, + unitMetricK8sReplicationcontrollerPodDesired); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sReplicationcontrollerPodDesired(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sReplicationcontrollerPodDesired, + descrMetricK8sReplicationcontrollerPodDesired, + unitMetricK8sReplicationcontrollerPodDesired); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sReplicationcontrollerPodDesired(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sReplicationcontrollerPodDesired, + descrMetricK8sReplicationcontrollerPodDesired, + unitMetricK8sReplicationcontrollerPodDesired); +} + /** The CPU limits in a specific namespace. The value represents the configured quota limit of the resource in the namespace. @@ -3949,19 +5590,22 @@ CreateAsyncDoubleMetricK8sResourcequotaStorageRequestUsed(metrics::Meter *meter) } /** - The number of replica pods created by the statefulset controller from the statefulset version - indicated by currentRevision.

    This metric aligns with the @code currentReplicas @endcode field - of the This metric aligns with the @code currentReplicas + @endcode field of the K8s StatefulSetStatus.

    updowncounter */ -static constexpr const char *kMetricK8sStatefulsetCurrentPods = "k8s.statefulset.current_pods"; -static constexpr const char *descrMetricK8sStatefulsetCurrentPods = - "The number of replica pods created by the statefulset controller from the statefulset version " - "indicated by currentRevision."; -static constexpr const char *unitMetricK8sStatefulsetCurrentPods = "{pod}"; +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sStatefulsetCurrentPods = + "k8s.statefulset.current_pods"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sStatefulsetCurrentPods = + "Deprecated, use `k8s.statefulset.pod.current` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sStatefulsetCurrentPods = "{pod}"; -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricK8sStatefulsetCurrentPods(metrics::Meter *meter) { return meter->CreateInt64UpDownCounter(kMetricK8sStatefulsetCurrentPods, @@ -3969,7 +5613,7 @@ CreateSyncInt64MetricK8sStatefulsetCurrentPods(metrics::Meter *meter) unitMetricK8sStatefulsetCurrentPods); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sStatefulsetCurrentPods(metrics::Meter *meter) { return meter->CreateDoubleUpDownCounter(kMetricK8sStatefulsetCurrentPods, @@ -3977,7 +5621,7 @@ CreateSyncDoubleMetricK8sStatefulsetCurrentPods(metrics::Meter *meter) unitMetricK8sStatefulsetCurrentPods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncInt64MetricK8sStatefulsetCurrentPods(metrics::Meter *meter) { return meter->CreateInt64ObservableUpDownCounter(kMetricK8sStatefulsetCurrentPods, @@ -3985,7 +5629,7 @@ CreateAsyncInt64MetricK8sStatefulsetCurrentPods(metrics::Meter *meter) unitMetricK8sStatefulsetCurrentPods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sStatefulsetCurrentPods(metrics::Meter *meter) { return meter->CreateDoubleObservableUpDownCounter(kMetricK8sStatefulsetCurrentPods, @@ -3994,19 +5638,22 @@ CreateAsyncDoubleMetricK8sStatefulsetCurrentPods(metrics::Meter *meter) } /** - Number of desired replica pods in this statefulset. -

    - This metric aligns with the @code replicas @endcode field of the - This metric aligns with the @code replicas + @endcode field of the K8s StatefulSetSpec.

    updowncounter */ -static constexpr const char *kMetricK8sStatefulsetDesiredPods = "k8s.statefulset.desired_pods"; -static constexpr const char *descrMetricK8sStatefulsetDesiredPods = - "Number of desired replica pods in this statefulset."; -static constexpr const char *unitMetricK8sStatefulsetDesiredPods = "{pod}"; +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sStatefulsetDesiredPods = + "k8s.statefulset.desired_pods"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sStatefulsetDesiredPods = + "Deprecated, use `k8s.statefulset.pod.desired` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sStatefulsetDesiredPods = "{pod}"; -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricK8sStatefulsetDesiredPods(metrics::Meter *meter) { return meter->CreateInt64UpDownCounter(kMetricK8sStatefulsetDesiredPods, @@ -4014,7 +5661,7 @@ CreateSyncInt64MetricK8sStatefulsetDesiredPods(metrics::Meter *meter) unitMetricK8sStatefulsetDesiredPods); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sStatefulsetDesiredPods(metrics::Meter *meter) { return meter->CreateDoubleUpDownCounter(kMetricK8sStatefulsetDesiredPods, @@ -4022,7 +5669,7 @@ CreateSyncDoubleMetricK8sStatefulsetDesiredPods(metrics::Meter *meter) unitMetricK8sStatefulsetDesiredPods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncInt64MetricK8sStatefulsetDesiredPods(metrics::Meter *meter) { return meter->CreateInt64ObservableUpDownCounter(kMetricK8sStatefulsetDesiredPods, @@ -4030,7 +5677,7 @@ CreateAsyncInt64MetricK8sStatefulsetDesiredPods(metrics::Meter *meter) unitMetricK8sStatefulsetDesiredPods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sStatefulsetDesiredPods(metrics::Meter *meter) { return meter->CreateDoubleObservableUpDownCounter(kMetricK8sStatefulsetDesiredPods, @@ -4038,6 +5685,96 @@ CreateAsyncDoubleMetricK8sStatefulsetDesiredPods(metrics::Meter *meter) unitMetricK8sStatefulsetDesiredPods); } +/** + The number of replica pods created by the statefulset controller from the statefulset version + indicated by currentRevision.

    This metric aligns with the @code currentReplicas @endcode field + of the K8s + StatefulSetStatus.

    updowncounter + */ +static constexpr const char *kMetricK8sStatefulsetPodCurrent = "k8s.statefulset.pod.current"; +static constexpr const char *descrMetricK8sStatefulsetPodCurrent = + "The number of replica pods created by the statefulset controller from the statefulset version " + "indicated by currentRevision."; +static constexpr const char *unitMetricK8sStatefulsetPodCurrent = "{pod}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sStatefulsetPodCurrent(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sStatefulsetPodCurrent, + descrMetricK8sStatefulsetPodCurrent, + unitMetricK8sStatefulsetPodCurrent); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sStatefulsetPodCurrent(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sStatefulsetPodCurrent, + descrMetricK8sStatefulsetPodCurrent, + unitMetricK8sStatefulsetPodCurrent); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sStatefulsetPodCurrent(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sStatefulsetPodCurrent, + descrMetricK8sStatefulsetPodCurrent, + unitMetricK8sStatefulsetPodCurrent); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sStatefulsetPodCurrent(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sStatefulsetPodCurrent, + descrMetricK8sStatefulsetPodCurrent, + unitMetricK8sStatefulsetPodCurrent); +} + +/** + Number of desired replica pods in this statefulset. +

    + This metric aligns with the @code replicas @endcode field of the + K8s + StatefulSetSpec.

    updowncounter + */ +static constexpr const char *kMetricK8sStatefulsetPodDesired = "k8s.statefulset.pod.desired"; +static constexpr const char *descrMetricK8sStatefulsetPodDesired = + "Number of desired replica pods in this statefulset."; +static constexpr const char *unitMetricK8sStatefulsetPodDesired = "{pod}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sStatefulsetPodDesired(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sStatefulsetPodDesired, + descrMetricK8sStatefulsetPodDesired, + unitMetricK8sStatefulsetPodDesired); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sStatefulsetPodDesired(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sStatefulsetPodDesired, + descrMetricK8sStatefulsetPodDesired, + unitMetricK8sStatefulsetPodDesired); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sStatefulsetPodDesired(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sStatefulsetPodDesired, + descrMetricK8sStatefulsetPodDesired, + unitMetricK8sStatefulsetPodDesired); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sStatefulsetPodDesired(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sStatefulsetPodDesired, + descrMetricK8sStatefulsetPodDesired, + unitMetricK8sStatefulsetPodDesired); +} + /** The number of replica pods created for this statefulset with a Ready Condition.

    @@ -4046,12 +5783,105 @@ CreateAsyncDoubleMetricK8sStatefulsetDesiredPods(metrics::Meter *meter) href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetstatus-v1-apps">K8s StatefulSetStatus.

    updowncounter */ -static constexpr const char *kMetricK8sStatefulsetReadyPods = "k8s.statefulset.ready_pods"; -static constexpr const char *descrMetricK8sStatefulsetReadyPods = +static constexpr const char *kMetricK8sStatefulsetPodReady = "k8s.statefulset.pod.ready"; +static constexpr const char *descrMetricK8sStatefulsetPodReady = "The number of replica pods created for this statefulset with a Ready Condition."; -static constexpr const char *unitMetricK8sStatefulsetReadyPods = "{pod}"; +static constexpr const char *unitMetricK8sStatefulsetPodReady = "{pod}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sStatefulsetPodReady(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sStatefulsetPodReady, + descrMetricK8sStatefulsetPodReady, + unitMetricK8sStatefulsetPodReady); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sStatefulsetPodReady(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sStatefulsetPodReady, + descrMetricK8sStatefulsetPodReady, + unitMetricK8sStatefulsetPodReady); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sStatefulsetPodReady(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sStatefulsetPodReady, + descrMetricK8sStatefulsetPodReady, + unitMetricK8sStatefulsetPodReady); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sStatefulsetPodReady(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sStatefulsetPodReady, + descrMetricK8sStatefulsetPodReady, + unitMetricK8sStatefulsetPodReady); +} + +/** + Number of replica pods created by the statefulset controller from the statefulset version + indicated by updateRevision.

    This metric aligns with the @code updatedReplicas @endcode field + of the K8s + StatefulSetStatus.

    updowncounter + */ +static constexpr const char *kMetricK8sStatefulsetPodUpdated = "k8s.statefulset.pod.updated"; +static constexpr const char *descrMetricK8sStatefulsetPodUpdated = + "Number of replica pods created by the statefulset controller from the statefulset version " + "indicated by updateRevision."; +static constexpr const char *unitMetricK8sStatefulsetPodUpdated = "{pod}"; static inline nostd::unique_ptr> +CreateSyncInt64MetricK8sStatefulsetPodUpdated(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricK8sStatefulsetPodUpdated, + descrMetricK8sStatefulsetPodUpdated, + unitMetricK8sStatefulsetPodUpdated); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricK8sStatefulsetPodUpdated(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricK8sStatefulsetPodUpdated, + descrMetricK8sStatefulsetPodUpdated, + unitMetricK8sStatefulsetPodUpdated); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricK8sStatefulsetPodUpdated(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricK8sStatefulsetPodUpdated, + descrMetricK8sStatefulsetPodUpdated, + unitMetricK8sStatefulsetPodUpdated); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricK8sStatefulsetPodUpdated(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricK8sStatefulsetPodUpdated, + descrMetricK8sStatefulsetPodUpdated, + unitMetricK8sStatefulsetPodUpdated); +} + +/** + Deprecated, use @code k8s.statefulset.pod.ready @endcode instead. + + @deprecated + {"note": "Replaced by @code k8s.statefulset.pod.ready @endcode.", "reason": "renamed", + "renamed_to": "k8s.statefulset.pod.ready"}

    This metric aligns with the @code readyReplicas + @endcode field of the K8s + StatefulSetStatus.

    updowncounter + */ +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sStatefulsetReadyPods = + "k8s.statefulset.ready_pods"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sStatefulsetReadyPods = + "Deprecated, use `k8s.statefulset.pod.ready` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sStatefulsetReadyPods = "{pod}"; + +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricK8sStatefulsetReadyPods(metrics::Meter *meter) { return meter->CreateInt64UpDownCounter(kMetricK8sStatefulsetReadyPods, @@ -4059,7 +5889,7 @@ CreateSyncInt64MetricK8sStatefulsetReadyPods(metrics::Meter *meter) unitMetricK8sStatefulsetReadyPods); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sStatefulsetReadyPods(metrics::Meter *meter) { return meter->CreateDoubleUpDownCounter(kMetricK8sStatefulsetReadyPods, @@ -4067,7 +5897,7 @@ CreateSyncDoubleMetricK8sStatefulsetReadyPods(metrics::Meter *meter) unitMetricK8sStatefulsetReadyPods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncInt64MetricK8sStatefulsetReadyPods(metrics::Meter *meter) { return meter->CreateInt64ObservableUpDownCounter(kMetricK8sStatefulsetReadyPods, @@ -4075,7 +5905,7 @@ CreateAsyncInt64MetricK8sStatefulsetReadyPods(metrics::Meter *meter) unitMetricK8sStatefulsetReadyPods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sStatefulsetReadyPods(metrics::Meter *meter) { return meter->CreateDoubleObservableUpDownCounter(kMetricK8sStatefulsetReadyPods, @@ -4084,19 +5914,22 @@ CreateAsyncDoubleMetricK8sStatefulsetReadyPods(metrics::Meter *meter) } /** - Number of replica pods created by the statefulset controller from the statefulset version - indicated by updateRevision.

    This metric aligns with the @code updatedReplicas @endcode field - of the This metric aligns with the @code updatedReplicas + @endcode field of the K8s StatefulSetStatus.

    updowncounter */ -static constexpr const char *kMetricK8sStatefulsetUpdatedPods = "k8s.statefulset.updated_pods"; -static constexpr const char *descrMetricK8sStatefulsetUpdatedPods = - "Number of replica pods created by the statefulset controller from the statefulset version " - "indicated by updateRevision."; -static constexpr const char *unitMetricK8sStatefulsetUpdatedPods = "{pod}"; +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricK8sStatefulsetUpdatedPods = + "k8s.statefulset.updated_pods"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricK8sStatefulsetUpdatedPods = + "Deprecated, use `k8s.statefulset.pod.updated` instead."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricK8sStatefulsetUpdatedPods = "{pod}"; -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricK8sStatefulsetUpdatedPods(metrics::Meter *meter) { return meter->CreateInt64UpDownCounter(kMetricK8sStatefulsetUpdatedPods, @@ -4104,7 +5937,7 @@ CreateSyncInt64MetricK8sStatefulsetUpdatedPods(metrics::Meter *meter) unitMetricK8sStatefulsetUpdatedPods); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricK8sStatefulsetUpdatedPods(metrics::Meter *meter) { return meter->CreateDoubleUpDownCounter(kMetricK8sStatefulsetUpdatedPods, @@ -4112,7 +5945,7 @@ CreateSyncDoubleMetricK8sStatefulsetUpdatedPods(metrics::Meter *meter) unitMetricK8sStatefulsetUpdatedPods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncInt64MetricK8sStatefulsetUpdatedPods(metrics::Meter *meter) { return meter->CreateInt64ObservableUpDownCounter(kMetricK8sStatefulsetUpdatedPods, @@ -4120,7 +5953,7 @@ CreateAsyncInt64MetricK8sStatefulsetUpdatedPods(metrics::Meter *meter) unitMetricK8sStatefulsetUpdatedPods); } -static inline nostd::shared_ptr +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr CreateAsyncDoubleMetricK8sStatefulsetUpdatedPods(metrics::Meter *meter) { return meter->CreateDoubleObservableUpDownCounter(kMetricK8sStatefulsetUpdatedPods, diff --git a/api/include/opentelemetry/semconv/incubating/messaging_attributes.h b/api/include/opentelemetry/semconv/incubating/messaging_attributes.h index 4a3e48eac1..6bd5ae8100 100644 --- a/api/include/opentelemetry/semconv/incubating/messaging_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/messaging_attributes.h @@ -164,8 +164,8 @@ OPENTELEMETRY_DEPRECATED static constexpr const char *kMessagingKafkaConsumerGro Deprecated, use @code messaging.destination.partition.id @endcode instead. @deprecated - {"note": "Replaced by @code messaging.destination.partition.id @endcode.", "reason": "renamed", - "renamed_to": "messaging.destination.partition.id"} + {"note": "Record string representation of the partition id in @code + messaging.destination.partition.id @endcode attribute.", "reason": "uncategorized"} */ OPENTELEMETRY_DEPRECATED static constexpr const char *kMessagingKafkaDestinationPartition = "messaging.kafka.destination.partition"; diff --git a/api/include/opentelemetry/semconv/incubating/nfs_attributes.h b/api/include/opentelemetry/semconv/incubating/nfs_attributes.h new file mode 100644 index 0000000000..41aec45907 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/nfs_attributes.h @@ -0,0 +1,35 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace nfs +{ + +/** + NFSv4+ operation name. + */ +static constexpr const char *kNfsOperationName = "nfs.operation.name"; + +/** + Linux: one of "hit" (NFSD_STATS_RC_HITS), "miss" (NFSD_STATS_RC_MISSES), or "nocache" + (NFSD_STATS_RC_NOCACHE -- uncacheable) + */ +static constexpr const char *kNfsServerRepcacheStatus = "nfs.server.repcache.status"; + +} // namespace nfs +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/nfs_metrics.h b/api/include/opentelemetry/semconv/incubating/nfs_metrics.h new file mode 100644 index 0000000000..5d08b13bc0 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/nfs_metrics.h @@ -0,0 +1,692 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_metrics-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/metrics/meter.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace nfs +{ + +/** + Reports the count of kernel NFS client TCP segments and UDP datagrams handled. +

    + Linux: this metric is taken from the Linux kernel's svc_stat.netudpcnt and svc_stat.nettcpcnt +

    + counter + */ +static constexpr const char *kMetricNfsClientNetCount = "nfs.client.net.count"; +static constexpr const char *descrMetricNfsClientNetCount = + "Reports the count of kernel NFS client TCP segments and UDP datagrams handled."; +static constexpr const char *unitMetricNfsClientNetCount = "{record}"; + +static inline nostd::unique_ptr> CreateSyncInt64MetricNfsClientNetCount( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricNfsClientNetCount, descrMetricNfsClientNetCount, + unitMetricNfsClientNetCount); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricNfsClientNetCount( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricNfsClientNetCount, descrMetricNfsClientNetCount, + unitMetricNfsClientNetCount); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricNfsClientNetCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricNfsClientNetCount, descrMetricNfsClientNetCount, + unitMetricNfsClientNetCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricNfsClientNetCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter( + kMetricNfsClientNetCount, descrMetricNfsClientNetCount, unitMetricNfsClientNetCount); +} + +/** + Reports the count of kernel NFS client TCP connections accepted. +

    + Linux: this metric is taken from the Linux kernel's svc_stat.nettcpconn +

    + counter + */ +static constexpr const char *kMetricNfsClientNetTcpConnectionAccepted = + "nfs.client.net.tcp.connection.accepted"; +static constexpr const char *descrMetricNfsClientNetTcpConnectionAccepted = + "Reports the count of kernel NFS client TCP connections accepted."; +static constexpr const char *unitMetricNfsClientNetTcpConnectionAccepted = "{connection}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricNfsClientNetTcpConnectionAccepted(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricNfsClientNetTcpConnectionAccepted, + descrMetricNfsClientNetTcpConnectionAccepted, + unitMetricNfsClientNetTcpConnectionAccepted); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricNfsClientNetTcpConnectionAccepted(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricNfsClientNetTcpConnectionAccepted, + descrMetricNfsClientNetTcpConnectionAccepted, + unitMetricNfsClientNetTcpConnectionAccepted); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricNfsClientNetTcpConnectionAccepted(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricNfsClientNetTcpConnectionAccepted, + descrMetricNfsClientNetTcpConnectionAccepted, + unitMetricNfsClientNetTcpConnectionAccepted); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricNfsClientNetTcpConnectionAccepted(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricNfsClientNetTcpConnectionAccepted, + descrMetricNfsClientNetTcpConnectionAccepted, + unitMetricNfsClientNetTcpConnectionAccepted); +} + +/** + Reports the count of kernel NFSv4+ client operations. +

    + counter + */ +static constexpr const char *kMetricNfsClientOperationCount = "nfs.client.operation.count"; +static constexpr const char *descrMetricNfsClientOperationCount = + "Reports the count of kernel NFSv4+ client operations."; +static constexpr const char *unitMetricNfsClientOperationCount = "{operation}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricNfsClientOperationCount(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricNfsClientOperationCount, + descrMetricNfsClientOperationCount, + unitMetricNfsClientOperationCount); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricNfsClientOperationCount(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricNfsClientOperationCount, + descrMetricNfsClientOperationCount, + unitMetricNfsClientOperationCount); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricNfsClientOperationCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricNfsClientOperationCount, + descrMetricNfsClientOperationCount, + unitMetricNfsClientOperationCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricNfsClientOperationCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricNfsClientOperationCount, + descrMetricNfsClientOperationCount, + unitMetricNfsClientOperationCount); +} + +/** + Reports the count of kernel NFS client procedures. +

    + counter + */ +static constexpr const char *kMetricNfsClientProcedureCount = "nfs.client.procedure.count"; +static constexpr const char *descrMetricNfsClientProcedureCount = + "Reports the count of kernel NFS client procedures."; +static constexpr const char *unitMetricNfsClientProcedureCount = "{procedure}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricNfsClientProcedureCount(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricNfsClientProcedureCount, + descrMetricNfsClientProcedureCount, + unitMetricNfsClientProcedureCount); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricNfsClientProcedureCount(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricNfsClientProcedureCount, + descrMetricNfsClientProcedureCount, + unitMetricNfsClientProcedureCount); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricNfsClientProcedureCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricNfsClientProcedureCount, + descrMetricNfsClientProcedureCount, + unitMetricNfsClientProcedureCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricNfsClientProcedureCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricNfsClientProcedureCount, + descrMetricNfsClientProcedureCount, + unitMetricNfsClientProcedureCount); +} + +/** + Reports the count of kernel NFS client RPC authentication refreshes. +

    + Linux: this metric is taken from the Linux kernel's svc_stat.rpcauthrefresh +

    + counter + */ +static constexpr const char *kMetricNfsClientRpcAuthrefreshCount = + "nfs.client.rpc.authrefresh.count"; +static constexpr const char *descrMetricNfsClientRpcAuthrefreshCount = + "Reports the count of kernel NFS client RPC authentication refreshes."; +static constexpr const char *unitMetricNfsClientRpcAuthrefreshCount = "{authrefresh}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricNfsClientRpcAuthrefreshCount(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricNfsClientRpcAuthrefreshCount, + descrMetricNfsClientRpcAuthrefreshCount, + unitMetricNfsClientRpcAuthrefreshCount); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricNfsClientRpcAuthrefreshCount(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricNfsClientRpcAuthrefreshCount, + descrMetricNfsClientRpcAuthrefreshCount, + unitMetricNfsClientRpcAuthrefreshCount); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricNfsClientRpcAuthrefreshCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricNfsClientRpcAuthrefreshCount, + descrMetricNfsClientRpcAuthrefreshCount, + unitMetricNfsClientRpcAuthrefreshCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricNfsClientRpcAuthrefreshCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricNfsClientRpcAuthrefreshCount, + descrMetricNfsClientRpcAuthrefreshCount, + unitMetricNfsClientRpcAuthrefreshCount); +} + +/** + Reports the count of kernel NFS client RPCs sent, regardless of whether they're accepted/rejected + by the server.

    Linux: this metric is taken from the Linux kernel's svc_stat.rpccnt

    counter + */ +static constexpr const char *kMetricNfsClientRpcCount = "nfs.client.rpc.count"; +static constexpr const char *descrMetricNfsClientRpcCount = + "Reports the count of kernel NFS client RPCs sent, regardless of whether they're " + "accepted/rejected by the server."; +static constexpr const char *unitMetricNfsClientRpcCount = "{request}"; + +static inline nostd::unique_ptr> CreateSyncInt64MetricNfsClientRpcCount( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricNfsClientRpcCount, descrMetricNfsClientRpcCount, + unitMetricNfsClientRpcCount); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricNfsClientRpcCount( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricNfsClientRpcCount, descrMetricNfsClientRpcCount, + unitMetricNfsClientRpcCount); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricNfsClientRpcCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricNfsClientRpcCount, descrMetricNfsClientRpcCount, + unitMetricNfsClientRpcCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricNfsClientRpcCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter( + kMetricNfsClientRpcCount, descrMetricNfsClientRpcCount, unitMetricNfsClientRpcCount); +} + +/** + Reports the count of kernel NFS client RPC retransmits. +

    + Linux: this metric is taken from the Linux kernel's svc_stat.rpcretrans +

    + counter + */ +static constexpr const char *kMetricNfsClientRpcRetransmitCount = "nfs.client.rpc.retransmit.count"; +static constexpr const char *descrMetricNfsClientRpcRetransmitCount = + "Reports the count of kernel NFS client RPC retransmits."; +static constexpr const char *unitMetricNfsClientRpcRetransmitCount = "{retransmit}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricNfsClientRpcRetransmitCount(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricNfsClientRpcRetransmitCount, + descrMetricNfsClientRpcRetransmitCount, + unitMetricNfsClientRpcRetransmitCount); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricNfsClientRpcRetransmitCount(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricNfsClientRpcRetransmitCount, + descrMetricNfsClientRpcRetransmitCount, + unitMetricNfsClientRpcRetransmitCount); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricNfsClientRpcRetransmitCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricNfsClientRpcRetransmitCount, + descrMetricNfsClientRpcRetransmitCount, + unitMetricNfsClientRpcRetransmitCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricNfsClientRpcRetransmitCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricNfsClientRpcRetransmitCount, + descrMetricNfsClientRpcRetransmitCount, + unitMetricNfsClientRpcRetransmitCount); +} + +/** + Reports the count of kernel NFS server stale file handles. +

    + Linux: this metric is taken from the Linux kernel NFSD_STATS_FH_STALE counter in the nfsd_net + struct

    counter + */ +static constexpr const char *kMetricNfsServerFhStaleCount = "nfs.server.fh.stale.count"; +static constexpr const char *descrMetricNfsServerFhStaleCount = + "Reports the count of kernel NFS server stale file handles."; +static constexpr const char *unitMetricNfsServerFhStaleCount = "{fh}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricNfsServerFhStaleCount(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricNfsServerFhStaleCount, descrMetricNfsServerFhStaleCount, + unitMetricNfsServerFhStaleCount); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricNfsServerFhStaleCount(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricNfsServerFhStaleCount, descrMetricNfsServerFhStaleCount, + unitMetricNfsServerFhStaleCount); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricNfsServerFhStaleCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricNfsServerFhStaleCount, + descrMetricNfsServerFhStaleCount, + unitMetricNfsServerFhStaleCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricNfsServerFhStaleCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricNfsServerFhStaleCount, + descrMetricNfsServerFhStaleCount, + unitMetricNfsServerFhStaleCount); +} + +/** + Reports the count of kernel NFS server bytes returned to receive and transmit (read and write) + requests.

    Linux: this metric is taken from the Linux kernel NFSD_STATS_IO_READ and + NFSD_STATS_IO_WRITE counters in the nfsd_net struct

    counter + */ +static constexpr const char *kMetricNfsServerIo = "nfs.server.io"; +static constexpr const char *descrMetricNfsServerIo = + "Reports the count of kernel NFS server bytes returned to receive and transmit (read and " + "write) requests."; +static constexpr const char *unitMetricNfsServerIo = "By"; + +static inline nostd::unique_ptr> CreateSyncInt64MetricNfsServerIo( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricNfsServerIo, descrMetricNfsServerIo, + unitMetricNfsServerIo); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricNfsServerIo( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricNfsServerIo, descrMetricNfsServerIo, + unitMetricNfsServerIo); +} + +static inline nostd::shared_ptr CreateAsyncInt64MetricNfsServerIo( + metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricNfsServerIo, descrMetricNfsServerIo, + unitMetricNfsServerIo); +} + +static inline nostd::shared_ptr CreateAsyncDoubleMetricNfsServerIo( + metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricNfsServerIo, descrMetricNfsServerIo, + unitMetricNfsServerIo); +} + +/** + Reports the count of kernel NFS server TCP segments and UDP datagrams handled. +

    + Linux: this metric is taken from the Linux kernel's svc_stat.nettcpcnt and svc_stat.netudpcnt +

    + counter + */ +static constexpr const char *kMetricNfsServerNetCount = "nfs.server.net.count"; +static constexpr const char *descrMetricNfsServerNetCount = + "Reports the count of kernel NFS server TCP segments and UDP datagrams handled."; +static constexpr const char *unitMetricNfsServerNetCount = "{record}"; + +static inline nostd::unique_ptr> CreateSyncInt64MetricNfsServerNetCount( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricNfsServerNetCount, descrMetricNfsServerNetCount, + unitMetricNfsServerNetCount); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricNfsServerNetCount( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricNfsServerNetCount, descrMetricNfsServerNetCount, + unitMetricNfsServerNetCount); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricNfsServerNetCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricNfsServerNetCount, descrMetricNfsServerNetCount, + unitMetricNfsServerNetCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricNfsServerNetCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter( + kMetricNfsServerNetCount, descrMetricNfsServerNetCount, unitMetricNfsServerNetCount); +} + +/** + Reports the count of kernel NFS server TCP connections accepted. +

    + Linux: this metric is taken from the Linux kernel's svc_stat.nettcpconn +

    + counter + */ +static constexpr const char *kMetricNfsServerNetTcpConnectionAccepted = + "nfs.server.net.tcp.connection.accepted"; +static constexpr const char *descrMetricNfsServerNetTcpConnectionAccepted = + "Reports the count of kernel NFS server TCP connections accepted."; +static constexpr const char *unitMetricNfsServerNetTcpConnectionAccepted = "{connection}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricNfsServerNetTcpConnectionAccepted(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricNfsServerNetTcpConnectionAccepted, + descrMetricNfsServerNetTcpConnectionAccepted, + unitMetricNfsServerNetTcpConnectionAccepted); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricNfsServerNetTcpConnectionAccepted(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricNfsServerNetTcpConnectionAccepted, + descrMetricNfsServerNetTcpConnectionAccepted, + unitMetricNfsServerNetTcpConnectionAccepted); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricNfsServerNetTcpConnectionAccepted(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricNfsServerNetTcpConnectionAccepted, + descrMetricNfsServerNetTcpConnectionAccepted, + unitMetricNfsServerNetTcpConnectionAccepted); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricNfsServerNetTcpConnectionAccepted(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricNfsServerNetTcpConnectionAccepted, + descrMetricNfsServerNetTcpConnectionAccepted, + unitMetricNfsServerNetTcpConnectionAccepted); +} + +/** + Reports the count of kernel NFSv4+ server operations. +

    + counter + */ +static constexpr const char *kMetricNfsServerOperationCount = "nfs.server.operation.count"; +static constexpr const char *descrMetricNfsServerOperationCount = + "Reports the count of kernel NFSv4+ server operations."; +static constexpr const char *unitMetricNfsServerOperationCount = "{operation}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricNfsServerOperationCount(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricNfsServerOperationCount, + descrMetricNfsServerOperationCount, + unitMetricNfsServerOperationCount); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricNfsServerOperationCount(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricNfsServerOperationCount, + descrMetricNfsServerOperationCount, + unitMetricNfsServerOperationCount); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricNfsServerOperationCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricNfsServerOperationCount, + descrMetricNfsServerOperationCount, + unitMetricNfsServerOperationCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricNfsServerOperationCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricNfsServerOperationCount, + descrMetricNfsServerOperationCount, + unitMetricNfsServerOperationCount); +} + +/** + Reports the count of kernel NFS server procedures. +

    + counter + */ +static constexpr const char *kMetricNfsServerProcedureCount = "nfs.server.procedure.count"; +static constexpr const char *descrMetricNfsServerProcedureCount = + "Reports the count of kernel NFS server procedures."; +static constexpr const char *unitMetricNfsServerProcedureCount = "{procedure}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricNfsServerProcedureCount(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricNfsServerProcedureCount, + descrMetricNfsServerProcedureCount, + unitMetricNfsServerProcedureCount); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricNfsServerProcedureCount(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricNfsServerProcedureCount, + descrMetricNfsServerProcedureCount, + unitMetricNfsServerProcedureCount); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricNfsServerProcedureCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricNfsServerProcedureCount, + descrMetricNfsServerProcedureCount, + unitMetricNfsServerProcedureCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricNfsServerProcedureCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricNfsServerProcedureCount, + descrMetricNfsServerProcedureCount, + unitMetricNfsServerProcedureCount); +} + +/** + Reports the kernel NFS server reply cache request count by cache hit status. +

    + counter + */ +static constexpr const char *kMetricNfsServerRepcacheRequests = "nfs.server.repcache.requests"; +static constexpr const char *descrMetricNfsServerRepcacheRequests = + "Reports the kernel NFS server reply cache request count by cache hit status."; +static constexpr const char *unitMetricNfsServerRepcacheRequests = "{request}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricNfsServerRepcacheRequests(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricNfsServerRepcacheRequests, + descrMetricNfsServerRepcacheRequests, + unitMetricNfsServerRepcacheRequests); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricNfsServerRepcacheRequests(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricNfsServerRepcacheRequests, + descrMetricNfsServerRepcacheRequests, + unitMetricNfsServerRepcacheRequests); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricNfsServerRepcacheRequests(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricNfsServerRepcacheRequests, + descrMetricNfsServerRepcacheRequests, + unitMetricNfsServerRepcacheRequests); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricNfsServerRepcacheRequests(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter(kMetricNfsServerRepcacheRequests, + descrMetricNfsServerRepcacheRequests, + unitMetricNfsServerRepcacheRequests); +} + +/** + Reports the count of kernel NFS server RPCs handled. +

    + Linux: this metric is taken from the Linux kernel's svc_stat.rpccnt, the count of good RPCs. This + metric can have an error.type of "format", "auth", or "client" for svc_stat.badfmt, + svc_stat.badauth, and svc_stat.badclnt.

    counter + */ +static constexpr const char *kMetricNfsServerRpcCount = "nfs.server.rpc.count"; +static constexpr const char *descrMetricNfsServerRpcCount = + "Reports the count of kernel NFS server RPCs handled."; +static constexpr const char *unitMetricNfsServerRpcCount = "{request}"; + +static inline nostd::unique_ptr> CreateSyncInt64MetricNfsServerRpcCount( + metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricNfsServerRpcCount, descrMetricNfsServerRpcCount, + unitMetricNfsServerRpcCount); +} + +static inline nostd::unique_ptr> CreateSyncDoubleMetricNfsServerRpcCount( + metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricNfsServerRpcCount, descrMetricNfsServerRpcCount, + unitMetricNfsServerRpcCount); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricNfsServerRpcCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter(kMetricNfsServerRpcCount, descrMetricNfsServerRpcCount, + unitMetricNfsServerRpcCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricNfsServerRpcCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter( + kMetricNfsServerRpcCount, descrMetricNfsServerRpcCount, unitMetricNfsServerRpcCount); +} + +/** + Reports the count of kernel NFS server available threads. +

    + Linux: this metric is taken from the Linux kernel nfsd_th_cnt variable +

    + updowncounter + */ +static constexpr const char *kMetricNfsServerThreadCount = "nfs.server.thread.count"; +static constexpr const char *descrMetricNfsServerThreadCount = + "Reports the count of kernel NFS server available threads."; +static constexpr const char *unitMetricNfsServerThreadCount = "{thread}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricNfsServerThreadCount(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter( + kMetricNfsServerThreadCount, descrMetricNfsServerThreadCount, unitMetricNfsServerThreadCount); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricNfsServerThreadCount(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter( + kMetricNfsServerThreadCount, descrMetricNfsServerThreadCount, unitMetricNfsServerThreadCount); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricNfsServerThreadCount(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricNfsServerThreadCount, descrMetricNfsServerThreadCount, unitMetricNfsServerThreadCount); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricNfsServerThreadCount(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricNfsServerThreadCount, descrMetricNfsServerThreadCount, unitMetricNfsServerThreadCount); +} + +} // namespace nfs +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/onc_rpc_attributes.h b/api/include/opentelemetry/semconv/incubating/onc_rpc_attributes.h new file mode 100644 index 0000000000..afd4487268 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/onc_rpc_attributes.h @@ -0,0 +1,44 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace onc_rpc +{ + +/** + ONC/Sun RPC procedure name. + */ +static constexpr const char *kOncRpcProcedureName = "onc_rpc.procedure.name"; + +/** + ONC/Sun RPC procedure number. + */ +static constexpr const char *kOncRpcProcedureNumber = "onc_rpc.procedure.number"; + +/** + ONC/Sun RPC program name. + */ +static constexpr const char *kOncRpcProgramName = "onc_rpc.program.name"; + +/** + ONC/Sun RPC program version. + */ +static constexpr const char *kOncRpcVersion = "onc_rpc.version"; + +} // namespace onc_rpc +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/openshift_attributes.h b/api/include/opentelemetry/semconv/incubating/openshift_attributes.h new file mode 100644 index 0000000000..fe3f5da2c3 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/openshift_attributes.h @@ -0,0 +1,34 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace openshift +{ + +/** + The name of the cluster quota. + */ +static constexpr const char *kOpenshiftClusterquotaName = "openshift.clusterquota.name"; + +/** + The UID of the cluster quota. + */ +static constexpr const char *kOpenshiftClusterquotaUid = "openshift.clusterquota.uid"; + +} // namespace openshift +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/openshift_metrics.h b/api/include/opentelemetry/semconv/incubating/openshift_metrics.h new file mode 100644 index 0000000000..f2e7ab2c26 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/openshift_metrics.h @@ -0,0 +1,1065 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_metrics-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/metrics/meter.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace openshift +{ + +/** + The enforced hard limit of the resource across all projects. +

    + This metric is retrieved from the @code Status.Total.Hard @endcode field of the + K8s + ResourceQuotaStatus of the ClusterResourceQuota. +

    + updowncounter + */ +static constexpr const char *kMetricOpenshiftClusterquotaCpuLimitHard = + "openshift.clusterquota.cpu.limit.hard"; +static constexpr const char *descrMetricOpenshiftClusterquotaCpuLimitHard = + "The enforced hard limit of the resource across all projects. + "; + static constexpr const char *unitMetricOpenshiftClusterquotaCpuLimitHard = "{cpu}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricOpenshiftClusterquotaCpuLimitHard(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricOpenshiftClusterquotaCpuLimitHard, + descrMetricOpenshiftClusterquotaCpuLimitHard, + unitMetricOpenshiftClusterquotaCpuLimitHard); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricOpenshiftClusterquotaCpuLimitHard(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricOpenshiftClusterquotaCpuLimitHard, + descrMetricOpenshiftClusterquotaCpuLimitHard, + unitMetricOpenshiftClusterquotaCpuLimitHard); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricOpenshiftClusterquotaCpuLimitHard(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricOpenshiftClusterquotaCpuLimitHard, + descrMetricOpenshiftClusterquotaCpuLimitHard, + unitMetricOpenshiftClusterquotaCpuLimitHard); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricOpenshiftClusterquotaCpuLimitHard(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricOpenshiftClusterquotaCpuLimitHard, + descrMetricOpenshiftClusterquotaCpuLimitHard, + unitMetricOpenshiftClusterquotaCpuLimitHard); +} + +/** + The current observed total usage of the resource across all projects. +

    + This metric is retrieved from the @code Status.Total.Used @endcode field of the + K8s + ResourceQuotaStatus of the ClusterResourceQuota. +

    + updowncounter + */ +static constexpr const char *kMetricOpenshiftClusterquotaCpuLimitUsed = + "openshift.clusterquota.cpu.limit.used"; +static constexpr const char *descrMetricOpenshiftClusterquotaCpuLimitUsed = + "The current observed total usage of the resource across all projects. + "; + static constexpr const char *unitMetricOpenshiftClusterquotaCpuLimitUsed = "{cpu}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricOpenshiftClusterquotaCpuLimitUsed(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricOpenshiftClusterquotaCpuLimitUsed, + descrMetricOpenshiftClusterquotaCpuLimitUsed, + unitMetricOpenshiftClusterquotaCpuLimitUsed); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricOpenshiftClusterquotaCpuLimitUsed(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricOpenshiftClusterquotaCpuLimitUsed, + descrMetricOpenshiftClusterquotaCpuLimitUsed, + unitMetricOpenshiftClusterquotaCpuLimitUsed); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricOpenshiftClusterquotaCpuLimitUsed(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricOpenshiftClusterquotaCpuLimitUsed, + descrMetricOpenshiftClusterquotaCpuLimitUsed, + unitMetricOpenshiftClusterquotaCpuLimitUsed); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricOpenshiftClusterquotaCpuLimitUsed(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricOpenshiftClusterquotaCpuLimitUsed, + descrMetricOpenshiftClusterquotaCpuLimitUsed, + unitMetricOpenshiftClusterquotaCpuLimitUsed); +} + +/** + The enforced hard limit of the resource across all projects. +

    + This metric is retrieved from the @code Status.Total.Hard @endcode field of the + K8s + ResourceQuotaStatus of the ClusterResourceQuota. +

    + updowncounter + */ +static constexpr const char *kMetricOpenshiftClusterquotaCpuRequestHard = + "openshift.clusterquota.cpu.request.hard"; +static constexpr const char *descrMetricOpenshiftClusterquotaCpuRequestHard = + "The enforced hard limit of the resource across all projects. + "; + static constexpr const char *unitMetricOpenshiftClusterquotaCpuRequestHard = "{cpu}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricOpenshiftClusterquotaCpuRequestHard(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricOpenshiftClusterquotaCpuRequestHard, + descrMetricOpenshiftClusterquotaCpuRequestHard, + unitMetricOpenshiftClusterquotaCpuRequestHard); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricOpenshiftClusterquotaCpuRequestHard(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricOpenshiftClusterquotaCpuRequestHard, + descrMetricOpenshiftClusterquotaCpuRequestHard, + unitMetricOpenshiftClusterquotaCpuRequestHard); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricOpenshiftClusterquotaCpuRequestHard(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricOpenshiftClusterquotaCpuRequestHard, + descrMetricOpenshiftClusterquotaCpuRequestHard, + unitMetricOpenshiftClusterquotaCpuRequestHard); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricOpenshiftClusterquotaCpuRequestHard(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricOpenshiftClusterquotaCpuRequestHard, + descrMetricOpenshiftClusterquotaCpuRequestHard, + unitMetricOpenshiftClusterquotaCpuRequestHard); +} + +/** + The current observed total usage of the resource across all projects. +

    + This metric is retrieved from the @code Status.Total.Used @endcode field of the + K8s + ResourceQuotaStatus of the ClusterResourceQuota. +

    + updowncounter + */ +static constexpr const char *kMetricOpenshiftClusterquotaCpuRequestUsed = + "openshift.clusterquota.cpu.request.used"; +static constexpr const char *descrMetricOpenshiftClusterquotaCpuRequestUsed = + "The current observed total usage of the resource across all projects. + "; + static constexpr const char *unitMetricOpenshiftClusterquotaCpuRequestUsed = "{cpu}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricOpenshiftClusterquotaCpuRequestUsed(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricOpenshiftClusterquotaCpuRequestUsed, + descrMetricOpenshiftClusterquotaCpuRequestUsed, + unitMetricOpenshiftClusterquotaCpuRequestUsed); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricOpenshiftClusterquotaCpuRequestUsed(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricOpenshiftClusterquotaCpuRequestUsed, + descrMetricOpenshiftClusterquotaCpuRequestUsed, + unitMetricOpenshiftClusterquotaCpuRequestUsed); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricOpenshiftClusterquotaCpuRequestUsed(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricOpenshiftClusterquotaCpuRequestUsed, + descrMetricOpenshiftClusterquotaCpuRequestUsed, + unitMetricOpenshiftClusterquotaCpuRequestUsed); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricOpenshiftClusterquotaCpuRequestUsed(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricOpenshiftClusterquotaCpuRequestUsed, + descrMetricOpenshiftClusterquotaCpuRequestUsed, + unitMetricOpenshiftClusterquotaCpuRequestUsed); +} + +/** + The enforced hard limit of the resource across all projects. +

    + This metric is retrieved from the @code Status.Total.Hard @endcode field of the + K8s + ResourceQuotaStatus of the ClusterResourceQuota. +

    + updowncounter + */ +static constexpr const char *kMetricOpenshiftClusterquotaEphemeralStorageLimitHard = + "openshift.clusterquota.ephemeral_storage.limit.hard"; +static constexpr const char *descrMetricOpenshiftClusterquotaEphemeralStorageLimitHard = + "The enforced hard limit of the resource across all projects. + "; + static constexpr const char *unitMetricOpenshiftClusterquotaEphemeralStorageLimitHard = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricOpenshiftClusterquotaEphemeralStorageLimitHard(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricOpenshiftClusterquotaEphemeralStorageLimitHard, + descrMetricOpenshiftClusterquotaEphemeralStorageLimitHard, + unitMetricOpenshiftClusterquotaEphemeralStorageLimitHard); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricOpenshiftClusterquotaEphemeralStorageLimitHard(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricOpenshiftClusterquotaEphemeralStorageLimitHard, + descrMetricOpenshiftClusterquotaEphemeralStorageLimitHard, + unitMetricOpenshiftClusterquotaEphemeralStorageLimitHard); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricOpenshiftClusterquotaEphemeralStorageLimitHard(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricOpenshiftClusterquotaEphemeralStorageLimitHard, + descrMetricOpenshiftClusterquotaEphemeralStorageLimitHard, + unitMetricOpenshiftClusterquotaEphemeralStorageLimitHard); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricOpenshiftClusterquotaEphemeralStorageLimitHard(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricOpenshiftClusterquotaEphemeralStorageLimitHard, + descrMetricOpenshiftClusterquotaEphemeralStorageLimitHard, + unitMetricOpenshiftClusterquotaEphemeralStorageLimitHard); +} + +/** + The current observed total usage of the resource across all projects. +

    + This metric is retrieved from the @code Status.Total.Used @endcode field of the + K8s + ResourceQuotaStatus of the ClusterResourceQuota. +

    + updowncounter + */ +static constexpr const char *kMetricOpenshiftClusterquotaEphemeralStorageLimitUsed = + "openshift.clusterquota.ephemeral_storage.limit.used"; +static constexpr const char *descrMetricOpenshiftClusterquotaEphemeralStorageLimitUsed = + "The current observed total usage of the resource across all projects. + "; + static constexpr const char *unitMetricOpenshiftClusterquotaEphemeralStorageLimitUsed = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricOpenshiftClusterquotaEphemeralStorageLimitUsed(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricOpenshiftClusterquotaEphemeralStorageLimitUsed, + descrMetricOpenshiftClusterquotaEphemeralStorageLimitUsed, + unitMetricOpenshiftClusterquotaEphemeralStorageLimitUsed); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricOpenshiftClusterquotaEphemeralStorageLimitUsed(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricOpenshiftClusterquotaEphemeralStorageLimitUsed, + descrMetricOpenshiftClusterquotaEphemeralStorageLimitUsed, + unitMetricOpenshiftClusterquotaEphemeralStorageLimitUsed); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricOpenshiftClusterquotaEphemeralStorageLimitUsed(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricOpenshiftClusterquotaEphemeralStorageLimitUsed, + descrMetricOpenshiftClusterquotaEphemeralStorageLimitUsed, + unitMetricOpenshiftClusterquotaEphemeralStorageLimitUsed); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricOpenshiftClusterquotaEphemeralStorageLimitUsed(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricOpenshiftClusterquotaEphemeralStorageLimitUsed, + descrMetricOpenshiftClusterquotaEphemeralStorageLimitUsed, + unitMetricOpenshiftClusterquotaEphemeralStorageLimitUsed); +} + +/** + The enforced hard limit of the resource across all projects. +

    + This metric is retrieved from the @code Status.Total.Hard @endcode field of the + K8s + ResourceQuotaStatus of the ClusterResourceQuota. +

    + updowncounter + */ +static constexpr const char *kMetricOpenshiftClusterquotaEphemeralStorageRequestHard = + "openshift.clusterquota.ephemeral_storage.request.hard"; +static constexpr const char *descrMetricOpenshiftClusterquotaEphemeralStorageRequestHard = + "The enforced hard limit of the resource across all projects. + "; + static constexpr const char *unitMetricOpenshiftClusterquotaEphemeralStorageRequestHard = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricOpenshiftClusterquotaEphemeralStorageRequestHard(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter( + kMetricOpenshiftClusterquotaEphemeralStorageRequestHard, + descrMetricOpenshiftClusterquotaEphemeralStorageRequestHard, + unitMetricOpenshiftClusterquotaEphemeralStorageRequestHard); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricOpenshiftClusterquotaEphemeralStorageRequestHard(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter( + kMetricOpenshiftClusterquotaEphemeralStorageRequestHard, + descrMetricOpenshiftClusterquotaEphemeralStorageRequestHard, + unitMetricOpenshiftClusterquotaEphemeralStorageRequestHard); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricOpenshiftClusterquotaEphemeralStorageRequestHard(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricOpenshiftClusterquotaEphemeralStorageRequestHard, + descrMetricOpenshiftClusterquotaEphemeralStorageRequestHard, + unitMetricOpenshiftClusterquotaEphemeralStorageRequestHard); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricOpenshiftClusterquotaEphemeralStorageRequestHard(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricOpenshiftClusterquotaEphemeralStorageRequestHard, + descrMetricOpenshiftClusterquotaEphemeralStorageRequestHard, + unitMetricOpenshiftClusterquotaEphemeralStorageRequestHard); +} + +/** + The current observed total usage of the resource across all projects. +

    + This metric is retrieved from the @code Status.Total.Used @endcode field of the + K8s + ResourceQuotaStatus of the ClusterResourceQuota. +

    + updowncounter + */ +static constexpr const char *kMetricOpenshiftClusterquotaEphemeralStorageRequestUsed = + "openshift.clusterquota.ephemeral_storage.request.used"; +static constexpr const char *descrMetricOpenshiftClusterquotaEphemeralStorageRequestUsed = + "The current observed total usage of the resource across all projects. + "; + static constexpr const char *unitMetricOpenshiftClusterquotaEphemeralStorageRequestUsed = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricOpenshiftClusterquotaEphemeralStorageRequestUsed(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter( + kMetricOpenshiftClusterquotaEphemeralStorageRequestUsed, + descrMetricOpenshiftClusterquotaEphemeralStorageRequestUsed, + unitMetricOpenshiftClusterquotaEphemeralStorageRequestUsed); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricOpenshiftClusterquotaEphemeralStorageRequestUsed(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter( + kMetricOpenshiftClusterquotaEphemeralStorageRequestUsed, + descrMetricOpenshiftClusterquotaEphemeralStorageRequestUsed, + unitMetricOpenshiftClusterquotaEphemeralStorageRequestUsed); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricOpenshiftClusterquotaEphemeralStorageRequestUsed(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricOpenshiftClusterquotaEphemeralStorageRequestUsed, + descrMetricOpenshiftClusterquotaEphemeralStorageRequestUsed, + unitMetricOpenshiftClusterquotaEphemeralStorageRequestUsed); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricOpenshiftClusterquotaEphemeralStorageRequestUsed(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricOpenshiftClusterquotaEphemeralStorageRequestUsed, + descrMetricOpenshiftClusterquotaEphemeralStorageRequestUsed, + unitMetricOpenshiftClusterquotaEphemeralStorageRequestUsed); +} + +/** + The enforced hard limit of the resource across all projects. +

    + This metric is retrieved from the @code Status.Total.Hard @endcode field of the + K8s + ResourceQuotaStatus of the ClusterResourceQuota. +

    + updowncounter + */ +static constexpr const char *kMetricOpenshiftClusterquotaHugepageCountRequestHard = + "openshift.clusterquota.hugepage_count.request.hard"; +static constexpr const char *descrMetricOpenshiftClusterquotaHugepageCountRequestHard = + "The enforced hard limit of the resource across all projects. + "; + static constexpr const char *unitMetricOpenshiftClusterquotaHugepageCountRequestHard = + "{hugepage}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricOpenshiftClusterquotaHugepageCountRequestHard(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricOpenshiftClusterquotaHugepageCountRequestHard, + descrMetricOpenshiftClusterquotaHugepageCountRequestHard, + unitMetricOpenshiftClusterquotaHugepageCountRequestHard); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricOpenshiftClusterquotaHugepageCountRequestHard(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricOpenshiftClusterquotaHugepageCountRequestHard, + descrMetricOpenshiftClusterquotaHugepageCountRequestHard, + unitMetricOpenshiftClusterquotaHugepageCountRequestHard); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricOpenshiftClusterquotaHugepageCountRequestHard(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricOpenshiftClusterquotaHugepageCountRequestHard, + descrMetricOpenshiftClusterquotaHugepageCountRequestHard, + unitMetricOpenshiftClusterquotaHugepageCountRequestHard); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricOpenshiftClusterquotaHugepageCountRequestHard(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricOpenshiftClusterquotaHugepageCountRequestHard, + descrMetricOpenshiftClusterquotaHugepageCountRequestHard, + unitMetricOpenshiftClusterquotaHugepageCountRequestHard); +} + +/** + The current observed total usage of the resource across all projects. +

    + This metric is retrieved from the @code Status.Total.Used @endcode field of the + K8s + ResourceQuotaStatus of the ClusterResourceQuota. +

    + updowncounter + */ +static constexpr const char *kMetricOpenshiftClusterquotaHugepageCountRequestUsed = + "openshift.clusterquota.hugepage_count.request.used"; +static constexpr const char *descrMetricOpenshiftClusterquotaHugepageCountRequestUsed = + "The current observed total usage of the resource across all projects. + "; + static constexpr const char *unitMetricOpenshiftClusterquotaHugepageCountRequestUsed = + "{hugepage}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricOpenshiftClusterquotaHugepageCountRequestUsed(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricOpenshiftClusterquotaHugepageCountRequestUsed, + descrMetricOpenshiftClusterquotaHugepageCountRequestUsed, + unitMetricOpenshiftClusterquotaHugepageCountRequestUsed); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricOpenshiftClusterquotaHugepageCountRequestUsed(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricOpenshiftClusterquotaHugepageCountRequestUsed, + descrMetricOpenshiftClusterquotaHugepageCountRequestUsed, + unitMetricOpenshiftClusterquotaHugepageCountRequestUsed); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricOpenshiftClusterquotaHugepageCountRequestUsed(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricOpenshiftClusterquotaHugepageCountRequestUsed, + descrMetricOpenshiftClusterquotaHugepageCountRequestUsed, + unitMetricOpenshiftClusterquotaHugepageCountRequestUsed); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricOpenshiftClusterquotaHugepageCountRequestUsed(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricOpenshiftClusterquotaHugepageCountRequestUsed, + descrMetricOpenshiftClusterquotaHugepageCountRequestUsed, + unitMetricOpenshiftClusterquotaHugepageCountRequestUsed); +} + +/** + The enforced hard limit of the resource across all projects. +

    + This metric is retrieved from the @code Status.Total.Hard @endcode field of the + K8s + ResourceQuotaStatus of the ClusterResourceQuota. +

    + updowncounter + */ +static constexpr const char *kMetricOpenshiftClusterquotaMemoryLimitHard = + "openshift.clusterquota.memory.limit.hard"; +static constexpr const char *descrMetricOpenshiftClusterquotaMemoryLimitHard = + "The enforced hard limit of the resource across all projects. + "; + static constexpr const char *unitMetricOpenshiftClusterquotaMemoryLimitHard = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricOpenshiftClusterquotaMemoryLimitHard(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricOpenshiftClusterquotaMemoryLimitHard, + descrMetricOpenshiftClusterquotaMemoryLimitHard, + unitMetricOpenshiftClusterquotaMemoryLimitHard); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricOpenshiftClusterquotaMemoryLimitHard(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricOpenshiftClusterquotaMemoryLimitHard, + descrMetricOpenshiftClusterquotaMemoryLimitHard, + unitMetricOpenshiftClusterquotaMemoryLimitHard); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricOpenshiftClusterquotaMemoryLimitHard(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricOpenshiftClusterquotaMemoryLimitHard, + descrMetricOpenshiftClusterquotaMemoryLimitHard, + unitMetricOpenshiftClusterquotaMemoryLimitHard); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricOpenshiftClusterquotaMemoryLimitHard(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricOpenshiftClusterquotaMemoryLimitHard, + descrMetricOpenshiftClusterquotaMemoryLimitHard, + unitMetricOpenshiftClusterquotaMemoryLimitHard); +} + +/** + The current observed total usage of the resource across all projects. +

    + This metric is retrieved from the @code Status.Total.Used @endcode field of the + K8s + ResourceQuotaStatus of the ClusterResourceQuota. +

    + updowncounter + */ +static constexpr const char *kMetricOpenshiftClusterquotaMemoryLimitUsed = + "openshift.clusterquota.memory.limit.used"; +static constexpr const char *descrMetricOpenshiftClusterquotaMemoryLimitUsed = + "The current observed total usage of the resource across all projects. + "; + static constexpr const char *unitMetricOpenshiftClusterquotaMemoryLimitUsed = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricOpenshiftClusterquotaMemoryLimitUsed(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricOpenshiftClusterquotaMemoryLimitUsed, + descrMetricOpenshiftClusterquotaMemoryLimitUsed, + unitMetricOpenshiftClusterquotaMemoryLimitUsed); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricOpenshiftClusterquotaMemoryLimitUsed(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricOpenshiftClusterquotaMemoryLimitUsed, + descrMetricOpenshiftClusterquotaMemoryLimitUsed, + unitMetricOpenshiftClusterquotaMemoryLimitUsed); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricOpenshiftClusterquotaMemoryLimitUsed(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricOpenshiftClusterquotaMemoryLimitUsed, + descrMetricOpenshiftClusterquotaMemoryLimitUsed, + unitMetricOpenshiftClusterquotaMemoryLimitUsed); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricOpenshiftClusterquotaMemoryLimitUsed(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricOpenshiftClusterquotaMemoryLimitUsed, + descrMetricOpenshiftClusterquotaMemoryLimitUsed, + unitMetricOpenshiftClusterquotaMemoryLimitUsed); +} + +/** + The enforced hard limit of the resource across all projects. +

    + This metric is retrieved from the @code Status.Total.Hard @endcode field of the + K8s + ResourceQuotaStatus of the ClusterResourceQuota. +

    + updowncounter + */ +static constexpr const char *kMetricOpenshiftClusterquotaMemoryRequestHard = + "openshift.clusterquota.memory.request.hard"; +static constexpr const char *descrMetricOpenshiftClusterquotaMemoryRequestHard = + "The enforced hard limit of the resource across all projects. + "; + static constexpr const char *unitMetricOpenshiftClusterquotaMemoryRequestHard = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricOpenshiftClusterquotaMemoryRequestHard(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricOpenshiftClusterquotaMemoryRequestHard, + descrMetricOpenshiftClusterquotaMemoryRequestHard, + unitMetricOpenshiftClusterquotaMemoryRequestHard); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricOpenshiftClusterquotaMemoryRequestHard(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricOpenshiftClusterquotaMemoryRequestHard, + descrMetricOpenshiftClusterquotaMemoryRequestHard, + unitMetricOpenshiftClusterquotaMemoryRequestHard); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricOpenshiftClusterquotaMemoryRequestHard(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricOpenshiftClusterquotaMemoryRequestHard, + descrMetricOpenshiftClusterquotaMemoryRequestHard, + unitMetricOpenshiftClusterquotaMemoryRequestHard); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricOpenshiftClusterquotaMemoryRequestHard(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricOpenshiftClusterquotaMemoryRequestHard, + descrMetricOpenshiftClusterquotaMemoryRequestHard, + unitMetricOpenshiftClusterquotaMemoryRequestHard); +} + +/** + The current observed total usage of the resource across all projects. +

    + This metric is retrieved from the @code Status.Total.Used @endcode field of the + K8s + ResourceQuotaStatus of the ClusterResourceQuota. +

    + updowncounter + */ +static constexpr const char *kMetricOpenshiftClusterquotaMemoryRequestUsed = + "openshift.clusterquota.memory.request.used"; +static constexpr const char *descrMetricOpenshiftClusterquotaMemoryRequestUsed = + "The current observed total usage of the resource across all projects. + "; + static constexpr const char *unitMetricOpenshiftClusterquotaMemoryRequestUsed = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricOpenshiftClusterquotaMemoryRequestUsed(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricOpenshiftClusterquotaMemoryRequestUsed, + descrMetricOpenshiftClusterquotaMemoryRequestUsed, + unitMetricOpenshiftClusterquotaMemoryRequestUsed); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricOpenshiftClusterquotaMemoryRequestUsed(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricOpenshiftClusterquotaMemoryRequestUsed, + descrMetricOpenshiftClusterquotaMemoryRequestUsed, + unitMetricOpenshiftClusterquotaMemoryRequestUsed); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricOpenshiftClusterquotaMemoryRequestUsed(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricOpenshiftClusterquotaMemoryRequestUsed, + descrMetricOpenshiftClusterquotaMemoryRequestUsed, + unitMetricOpenshiftClusterquotaMemoryRequestUsed); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricOpenshiftClusterquotaMemoryRequestUsed(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricOpenshiftClusterquotaMemoryRequestUsed, + descrMetricOpenshiftClusterquotaMemoryRequestUsed, + unitMetricOpenshiftClusterquotaMemoryRequestUsed); +} + +/** + The enforced hard limit of the resource across all projects. +

    + This metric is retrieved from the @code Status.Total.Hard @endcode field of the + K8s + ResourceQuotaStatus of the ClusterResourceQuota. +

    + updowncounter + */ +static constexpr const char *kMetricOpenshiftClusterquotaObjectCountHard = + "openshift.clusterquota.object_count.hard"; +static constexpr const char *descrMetricOpenshiftClusterquotaObjectCountHard = + "The enforced hard limit of the resource across all projects. + "; + static constexpr const char *unitMetricOpenshiftClusterquotaObjectCountHard = "{object}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricOpenshiftClusterquotaObjectCountHard(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricOpenshiftClusterquotaObjectCountHard, + descrMetricOpenshiftClusterquotaObjectCountHard, + unitMetricOpenshiftClusterquotaObjectCountHard); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricOpenshiftClusterquotaObjectCountHard(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricOpenshiftClusterquotaObjectCountHard, + descrMetricOpenshiftClusterquotaObjectCountHard, + unitMetricOpenshiftClusterquotaObjectCountHard); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricOpenshiftClusterquotaObjectCountHard(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricOpenshiftClusterquotaObjectCountHard, + descrMetricOpenshiftClusterquotaObjectCountHard, + unitMetricOpenshiftClusterquotaObjectCountHard); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricOpenshiftClusterquotaObjectCountHard(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricOpenshiftClusterquotaObjectCountHard, + descrMetricOpenshiftClusterquotaObjectCountHard, + unitMetricOpenshiftClusterquotaObjectCountHard); +} + +/** + The current observed total usage of the resource across all projects. +

    + This metric is retrieved from the @code Status.Total.Used @endcode field of the + K8s + ResourceQuotaStatus of the ClusterResourceQuota. +

    + updowncounter + */ +static constexpr const char *kMetricOpenshiftClusterquotaObjectCountUsed = + "openshift.clusterquota.object_count.used"; +static constexpr const char *descrMetricOpenshiftClusterquotaObjectCountUsed = + "The current observed total usage of the resource across all projects. + "; + static constexpr const char *unitMetricOpenshiftClusterquotaObjectCountUsed = "{object}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricOpenshiftClusterquotaObjectCountUsed(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricOpenshiftClusterquotaObjectCountUsed, + descrMetricOpenshiftClusterquotaObjectCountUsed, + unitMetricOpenshiftClusterquotaObjectCountUsed); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricOpenshiftClusterquotaObjectCountUsed(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricOpenshiftClusterquotaObjectCountUsed, + descrMetricOpenshiftClusterquotaObjectCountUsed, + unitMetricOpenshiftClusterquotaObjectCountUsed); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricOpenshiftClusterquotaObjectCountUsed(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter(kMetricOpenshiftClusterquotaObjectCountUsed, + descrMetricOpenshiftClusterquotaObjectCountUsed, + unitMetricOpenshiftClusterquotaObjectCountUsed); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricOpenshiftClusterquotaObjectCountUsed(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter(kMetricOpenshiftClusterquotaObjectCountUsed, + descrMetricOpenshiftClusterquotaObjectCountUsed, + unitMetricOpenshiftClusterquotaObjectCountUsed); +} + +/** + The enforced hard limit of the resource across all projects. +

    + This metric is retrieved from the @code Status.Total.Hard @endcode field of the + K8s + ResourceQuotaStatus of the ClusterResourceQuota. +

    + The @code k8s.storageclass.name @endcode should be required when a resource quota is defined for a + specific storage class.

    updowncounter + */ +static constexpr const char *kMetricOpenshiftClusterquotaPersistentvolumeclaimCountHard = + "openshift.clusterquota.persistentvolumeclaim_count.hard"; +static constexpr const char *descrMetricOpenshiftClusterquotaPersistentvolumeclaimCountHard = + "The enforced hard limit of the resource across all projects. + "; + static constexpr const char *unitMetricOpenshiftClusterquotaPersistentvolumeclaimCountHard = + "{persistentvolumeclaim}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricOpenshiftClusterquotaPersistentvolumeclaimCountHard(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter( + kMetricOpenshiftClusterquotaPersistentvolumeclaimCountHard, + descrMetricOpenshiftClusterquotaPersistentvolumeclaimCountHard, + unitMetricOpenshiftClusterquotaPersistentvolumeclaimCountHard); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricOpenshiftClusterquotaPersistentvolumeclaimCountHard(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter( + kMetricOpenshiftClusterquotaPersistentvolumeclaimCountHard, + descrMetricOpenshiftClusterquotaPersistentvolumeclaimCountHard, + unitMetricOpenshiftClusterquotaPersistentvolumeclaimCountHard); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricOpenshiftClusterquotaPersistentvolumeclaimCountHard(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricOpenshiftClusterquotaPersistentvolumeclaimCountHard, + descrMetricOpenshiftClusterquotaPersistentvolumeclaimCountHard, + unitMetricOpenshiftClusterquotaPersistentvolumeclaimCountHard); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricOpenshiftClusterquotaPersistentvolumeclaimCountHard(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricOpenshiftClusterquotaPersistentvolumeclaimCountHard, + descrMetricOpenshiftClusterquotaPersistentvolumeclaimCountHard, + unitMetricOpenshiftClusterquotaPersistentvolumeclaimCountHard); +} + +/** + The current observed total usage of the resource across all projects. +

    + This metric is retrieved from the @code Status.Total.Used @endcode field of the + K8s + ResourceQuotaStatus of the ClusterResourceQuota. +

    + The @code k8s.storageclass.name @endcode should be required when a resource quota is defined for a + specific storage class.

    updowncounter + */ +static constexpr const char *kMetricOpenshiftClusterquotaPersistentvolumeclaimCountUsed = + "openshift.clusterquota.persistentvolumeclaim_count.used"; +static constexpr const char *descrMetricOpenshiftClusterquotaPersistentvolumeclaimCountUsed = + "The current observed total usage of the resource across all projects. + "; + static constexpr const char *unitMetricOpenshiftClusterquotaPersistentvolumeclaimCountUsed = + "{persistentvolumeclaim}"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricOpenshiftClusterquotaPersistentvolumeclaimCountUsed(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter( + kMetricOpenshiftClusterquotaPersistentvolumeclaimCountUsed, + descrMetricOpenshiftClusterquotaPersistentvolumeclaimCountUsed, + unitMetricOpenshiftClusterquotaPersistentvolumeclaimCountUsed); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricOpenshiftClusterquotaPersistentvolumeclaimCountUsed(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter( + kMetricOpenshiftClusterquotaPersistentvolumeclaimCountUsed, + descrMetricOpenshiftClusterquotaPersistentvolumeclaimCountUsed, + unitMetricOpenshiftClusterquotaPersistentvolumeclaimCountUsed); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricOpenshiftClusterquotaPersistentvolumeclaimCountUsed(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricOpenshiftClusterquotaPersistentvolumeclaimCountUsed, + descrMetricOpenshiftClusterquotaPersistentvolumeclaimCountUsed, + unitMetricOpenshiftClusterquotaPersistentvolumeclaimCountUsed); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricOpenshiftClusterquotaPersistentvolumeclaimCountUsed(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricOpenshiftClusterquotaPersistentvolumeclaimCountUsed, + descrMetricOpenshiftClusterquotaPersistentvolumeclaimCountUsed, + unitMetricOpenshiftClusterquotaPersistentvolumeclaimCountUsed); +} + +/** + The enforced hard limit of the resource across all projects. +

    + This metric is retrieved from the @code Status.Total.Hard @endcode field of the + K8s + ResourceQuotaStatus of the ClusterResourceQuota. +

    + The @code k8s.storageclass.name @endcode should be required when a resource quota is defined for a + specific storage class.

    updowncounter + */ +static constexpr const char *kMetricOpenshiftClusterquotaStorageRequestHard = + "openshift.clusterquota.storage.request.hard"; +static constexpr const char *descrMetricOpenshiftClusterquotaStorageRequestHard = + "The enforced hard limit of the resource across all projects. + "; + static constexpr const char *unitMetricOpenshiftClusterquotaStorageRequestHard = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricOpenshiftClusterquotaStorageRequestHard(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricOpenshiftClusterquotaStorageRequestHard, + descrMetricOpenshiftClusterquotaStorageRequestHard, + unitMetricOpenshiftClusterquotaStorageRequestHard); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricOpenshiftClusterquotaStorageRequestHard(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricOpenshiftClusterquotaStorageRequestHard, + descrMetricOpenshiftClusterquotaStorageRequestHard, + unitMetricOpenshiftClusterquotaStorageRequestHard); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricOpenshiftClusterquotaStorageRequestHard(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricOpenshiftClusterquotaStorageRequestHard, + descrMetricOpenshiftClusterquotaStorageRequestHard, + unitMetricOpenshiftClusterquotaStorageRequestHard); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricOpenshiftClusterquotaStorageRequestHard(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricOpenshiftClusterquotaStorageRequestHard, + descrMetricOpenshiftClusterquotaStorageRequestHard, + unitMetricOpenshiftClusterquotaStorageRequestHard); +} + +/** + The current observed total usage of the resource across all projects. +

    + This metric is retrieved from the @code Status.Total.Used @endcode field of the + K8s + ResourceQuotaStatus of the ClusterResourceQuota. +

    + The @code k8s.storageclass.name @endcode should be required when a resource quota is defined for a + specific storage class.

    updowncounter + */ +static constexpr const char *kMetricOpenshiftClusterquotaStorageRequestUsed = + "openshift.clusterquota.storage.request.used"; +static constexpr const char *descrMetricOpenshiftClusterquotaStorageRequestUsed = + "The current observed total usage of the resource across all projects. + "; + static constexpr const char *unitMetricOpenshiftClusterquotaStorageRequestUsed = "By"; + +static inline nostd::unique_ptr> +CreateSyncInt64MetricOpenshiftClusterquotaStorageRequestUsed(metrics::Meter *meter) +{ + return meter->CreateInt64UpDownCounter(kMetricOpenshiftClusterquotaStorageRequestUsed, + descrMetricOpenshiftClusterquotaStorageRequestUsed, + unitMetricOpenshiftClusterquotaStorageRequestUsed); +} + +static inline nostd::unique_ptr> +CreateSyncDoubleMetricOpenshiftClusterquotaStorageRequestUsed(metrics::Meter *meter) +{ + return meter->CreateDoubleUpDownCounter(kMetricOpenshiftClusterquotaStorageRequestUsed, + descrMetricOpenshiftClusterquotaStorageRequestUsed, + unitMetricOpenshiftClusterquotaStorageRequestUsed); +} + +static inline nostd::shared_ptr +CreateAsyncInt64MetricOpenshiftClusterquotaStorageRequestUsed(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableUpDownCounter( + kMetricOpenshiftClusterquotaStorageRequestUsed, + descrMetricOpenshiftClusterquotaStorageRequestUsed, + unitMetricOpenshiftClusterquotaStorageRequestUsed); +} + +static inline nostd::shared_ptr +CreateAsyncDoubleMetricOpenshiftClusterquotaStorageRequestUsed(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableUpDownCounter( + kMetricOpenshiftClusterquotaStorageRequestUsed, + descrMetricOpenshiftClusterquotaStorageRequestUsed, + unitMetricOpenshiftClusterquotaStorageRequestUsed); +} + +} // namespace openshift +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/peer_attributes.h b/api/include/opentelemetry/semconv/incubating/peer_attributes.h index acc6621d24..290258ebed 100644 --- a/api/include/opentelemetry/semconv/incubating/peer_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/peer_attributes.h @@ -22,7 +22,12 @@ namespace peer /** The @code service.name @endcode of the remote service. SHOULD be equal to the actual @code service.name @endcode resource attribute of the - remote service if any. + remote service if any.

    Examples of @code peer.service @endcode that users may specify:

      +
    • A Redis cache of auth tokens as @code peer.service="AuthTokenCache" @endcode.
    • +
    • A gRPC service @code rpc.service="io.opentelemetry.AuthService" @endcode may be hosted in + both a gateway, @code peer.service="ExternalApiService" @endcode and a backend, @code + peer.service="AuthService" @endcode.
    • +
    */ static constexpr const char *kPeerService = "peer.service"; diff --git a/api/include/opentelemetry/semconv/incubating/pprof_attributes.h b/api/include/opentelemetry/semconv/incubating/pprof_attributes.h new file mode 100644 index 0000000000..dc55f9c7e1 --- /dev/null +++ b/api/include/opentelemetry/semconv/incubating/pprof_attributes.h @@ -0,0 +1,58 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +/* + * DO NOT EDIT, this is an Auto-generated file from: + * buildscripts/semantic-convention/templates/registry/semantic_attributes-h.j2 + */ + +#pragma once + +#include "opentelemetry/common/macros.h" +#include "opentelemetry/version.h" + +OPENTELEMETRY_BEGIN_NAMESPACE +namespace semconv +{ +namespace pprof +{ + +/** + Provides an indication that multiple symbols map to this location's address, for example due to + identical code folding by the linker. In that case the line information represents one of the + multiple symbols. This field must be recomputed when the symbolization state of the profile + changes. + */ +static constexpr const char *kPprofLocationIsFolded = "pprof.location.is_folded"; + +/** + Indicates that there are filenames related to this mapping. + */ +static constexpr const char *kPprofMappingHasFilenames = "pprof.mapping.has_filenames"; + +/** + Indicates that there are functions related to this mapping. + */ +static constexpr const char *kPprofMappingHasFunctions = "pprof.mapping.has_functions"; + +/** + Indicates that there are inline frames related to this mapping. + */ +static constexpr const char *kPprofMappingHasInlineFrames = "pprof.mapping.has_inline_frames"; + +/** + Indicates that there are line numbers related to this mapping. + */ +static constexpr const char *kPprofMappingHasLineNumbers = "pprof.mapping.has_line_numbers"; + +/** + Free-form text associated with the profile. This field should not be used to store any + machine-readable information, it is only for human-friendly content. + */ +static constexpr const char *kPprofProfileComment = "pprof.profile.comment"; + +} // namespace pprof +} // namespace semconv +OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/process_attributes.h b/api/include/opentelemetry/semconv/incubating/process_attributes.h index b6a8bd1d02..8b2f0b986a 100644 --- a/api/include/opentelemetry/semconv/incubating/process_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/process_attributes.h @@ -54,7 +54,7 @@ static constexpr const char *kProcessCommandLine = "process.command_line"; /** Specifies whether the context switches for this data point were voluntary or involuntary. */ -static constexpr const char *kProcessContextSwitchType = "process.context_switch_type"; +static constexpr const char *kProcessContextSwitchType = "process.context_switch.type"; /** Deprecated, use @code cpu.mode @endcode instead. @@ -158,10 +158,14 @@ static constexpr const char *kProcessLinuxCgroup = "process.linux.cgroup"; static constexpr const char *kProcessOwner = "process.owner"; /** - The type of page fault for this data point. Type @code major @endcode is for major/hard page - faults, and @code minor @endcode is for minor/soft page faults. + Deprecated, use @code system.paging.fault.type @endcode instead. + + @deprecated + {"note": "Replaced by @code system.paging.fault.type @endcode.", "reason": "renamed", + "renamed_to": "system.paging.fault.type"} */ -static constexpr const char *kProcessPagingFaultType = "process.paging.fault_type"; +OPENTELEMETRY_DEPRECATED static constexpr const char *kProcessPagingFaultType = + "process.paging.fault_type"; /** Parent Process identifier (PPID). @@ -214,6 +218,13 @@ static constexpr const char *kProcessSavedUserName = "process.saved_user.name"; */ static constexpr const char *kProcessSessionLeaderPid = "process.session_leader.pid"; +/** + The process state, e.g., Linux Process State + Codes + */ +static constexpr const char *kProcessState = "process.state"; + /** Process title (proctitle)

    @@ -274,6 +285,19 @@ static constexpr const char *kMinor = "minor"; } // namespace ProcessPagingFaultTypeValues +namespace ProcessStateValues +{ + +static constexpr const char *kRunning = "running"; + +static constexpr const char *kSleeping = "sleeping"; + +static constexpr const char *kStopped = "stopped"; + +static constexpr const char *kDefunct = "defunct"; + +} // namespace ProcessStateValues + } // namespace process } // namespace semconv OPENTELEMETRY_END_NAMESPACE diff --git a/api/include/opentelemetry/semconv/incubating/rpc_attributes.h b/api/include/opentelemetry/semconv/incubating/rpc_attributes.h index 8a85fe4697..ce5e9072f4 100644 --- a/api/include/opentelemetry/semconv/incubating/rpc_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/rpc_attributes.h @@ -123,22 +123,12 @@ static constexpr const char *kRpcMessageType = "rpc.message.type"; static constexpr const char *kRpcMessageUncompressedSize = "rpc.message.uncompressed_size"; /** - The name of the (logical) method being called, must be equal to the $method part in the span name. -

    - This is the logical name of the method from the RPC interface perspective, which can be different - from the name of any implementing method/function. The @code code.function.name @endcode attribute - may be used to store the latter (e.g., method actually executing the call on the server side, RPC - client stub method on the client side). + This is the logical name of the method from the RPC interface perspective. */ static constexpr const char *kRpcMethod = "rpc.method"; /** The full (logical) name of the service being called, including its package name, if applicable. -

    - This is the logical name of the service from the RPC interface perspective, which can be different - from the name of any implementing class. The @code code.namespace @endcode attribute may be used - to store the latter (despite the attribute name, it may include a class name; e.g., class with - method actually executing the call on the server side, RPC client stub class on the client side). */ static constexpr const char *kRpcService = "rpc.service"; @@ -309,6 +299,16 @@ static constexpr const char *kApacheDubbo = "apache_dubbo"; */ static constexpr const char *kConnectRpc = "connect_rpc"; +/** + ONC RPC (Sun RPC) + */ +static constexpr const char *kOncRpc = "onc_rpc"; + +/** + JSON-RPC + */ +static constexpr const char *kJsonrpc = "jsonrpc"; + } // namespace RpcSystemValues } // namespace rpc diff --git a/api/include/opentelemetry/semconv/incubating/rpc_metrics.h b/api/include/opentelemetry/semconv/incubating/rpc_metrics.h index a337142ef3..2933185e3e 100644 --- a/api/include/opentelemetry/semconv/incubating/rpc_metrics.h +++ b/api/include/opentelemetry/semconv/incubating/rpc_metrics.h @@ -77,6 +77,9 @@ CreateSyncDoubleMetricRpcClientRequestSize(metrics::Meter *meter) /** Measures the number of messages received per RPC. + + @deprecated + {"note": "Removed, no replacement at this time.", "reason": "obsoleted"}

    Should be 1 for all non-streaming RPCs.

    @@ -84,12 +87,13 @@ CreateSyncDoubleMetricRpcClientRequestSize(metrics::Meter *meter)

    histogram */ -static constexpr const char *kMetricRpcClientRequestsPerRpc = "rpc.client.requests_per_rpc"; -static constexpr const char *descrMetricRpcClientRequestsPerRpc = +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricRpcClientRequestsPerRpc = + "rpc.client.requests_per_rpc"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricRpcClientRequestsPerRpc = "Measures the number of messages received per RPC."; -static constexpr const char *unitMetricRpcClientRequestsPerRpc = "{count}"; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricRpcClientRequestsPerRpc = "{count}"; -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricRpcClientRequestsPerRpc(metrics::Meter *meter) { return meter->CreateUInt64Histogram(kMetricRpcClientRequestsPerRpc, @@ -97,7 +101,7 @@ CreateSyncInt64MetricRpcClientRequestsPerRpc(metrics::Meter *meter) unitMetricRpcClientRequestsPerRpc); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricRpcClientRequestsPerRpc(metrics::Meter *meter) { return meter->CreateDoubleHistogram(kMetricRpcClientRequestsPerRpc, @@ -135,6 +139,9 @@ CreateSyncDoubleMetricRpcClientResponseSize(metrics::Meter *meter) /** Measures the number of messages sent per RPC. + + @deprecated + {"note": "Removed, no replacement at this time.", "reason": "obsoleted"}

    Should be 1 for all non-streaming RPCs.

    @@ -142,12 +149,14 @@ CreateSyncDoubleMetricRpcClientResponseSize(metrics::Meter *meter)

    histogram */ -static constexpr const char *kMetricRpcClientResponsesPerRpc = "rpc.client.responses_per_rpc"; -static constexpr const char *descrMetricRpcClientResponsesPerRpc = +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricRpcClientResponsesPerRpc = + "rpc.client.responses_per_rpc"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricRpcClientResponsesPerRpc = "Measures the number of messages sent per RPC."; -static constexpr const char *unitMetricRpcClientResponsesPerRpc = "{count}"; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricRpcClientResponsesPerRpc = + "{count}"; -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricRpcClientResponsesPerRpc(metrics::Meter *meter) { return meter->CreateUInt64Histogram(kMetricRpcClientResponsesPerRpc, @@ -155,7 +164,7 @@ CreateSyncInt64MetricRpcClientResponsesPerRpc(metrics::Meter *meter) unitMetricRpcClientResponsesPerRpc); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricRpcClientResponsesPerRpc(metrics::Meter *meter) { return meter->CreateDoubleHistogram(kMetricRpcClientResponsesPerRpc, @@ -219,6 +228,9 @@ CreateSyncDoubleMetricRpcServerRequestSize(metrics::Meter *meter) /** Measures the number of messages received per RPC. + + @deprecated + {"note": "Removed, no replacement at this time.", "reason": "obsoleted"}

    Should be 1 for all non-streaming RPCs.

    @@ -226,12 +238,13 @@ CreateSyncDoubleMetricRpcServerRequestSize(metrics::Meter *meter)

    histogram */ -static constexpr const char *kMetricRpcServerRequestsPerRpc = "rpc.server.requests_per_rpc"; -static constexpr const char *descrMetricRpcServerRequestsPerRpc = +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricRpcServerRequestsPerRpc = + "rpc.server.requests_per_rpc"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricRpcServerRequestsPerRpc = "Measures the number of messages received per RPC."; -static constexpr const char *unitMetricRpcServerRequestsPerRpc = "{count}"; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricRpcServerRequestsPerRpc = "{count}"; -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricRpcServerRequestsPerRpc(metrics::Meter *meter) { return meter->CreateUInt64Histogram(kMetricRpcServerRequestsPerRpc, @@ -239,7 +252,7 @@ CreateSyncInt64MetricRpcServerRequestsPerRpc(metrics::Meter *meter) unitMetricRpcServerRequestsPerRpc); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricRpcServerRequestsPerRpc(metrics::Meter *meter) { return meter->CreateDoubleHistogram(kMetricRpcServerRequestsPerRpc, @@ -277,6 +290,9 @@ CreateSyncDoubleMetricRpcServerResponseSize(metrics::Meter *meter) /** Measures the number of messages sent per RPC. + + @deprecated + {"note": "Removed, no replacement at this time.", "reason": "obsoleted"}

    Should be 1 for all non-streaming RPCs.

    @@ -284,12 +300,14 @@ CreateSyncDoubleMetricRpcServerResponseSize(metrics::Meter *meter)

    histogram */ -static constexpr const char *kMetricRpcServerResponsesPerRpc = "rpc.server.responses_per_rpc"; -static constexpr const char *descrMetricRpcServerResponsesPerRpc = +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricRpcServerResponsesPerRpc = + "rpc.server.responses_per_rpc"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricRpcServerResponsesPerRpc = "Measures the number of messages sent per RPC."; -static constexpr const char *unitMetricRpcServerResponsesPerRpc = "{count}"; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricRpcServerResponsesPerRpc = + "{count}"; -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncInt64MetricRpcServerResponsesPerRpc(metrics::Meter *meter) { return meter->CreateUInt64Histogram(kMetricRpcServerResponsesPerRpc, @@ -297,7 +315,7 @@ CreateSyncInt64MetricRpcServerResponsesPerRpc(metrics::Meter *meter) unitMetricRpcServerResponsesPerRpc); } -static inline nostd::unique_ptr> +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> CreateSyncDoubleMetricRpcServerResponsesPerRpc(metrics::Meter *meter) { return meter->CreateDoubleHistogram(kMetricRpcServerResponsesPerRpc, diff --git a/api/include/opentelemetry/semconv/incubating/system_attributes.h b/api/include/opentelemetry/semconv/incubating/system_attributes.h index 7000190351..b9ad02de79 100644 --- a/api/include/opentelemetry/semconv/incubating/system_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/system_attributes.h @@ -21,8 +21,13 @@ namespace system /** Deprecated, use @code cpu.logical_number @endcode instead. + + @deprecated + {"note": "Replaced by @code cpu.logical_number @endcode.", "reason": "renamed", "renamed_to": + "cpu.logical_number"} */ -static constexpr const char *kSystemCpuLogicalNumber = "system.cpu.logical_number"; +OPENTELEMETRY_DEPRECATED static constexpr const char *kSystemCpuLogicalNumber = + "system.cpu.logical_number"; /** Deprecated, use @code cpu.mode @endcode instead. @@ -76,29 +81,41 @@ OPENTELEMETRY_DEPRECATED static constexpr const char *kSystemNetworkState = "sys */ static constexpr const char *kSystemPagingDirection = "system.paging.direction"; +/** + The paging fault type + */ +static constexpr const char *kSystemPagingFaultType = "system.paging.fault.type"; + /** The memory paging state */ static constexpr const char *kSystemPagingState = "system.paging.state"; /** - The memory paging type + Deprecated, use @code system.paging.fault.type @endcode instead. + + @deprecated + {"note": "Replaced by @code system.paging.fault.type @endcode.", "reason": "renamed", + "renamed_to": "system.paging.fault.type"} */ -static constexpr const char *kSystemPagingType = "system.paging.type"; +OPENTELEMETRY_DEPRECATED static constexpr const char *kSystemPagingType = "system.paging.type"; /** - The process state, e.g., Linux Process State - Codes + Deprecated, use @code process.state @endcode instead. + + @deprecated + {"note": "Replaced by @code process.state @endcode.", "reason": "renamed", "renamed_to": + "process.state"} */ -static constexpr const char *kSystemProcessStatus = "system.process.status"; +OPENTELEMETRY_DEPRECATED static constexpr const char *kSystemProcessStatus = + "system.process.status"; /** - Deprecated, use @code system.process.status @endcode instead. + Deprecated, use @code process.state @endcode instead. @deprecated - {"note": "Replaced by @code system.process.status @endcode.", "reason": "renamed", "renamed_to": - "system.process.status"} + {"note": "Replaced by @code process.state @endcode.", "reason": "renamed", "renamed_to": + "process.state"} */ OPENTELEMETRY_DEPRECATED static constexpr const char *kSystemProcessesStatus = "system.processes.status"; @@ -210,6 +227,15 @@ static constexpr const char *kOut = "out"; } // namespace SystemPagingDirectionValues +namespace SystemPagingFaultTypeValues +{ + +static constexpr const char *kMajor = "major"; + +static constexpr const char *kMinor = "minor"; + +} // namespace SystemPagingFaultTypeValues + namespace SystemPagingStateValues { diff --git a/api/include/opentelemetry/semconv/incubating/system_metrics.h b/api/include/opentelemetry/semconv/incubating/system_metrics.h index d0767b51a6..63106b053f 100644 --- a/api/include/opentelemetry/semconv/incubating/system_metrics.h +++ b/api/include/opentelemetry/semconv/incubating/system_metrics.h @@ -228,12 +228,12 @@ CreateAsyncDoubleMetricSystemCpuUtilization(metrics::Meter *meter) } /** - TODO. + Disk bytes transferred.

    counter */ static constexpr const char *kMetricSystemDiskIo = "system.disk.io"; -static constexpr const char *descrMetricSystemDiskIo = "TODO."; +static constexpr const char *descrMetricSystemDiskIo = "Disk bytes transferred."; static constexpr const char *unitMetricSystemDiskIo = "By"; static inline nostd::unique_ptr> CreateSyncInt64MetricSystemDiskIo( @@ -348,13 +348,14 @@ CreateAsyncDoubleMetricSystemDiskLimit(metrics::Meter *meter) } /** - TODO. + The number of disk reads/writes merged into single physical disk access operations.

    counter */ -static constexpr const char *kMetricSystemDiskMerged = "system.disk.merged"; -static constexpr const char *descrMetricSystemDiskMerged = "TODO."; -static constexpr const char *unitMetricSystemDiskMerged = "{operation}"; +static constexpr const char *kMetricSystemDiskMerged = "system.disk.merged"; +static constexpr const char *descrMetricSystemDiskMerged = + "The number of disk reads/writes merged into single physical disk access operations."; +static constexpr const char *unitMetricSystemDiskMerged = "{operation}"; static inline nostd::unique_ptr> CreateSyncInt64MetricSystemDiskMerged( metrics::Meter *meter) @@ -434,12 +435,12 @@ CreateAsyncDoubleMetricSystemDiskOperationTime(metrics::Meter *meter) } /** - TODO. + Disk operations count.

    counter */ static constexpr const char *kMetricSystemDiskOperations = "system.disk.operations"; -static constexpr const char *descrMetricSystemDiskOperations = "TODO."; +static constexpr const char *descrMetricSystemDiskOperations = "Disk operations count."; static constexpr const char *unitMetricSystemDiskOperations = "{operation}"; static inline nostd::unique_ptr> @@ -557,13 +558,14 @@ CreateAsyncDoubleMetricSystemFilesystemUsage(metrics::Meter *meter) } /** - TODO. + Fraction of filesystem bytes used.

    gauge */ static constexpr const char *kMetricSystemFilesystemUtilization = "system.filesystem.utilization"; -static constexpr const char *descrMetricSystemFilesystemUtilization = "TODO."; -static constexpr const char *unitMetricSystemFilesystemUtilization = "1"; +static constexpr const char *descrMetricSystemFilesystemUtilization = + "Fraction of filesystem bytes used."; +static constexpr const char *unitMetricSystemFilesystemUtilization = "1"; #if OPENTELEMETRY_ABI_VERSION_NO >= 2 @@ -812,13 +814,14 @@ CreateAsyncDoubleMetricSystemMemoryUsage(metrics::Meter *meter) } /** - TODO. + Percentage of memory bytes in use.

    gauge */ -static constexpr const char *kMetricSystemMemoryUtilization = "system.memory.utilization"; -static constexpr const char *descrMetricSystemMemoryUtilization = "TODO."; -static constexpr const char *unitMetricSystemMemoryUtilization = "1"; +static constexpr const char *kMetricSystemMemoryUtilization = "system.memory.utilization"; +static constexpr const char *descrMetricSystemMemoryUtilization = + "Percentage of memory bytes in use."; +static constexpr const char *unitMetricSystemMemoryUtilization = "1"; #if OPENTELEMETRY_ABI_VERSION_NO >= 2 @@ -855,13 +858,13 @@ CreateAsyncDoubleMetricSystemMemoryUtilization(metrics::Meter *meter) } /** - TODO. + The number of connections.

    updowncounter */ static constexpr const char *kMetricSystemNetworkConnectionCount = "system.network.connection.count"; -static constexpr const char *descrMetricSystemNetworkConnectionCount = "TODO."; +static constexpr const char *descrMetricSystemNetworkConnectionCount = "The number of connections."; static constexpr const char *unitMetricSystemNetworkConnectionCount = "{connection}"; static inline nostd::unique_ptr> @@ -942,6 +945,57 @@ CreateAsyncDoubleMetricSystemNetworkConnections(metrics::Meter *meter) unitMetricSystemNetworkConnections); } +/** + Count of packets that are dropped or discarded even though there was no error. + + @deprecated + {"note": "Replaced by @code system.network.packet.dropped @endcode.", "reason": "renamed", + "renamed_to": "system.network.packet.dropped"}

    Measured as:

    +

    + counter + */ +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricSystemNetworkDropped = + "system.network.dropped"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricSystemNetworkDropped = + "Count of packets that are dropped or discarded even though there was no error."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricSystemNetworkDropped = "{packet}"; + +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> +CreateSyncInt64MetricSystemNetworkDropped(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemNetworkDropped, descrMetricSystemNetworkDropped, + unitMetricSystemNetworkDropped); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemNetworkDropped(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricSystemNetworkDropped, descrMetricSystemNetworkDropped, + unitMetricSystemNetworkDropped); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemNetworkDropped(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricSystemNetworkDropped, descrMetricSystemNetworkDropped, unitMetricSystemNetworkDropped); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemNetworkDropped(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter( + kMetricSystemNetworkDropped, descrMetricSystemNetworkDropped, unitMetricSystemNetworkDropped); +} + /** Count of network errors detected.

    @@ -991,13 +1045,14 @@ CreateAsyncDoubleMetricSystemNetworkErrors(metrics::Meter *meter) } /** - TODO. + The number of bytes transmitted and received.

    counter */ -static constexpr const char *kMetricSystemNetworkIo = "system.network.io"; -static constexpr const char *descrMetricSystemNetworkIo = "TODO."; -static constexpr const char *unitMetricSystemNetworkIo = "By"; +static constexpr const char *kMetricSystemNetworkIo = "system.network.io"; +static constexpr const char *descrMetricSystemNetworkIo = + "The number of bytes transmitted and received."; +static constexpr const char *unitMetricSystemNetworkIo = "By"; static inline nostd::unique_ptr> CreateSyncInt64MetricSystemNetworkIo( metrics::Meter *meter) @@ -1028,13 +1083,14 @@ CreateAsyncDoubleMetricSystemNetworkIo(metrics::Meter *meter) } /** - TODO. + The number of packets transferred.

    counter */ -static constexpr const char *kMetricSystemNetworkPacketCount = "system.network.packet.count"; -static constexpr const char *descrMetricSystemNetworkPacketCount = "TODO."; -static constexpr const char *unitMetricSystemNetworkPacketCount = "{packet}"; +static constexpr const char *kMetricSystemNetworkPacketCount = "system.network.packet.count"; +static constexpr const char *descrMetricSystemNetworkPacketCount = + "The number of packets transferred."; +static constexpr const char *unitMetricSystemNetworkPacketCount = "{packet}"; static inline nostd::unique_ptr> CreateSyncInt64MetricSystemNetworkPacketCount(metrics::Meter *meter) @@ -1122,12 +1178,53 @@ CreateAsyncDoubleMetricSystemNetworkPacketDropped(metrics::Meter *meter) } /** - TODO. + The number of packets transferred. + + @deprecated + {"note": "Replaced by @code system.network.packet.count @endcode.", "reason": "renamed", + "renamed_to": "system.network.packet.count"}

    counter + */ +OPENTELEMETRY_DEPRECATED static constexpr const char *kMetricSystemNetworkPackets = + "system.network.packets"; +OPENTELEMETRY_DEPRECATED static constexpr const char *descrMetricSystemNetworkPackets = + "The number of packets transferred."; +OPENTELEMETRY_DEPRECATED static constexpr const char *unitMetricSystemNetworkPackets = "{packet}"; + +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> +CreateSyncInt64MetricSystemNetworkPackets(metrics::Meter *meter) +{ + return meter->CreateUInt64Counter(kMetricSystemNetworkPackets, descrMetricSystemNetworkPackets, + unitMetricSystemNetworkPackets); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::unique_ptr> +CreateSyncDoubleMetricSystemNetworkPackets(metrics::Meter *meter) +{ + return meter->CreateDoubleCounter(kMetricSystemNetworkPackets, descrMetricSystemNetworkPackets, + unitMetricSystemNetworkPackets); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr +CreateAsyncInt64MetricSystemNetworkPackets(metrics::Meter *meter) +{ + return meter->CreateInt64ObservableCounter( + kMetricSystemNetworkPackets, descrMetricSystemNetworkPackets, unitMetricSystemNetworkPackets); +} + +OPENTELEMETRY_DEPRECATED static inline nostd::shared_ptr +CreateAsyncDoubleMetricSystemNetworkPackets(metrics::Meter *meter) +{ + return meter->CreateDoubleObservableCounter( + kMetricSystemNetworkPackets, descrMetricSystemNetworkPackets, unitMetricSystemNetworkPackets); +} + +/** + The number of page faults.

    counter */ static constexpr const char *kMetricSystemPagingFaults = "system.paging.faults"; -static constexpr const char *descrMetricSystemPagingFaults = "TODO."; +static constexpr const char *descrMetricSystemPagingFaults = "The number of page faults."; static constexpr const char *unitMetricSystemPagingFaults = "{fault}"; static inline nostd::unique_ptr> CreateSyncInt64MetricSystemPagingFaults( @@ -1159,12 +1256,12 @@ CreateAsyncDoubleMetricSystemPagingFaults(metrics::Meter *meter) } /** - TODO. + The number of paging operations.

    counter */ static constexpr const char *kMetricSystemPagingOperations = "system.paging.operations"; -static constexpr const char *descrMetricSystemPagingOperations = "TODO."; +static constexpr const char *descrMetricSystemPagingOperations = "The number of paging operations."; static constexpr const char *unitMetricSystemPagingOperations = "{operation}"; static inline nostd::unique_ptr> @@ -1237,13 +1334,14 @@ CreateAsyncDoubleMetricSystemPagingUsage(metrics::Meter *meter) } /** - TODO. + Swap (unix) or pagefile (windows) utilization.

    gauge */ -static constexpr const char *kMetricSystemPagingUtilization = "system.paging.utilization"; -static constexpr const char *descrMetricSystemPagingUtilization = "TODO."; -static constexpr const char *unitMetricSystemPagingUtilization = "1"; +static constexpr const char *kMetricSystemPagingUtilization = "system.paging.utilization"; +static constexpr const char *descrMetricSystemPagingUtilization = + "Swap (unix) or pagefile (windows) utilization."; +static constexpr const char *unitMetricSystemPagingUtilization = "1"; #if OPENTELEMETRY_ABI_VERSION_NO >= 2 diff --git a/api/include/opentelemetry/semconv/incubating/thread_attributes.h b/api/include/opentelemetry/semconv/incubating/thread_attributes.h index 2d0c290651..8aefe5667b 100644 --- a/api/include/opentelemetry/semconv/incubating/thread_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/thread_attributes.h @@ -21,11 +21,32 @@ namespace thread /** Current "managed" thread ID (as opposed to OS thread ID). +

    + Examples of where the value can be extracted from: +

    + | Language or platform | Source | + | --- | --- | + | JVM | @code Thread.currentThread().threadId() @endcode | + | .NET | @code Thread.CurrentThread.ManagedThreadId @endcode | + | Python | @code threading.current_thread().ident @endcode | + | Ruby | @code Thread.current.object_id @endcode | + | C++ | @code std::this_thread::get_id() @endcode | + | Erlang | @code erlang:self() @endcode | */ static constexpr const char *kThreadId = "thread.id"; /** Current thread name. +

    + Examples of where the value can be extracted from: +

    + | Language or platform | Source | + | --- | --- | + | JVM | @code Thread.currentThread().getName() @endcode | + | .NET | @code Thread.CurrentThread.Name @endcode | + | Python | @code threading.current_thread().name @endcode | + | Ruby | @code Thread.current.name @endcode | + | Erlang | @code erlang:process_info(self(), registered_name) @endcode | */ static constexpr const char *kThreadName = "thread.name"; diff --git a/api/include/opentelemetry/semconv/incubating/vcs_attributes.h b/api/include/opentelemetry/semconv/incubating/vcs_attributes.h index 16227fe4b4..d30fdd90e9 100644 --- a/api/include/opentelemetry/semconv/incubating/vcs_attributes.h +++ b/api/include/opentelemetry/semconv/incubating/vcs_attributes.h @@ -185,11 +185,10 @@ OPENTELEMETRY_DEPRECATED static constexpr const char *kVcsRepositoryRefType = "vcs.repository.ref.type"; /** - The canonical - URL of the repository providing the complete HTTP(S) address in order to locate and identify - the repository through a browser.

    In Git Version Control Systems, the canonical URL SHOULD NOT - include the @code .git @endcode extension. + The canonical URL of the + repository providing the complete HTTP(S) address in order to locate and identify the repository + through a browser.

    In Git Version Control Systems, the canonical URL SHOULD NOT include the + @code .git @endcode extension. */ static constexpr const char *kVcsRepositoryUrlFull = "vcs.repository.url.full"; diff --git a/api/include/opentelemetry/semconv/schema_url.h b/api/include/opentelemetry/semconv/schema_url.h index 6d5fc0e48d..50beae469f 100644 --- a/api/include/opentelemetry/semconv/schema_url.h +++ b/api/include/opentelemetry/semconv/schema_url.h @@ -19,6 +19,6 @@ namespace semconv /** * The URL of the OpenTelemetry schema for these keys and values. */ -static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.37.0"; +static constexpr const char *kSchemaUrl = "https://opentelemetry.io/schemas/1.38.0"; } // namespace semconv OPENTELEMETRY_END_NAMESPACE diff --git a/buildscripts/semantic-convention/generate.sh b/buildscripts/semantic-convention/generate.sh index 2dc8356ccc..6e4499a0f6 100755 --- a/buildscripts/semantic-convention/generate.sh +++ b/buildscripts/semantic-convention/generate.sh @@ -16,10 +16,10 @@ ROOT_DIR="${SCRIPT_DIR}/../../" # freeze the spec & generator tools versions to make the generation reproducible # repository: https://github.com/open-telemetry/semantic-conventions -SEMCONV_VERSION=1.37.0 +SEMCONV_VERSION=1.38.0 # repository: https://github.com/open-telemetry/weaver -WEAVER_VERSION=0.17.1 +WEAVER_VERSION=0.18.0 SEMCONV_VERSION_TAG=v$SEMCONV_VERSION WEAVER_VERSION_TAG=v$WEAVER_VERSION From 8766117e8d2080b10d15e7f13ce438d07d4caf5e Mon Sep 17 00:00:00 2001 From: Marc Alff Date: Fri, 31 Oct 2025 18:54:10 +0100 Subject: [PATCH 21/23] [CONFIGURATION] Implement declarative configuration (config.yaml) (#2518) --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 958b71dc71..cfcb40f129 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,15 @@ Increment the: * [BUILD] Upgrade to opentelemetry-proto 1.8.0 [#3730](https://github.com/open-telemetry/opentelemetry-cpp/pull/3730) +New Features: + +* [CONFIGURATION] Implement declarative configuration (config.yaml) + [#2518](https://github.com/open-telemetry/opentelemetry-cpp/pull/2518) + + * Configuration for opentelemetry-cpp can now be done using a config.yaml + file, instead of using environment variables. + * See [opentelemetry-configuration](https://github.com/open-telemetry/opentelemetry-configuration) + ## [1.23 2025-09-25] * [CodeHealth] Fix clang-tidy warnings part 6 From 08e80f3599d232b2e700e3ec6e8d7e6d901d78f3 Mon Sep 17 00:00:00 2001 From: owent Date: Sun, 2 Nov 2025 01:02:03 +0800 Subject: [PATCH 22/23] Show diff when shelltest failed --- functional/configuration/run_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functional/configuration/run_test.sh b/functional/configuration/run_test.sh index 6ef82cdc55..cf42aac42d 100755 --- a/functional/configuration/run_test.sh +++ b/functional/configuration/run_test.sh @@ -15,5 +15,5 @@ export EXAMPLE_BIN_DIR="${BUILD_DIR}/examples/configuration/" # Make sure `example_yaml` is in the path export PATH=${PATH}:${EXAMPLE_BIN_DIR} -shelltest ./shelltests +shelltest --all --color ./shelltests From 0136fb176b378ed0288a952448dce82b0c96feb2 Mon Sep 17 00:00:00 2001 From: owent Date: Tue, 4 Nov 2025 00:23:52 +0800 Subject: [PATCH 23/23] Fixes attribute order changes in kitchen-sink.test --- .../shelltests/kitchen-sink.test | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/functional/configuration/shelltests/kitchen-sink.test b/functional/configuration/shelltests/kitchen-sink.test index 1b14dd2843..421d2e5959 100644 --- a/functional/configuration/shelltests/kitchen-sink.test +++ b/functional/configuration/shelltests/kitchen-sink.test @@ -20,20 +20,20 @@ SDK CREATED severity_text : DEBUG body : body resource : - telemetry.sdk.version: 1.24.0-dev - service.version: 1.0.0 - double_array_key: [1.1,2.2] + telemetry.sdk.language: cpp + string_key: value + telemetry.sdk.name: opentelemetry double_key: 1.1 - bool_key: 1 + service.namespace: my-namespace + string_array_key: [value1,value2] int_array_key: [1,2] + service.version: 1.0.0 int_key: 1 - string_array_key: [value1,value2] - string_key: value - service.namespace: my-namespace - telemetry.sdk.language: cpp - bool_array_key: [1,0] service.name: unknown_service - telemetry.sdk.name: opentelemetry + telemetry.sdk.version: 1.24.0-dev + bool_array_key: [1,0] + bool_key: 1 + double_array_key: [1.1,2.2] attributes : event_id : 0 event_name :