diff --git a/CHANGELOG.md b/CHANGELOG.md index a0f9e4b0dc..b1341a52ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,9 +15,29 @@ Increment the: ## [Unreleased] +## [1.23 2025-09-25] + +* [CodeHealth] Fix clang-tidy warnings part 6 + [#3507](https://github.com/open-telemetry/opentelemetry-cpp/pull/3507) + +* [CMAKE] Add CMake scripts to find or fetch curl and find zlib + [#3526](https://github.com/open-telemetry/opentelemetry-cpp/pull/3526) + +* [REMOVAL] remove unused ci bash scripts + [#3541](https://github.com/open-telemetry/opentelemetry-cpp/pull/3541) + +* Bump step-security/harden-runner from 2.12.2 to 2.13.0 + [#3542](https://github.com/open-telemetry/opentelemetry-cpp/pull/3542) + +* [SDK] Ensure TraceId is portable on big-endian architectures + [#3543](https://github.com/open-telemetry/opentelemetry-cpp/pull/3543) + * [TEST] Shared otel-cpp libs linked to latest static protobuf and grpc [#3544](https://github.com/open-telemetry/opentelemetry-cpp/pull/3544) +* [CONFIGURATION] File configuration - component registry + [#3537](https://github.com/open-telemetry/opentelemetry-cpp/pull/3537) + * [SDK] Implement env var configuration for PeriodicExportingMetricReader [#3549](https://github.com/open-telemetry/opentelemetry-cpp/pull/3549) @@ -27,15 +47,177 @@ Increment the: * [SDK] Implements options for the ParentBasedSampler with default values [#3553](https://github.com/open-telemetry/opentelemetry-cpp/pull/3553) +* Bump github/codeql-action from 3.29.2 to 3.29.3 + [#3556](https://github.com/open-telemetry/opentelemetry-cpp/pull/3556) + +* [CMAKE] Add CMake scripts to find or fetch protobuf and grpc + [#3533](https://github.com/open-telemetry/opentelemetry-cpp/pull/3533) + +* [CONFIGURATION] File configuration - sdk builder + [#3550](https://github.com/open-telemetry/opentelemetry-cpp/pull/3550) + +* Bump github/codeql-action from 3.29.3 to 3.29.4 + [#3558](https://github.com/open-telemetry/opentelemetry-cpp/pull/3558) + +* [CONFIGURATION] File configuration - spec version 1.0.0-rc1 + [#3557](https://github.com/open-telemetry/opentelemetry-cpp/pull/3557) + +* [CONFIGURATION] File configuration - sdk resource + [#3567](https://github.com/open-telemetry/opentelemetry-cpp/pull/3567) + +* [CONFIGURATION] File configuration - ostream exporter builders + [#3563](https://github.com/open-telemetry/opentelemetry-cpp/pull/3563) + +* [CONFIGURATION] File configuration - prometheus exporter builder + [#3564](https://github.com/open-telemetry/opentelemetry-cpp/pull/3564) + +* [CONFIGURATION] File configuration - zipkin exporter builder + [#3565](https://github.com/open-telemetry/opentelemetry-cpp/pull/3565) + +* [CONFIGURATION] File configuration - otlp exporter builders + [#3566](https://github.com/open-telemetry/opentelemetry-cpp/pull/3566) + +* [CMAKE] Don't set iwyu and clang-tidy properties on nlohmann_json with cmake <3.19 + [#3568](https://github.com/open-telemetry/opentelemetry-cpp/pull/3568) + * [SDK] View should not have a unit [#3552](https://github.com/open-telemetry/opentelemetry-cpp/pull/3552) +* [EXPORTER] Fixes tsan warnings + [#3531](https://github.com/open-telemetry/opentelemetry-cpp/pull/3531) + +* [DOC] Document minimum required versions + [#3562](https://github.com/open-telemetry/opentelemetry-cpp/pull/3562) + +* Bump github/codeql-action from 3.29.4 to 3.29.5 + [#3574](https://github.com/open-telemetry/opentelemetry-cpp/pull/3574) + +* Add subscript to issue templates + [#3576](https://github.com/open-telemetry/opentelemetry-cpp/pull/3576) + +* [CONFIGURATION] File configuration - configuration example + [#3573](https://github.com/open-telemetry/opentelemetry-cpp/pull/3573) + +* Bump actions/download-artifact from 4.3.0 to 5.0.0 + [#3578](https://github.com/open-telemetry/opentelemetry-cpp/pull/3578) + +* Bump actions/cache from 4.2.3 to 4.2.4 + [#3580](https://github.com/open-telemetry/opentelemetry-cpp/pull/3580) + +* [SDK] Implementation of container resource as per semconv + [#3572](https://github.com/open-telemetry/opentelemetry-cpp/pull/3572) + +* Bump github/codeql-action from 3.29.7 to 3.29.8 + [#3584](https://github.com/open-telemetry/opentelemetry-cpp/pull/3584) + +* [CI] update do_ci scripts to use common cmake cache scripts + [#3582](https://github.com/open-telemetry/opentelemetry-cpp/pull/3582) + +* Bump actions/checkout from 4.2.2 to 5.0.0 + [#3587](https://github.com/open-telemetry/opentelemetry-cpp/pull/3587) + +* Bump github/codeql-action from 3.29.8 to 3.29.9 + [#3589](https://github.com/open-telemetry/opentelemetry-cpp/pull/3589) + +* [BUILD] Remove duplicated deprecated warnings in logs headers + [#3592](https://github.com/open-telemetry/opentelemetry-cpp/pull/3592) + +* Bump github/codeql-action from 3.29.9 to 3.29.10 + [#3595](https://github.com/open-telemetry/opentelemetry-cpp/pull/3595) + +* [resource_detectors] implementation of process resource detector as per semconv + [#3591](https://github.com/open-telemetry/opentelemetry-cpp/pull/3591) + +* Bump codecov/codecov-action from 5.4.3 to 5.5.0 + [#3597](https://github.com/open-telemetry/opentelemetry-cpp/pull/3597) + +* Bump github/codeql-action from 3.29.10 to 3.29.11 + [#3602](https://github.com/open-telemetry/opentelemetry-cpp/pull/3602) + +* [BAZEL] Drop rules_foreign_cc as a dependency + [#3601](https://github.com/open-telemetry/opentelemetry-cpp/pull/3601) + +* [BUILD] Remove cmake support for thrift as Jaeger was removed + [#3604](https://github.com/open-telemetry/opentelemetry-cpp/pull/3604) + +* [CMAKE] upgrade cmake minimum version to 3.16 + [#3599](https://github.com/open-telemetry/opentelemetry-cpp/pull/3599) + +* [CMAKE] Set the project version through the cmake project macro + [#3605](https://github.com/open-telemetry/opentelemetry-cpp/pull/3605) + +* [CONFIGURATION] File configuration - functional tests + [#3606](https://github.com/open-telemetry/opentelemetry-cpp/pull/3606) + +* [SEMANTIC CONVENTIONS] Upgrade to semantic conventions 1.37.0 + [#3615](https://github.com/open-telemetry/opentelemetry-cpp/pull/3615) + * [BUILD] Use -dev versions in main branch [#3609](https://github.com/open-telemetry/opentelemetry-cpp/pull/3609) -* [SDK] Implementing configurable aggregation cardinality limit +* [BAZEL] Fix version warnings in MODULE.bazel + [#3617](https://github.com/open-telemetry/opentelemetry-cpp/pull/3617) + +* [Copilot] Add instructions for OpenTelemetry C++ + [#3614](https://github.com/open-telemetry/opentelemetry-cpp/pull/3614) + +* [MAINTAINER] Maintain version numbers with tbump + [#3616](https://github.com/open-telemetry/opentelemetry-cpp/pull/3616) + +* Bump github/codeql-action from 3.29.11 to 3.30.0 + [#3621](https://github.com/open-telemetry/opentelemetry-cpp/pull/3621) + +* Bump benchmark-action/github-action-benchmark from 1.20.4 to 1.20.5 + [#3623](https://github.com/open-telemetry/opentelemetry-cpp/pull/3623) + +* [BUILD] Cleanup cppcheck warnings + [#3619](https://github.com/open-telemetry/opentelemetry-cpp/pull/3619) + +* Bump actions/stale from 9.1.0 to 10.0.0 + [#3626](https://github.com/open-telemetry/opentelemetry-cpp/pull/3626) + +* Bump actions/github-script from 7.0.1 to 8.0.0 + [#3627](https://github.com/open-telemetry/opentelemetry-cpp/pull/3627) + +* Bump codecov/codecov-action from 5.5.0 to 5.5.1 + [#3625](https://github.com/open-telemetry/opentelemetry-cpp/pull/3625) + +* [resource_detectors] implementation of remaining process attributes + [#3603](https://github.com/open-telemetry/opentelemetry-cpp/pull/3603) + +* Bump benchmark-action/github-action-benchmark from 1.20.5 to 1.20.7 + [#3631](https://github.com/open-telemetry/opentelemetry-cpp/pull/3631) + +* Bump github/codeql-action from 3.30.0 to 3.30.1 + [#3630](https://github.com/open-telemetry/opentelemetry-cpp/pull/3630) + +* Bump github/codeql-action from 3.30.1 to 3.30.2 + [#3637](https://github.com/open-telemetry/opentelemetry-cpp/pull/3637) + +* Bump step-security/harden-runner from 2.13.0 to 2.13.1 + [#3636](https://github.com/open-telemetry/opentelemetry-cpp/pull/3636) + +* Bump github/codeql-action from 3.30.2 to 3.30.3 + [#3639](https://github.com/open-telemetry/opentelemetry-cpp/pull/3639) + +* [Metrics] New Attribute Processor for Exclude list + [#3633](https://github.com/open-telemetry/opentelemetry-cpp/pull/3633) + +* Implementing configurable aggregation cardinality limit [#3624](https://github.com/open-telemetry/opentelemetry-cpp/pull/3624) +* [CMAKE] Fix CMake 4.x build error on MacOS runner and when building opentracing + [#3649](https://github.com/open-telemetry/opentelemetry-cpp/pull/3649) + +* [SDK] custom hash and equality for attribute processor + [#3643](https://github.com/open-telemetry/opentelemetry-cpp/pull/3643) + +* Bump actions/cache from 4.2.4 to 4.3.0 + [#3658](https://github.com/open-telemetry/opentelemetry-cpp/pull/3658) + +* [SDK] Fix copying overflow attributes in metric AttributesHashMap + [#3651](https://github.com/open-telemetry/opentelemetry-cpp/pull/3651) + Important changes: * [CMAKE] Upgrade CMake minimum version to 3.16 diff --git a/CMakeLists.txt b/CMakeLists.txt index d6203408a0..ddc8d9cd83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.20.0") cmake_policy(SET CMP0117 NEW) endif() -set(OPENTELEMETRY_VERSION_NUMBER "1.23.0") +set(OPENTELEMETRY_VERSION_NUMBER "1.24.0") set(OPENTELEMETRY_VERSION_SUFFIX "-dev") set(OPENTELEMETRY_VERSION "${OPENTELEMETRY_VERSION_NUMBER}${OPENTELEMETRY_VERSION_SUFFIX}") diff --git a/MODULE.bazel b/MODULE.bazel index ba0213eb25..3200237c6a 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -3,7 +3,7 @@ module( name = "opentelemetry-cpp", - version = "1.23.0-dev", + version = "1.24.0-dev", compatibility_level = 0, repo_name = "io_opentelemetry_cpp", ) diff --git a/api/include/opentelemetry/version.h b/api/include/opentelemetry/version.h index d87b7b2e4f..6a67883d92 100644 --- a/api/include/opentelemetry/version.h +++ b/api/include/opentelemetry/version.h @@ -10,9 +10,9 @@ # define OPENTELEMETRY_ABI_VERSION_NO 1 #endif -#define OPENTELEMETRY_VERSION "1.23.0-dev" +#define OPENTELEMETRY_VERSION "1.24.0-dev" #define OPENTELEMETRY_VERSION_MAJOR 1 -#define OPENTELEMETRY_VERSION_MINOR 23 +#define OPENTELEMETRY_VERSION_MINOR 24 #define OPENTELEMETRY_VERSION_PATCH 0 #define OPENTELEMETRY_ABI_VERSION OPENTELEMETRY_STRINGIFY(OPENTELEMETRY_ABI_VERSION_NO) diff --git a/functional/configuration/shelltests/kitchen-sink.test b/functional/configuration/shelltests/kitchen-sink.test index 24d58a03c5..b4e3c1f66d 100644 --- a/functional/configuration/shelltests/kitchen-sink.test +++ b/functional/configuration/shelltests/kitchen-sink.test @@ -19,7 +19,7 @@ SDK CREATED severity_text : DEBUG body : body resource : - telemetry.sdk.version: 1.22.0 + telemetry.sdk.version: 1.24.0-dev service.version: 1.0.0 double_array_key: [1.1,2.2] double_key: 1.1 diff --git a/sdk/include/opentelemetry/sdk/metrics/state/attributes_hashmap.h b/sdk/include/opentelemetry/sdk/metrics/state/attributes_hashmap.h index b2b8863e35..2dd82a9991 100644 --- a/sdk/include/opentelemetry/sdk/metrics/state/attributes_hashmap.h +++ b/sdk/include/opentelemetry/sdk/metrics/state/attributes_hashmap.h @@ -95,7 +95,7 @@ class AttributesHashMapWithCustomHash return it->second.get(); } - if (IsOverflowAttributes()) + if (IsOverflowAttributes(attr)) { return GetOrSetOveflowAttributes(aggregation_callback); } @@ -114,7 +114,7 @@ class AttributesHashMapWithCustomHash return it->second.get(); } - if (IsOverflowAttributes()) + if (IsOverflowAttributes(attributes)) { return GetOrSetOveflowAttributes(aggregation_callback); } @@ -133,7 +133,7 @@ class AttributesHashMapWithCustomHash return it->second.get(); } - if (IsOverflowAttributes()) + if (IsOverflowAttributes(attributes)) { return GetOrSetOveflowAttributes(aggregation_callback); } @@ -158,7 +158,7 @@ class AttributesHashMapWithCustomHash { it->second = std::move(aggr); } - else if (IsOverflowAttributes()) + else if (IsOverflowAttributes(attributes)) { hash_map_[kOverflowAttributes] = std::move(aggr); } @@ -175,7 +175,7 @@ class AttributesHashMapWithCustomHash { it->second = std::move(aggr); } - else if (IsOverflowAttributes()) + else if (IsOverflowAttributes(attributes)) { hash_map_[kOverflowAttributes] = std::move(aggr); } @@ -234,7 +234,27 @@ class AttributesHashMapWithCustomHash return result.first->second.get(); } - bool IsOverflowAttributes() const { return (hash_map_.size() + 1 >= attributes_limit_); } + bool IsOverflowAttributes(const MetricAttributes &attributes) const + { + // If the incoming attributes are exactly the overflow sentinel, route + // directly to the overflow entry. + if (attributes == kOverflowAttributes) + { + return true; + } + // Determine if overflow entry already exists. + bool has_overflow = (hash_map_.find(kOverflowAttributes) != hash_map_.end()); + // If overflow already present, total size already includes it; trigger overflow + // when current size (including overflow) is >= limit. + if (has_overflow) + { + return hash_map_.size() >= attributes_limit_; + } + // If overflow not present yet, simulate adding a new distinct key. If that + // would exceed the limit, we redirect to overflow instead of creating a + // new real attribute entry. + return (hash_map_.size() + 1) >= attributes_limit_; + } }; using AttributesHashMap = AttributesHashMapWithCustomHash<>; diff --git a/sdk/include/opentelemetry/sdk/version/version.h b/sdk/include/opentelemetry/sdk/version/version.h index c96ce7f3e7..21ec411d4d 100644 --- a/sdk/include/opentelemetry/sdk/version/version.h +++ b/sdk/include/opentelemetry/sdk/version/version.h @@ -3,7 +3,7 @@ #pragma once -#define OPENTELEMETRY_SDK_VERSION "1.23.0-dev" +#define OPENTELEMETRY_SDK_VERSION "1.24.0-dev" #include "opentelemetry/version.h" diff --git a/sdk/src/version/version.cc b/sdk/src/version/version.cc index 798b44780e..df601e3818 100644 --- a/sdk/src/version/version.cc +++ b/sdk/src/version/version.cc @@ -12,12 +12,12 @@ namespace sdk namespace version { const int major_version = 1; -const int minor_version = 23; +const int minor_version = 24; const int patch_version = 0; const char *pre_release = "dev"; const char *build_metadata = "none"; -const char *short_version = "1.23.0"; -const char *full_version = "1.23.0-dev"; +const char *short_version = "1.24.0"; +const char *full_version = "1.24.0-dev"; const char *build_date = "MAIN BRANCH"; } // namespace version } // namespace sdk diff --git a/sdk/test/metrics/attributes_hashmap_test.cc b/sdk/test/metrics/attributes_hashmap_test.cc index c51f4fe800..944bbef3b6 100644 --- a/sdk/test/metrics/attributes_hashmap_test.cc +++ b/sdk/test/metrics/attributes_hashmap_test.cc @@ -158,3 +158,67 @@ TEST(AttributesHashMap, HashConsistencyAcrossStringTypes) EXPECT_EQ(hash_c_str, hash_std_str_view); #endif } + +TEST(AttributesHashMap, OverflowCardinalityLimitBehavior) +{ + // Configure a very small limit to exercise overflow logic easily. + const size_t limit = 4; // real attributes limit + AttributesHashMapWithCustomHash<> map(limit); + + // We expect to be able to insert exactly 'limit' distinct real attribute sets. + // After that, further distinct attributes should route to the overflow bucket, + // which should appear only once regardless of how many additional unique sets arrive. + + // Insert distinct attributes up to the limit. + for (size_t i = 0; i < limit; ++i) + { + MetricAttributes attr = {{"k", std::to_string(i)}}; + map.GetOrSetDefault(attr, []() { return std::unique_ptr(new DropAggregation()); }) + ->Aggregate(static_cast(1)); + } + + // Size should be exactly 'limit' (no overflow yet) + EXPECT_EQ(map.Size(), limit); + + // Insert one more distinct attribute; this should not increase the real attributes count + MetricAttributes overflow_trigger = {{"k", "overflow"}}; + map.GetOrSetDefault(overflow_trigger, + []() { return std::unique_ptr(new DropAggregation()); }) + ->Aggregate(static_cast(1)); + + EXPECT_EQ(map.Size(), limit); + + // Insert several more unique attributes - size must remain constant (limit) + for (size_t i = 0; i < limit - 1; ++i) + { + MetricAttributes extra_attr = {{"k", std::string("extra") + std::to_string(i)}}; + map.GetOrSetDefault(extra_attr, + []() { return std::unique_ptr(new DropAggregation()); }) + ->Aggregate(static_cast(1)); + } + EXPECT_EQ(map.Size(), limit); + + // Ensure overflow key was actually created and accessible via Get + EXPECT_NE(map.Get(kOverflowAttributes), nullptr); + + // Ensure original real attributes still present + for (size_t i = 0; i < limit - 1; ++i) + { + MetricAttributes attr = {{"k", std::to_string(i)}}; + EXPECT_NE(map.Get(attr), nullptr); + } + + // Copy the hash map to a new map in non-determistic order and verify all entries are present + AttributesHashMapWithCustomHash<> map_copy(limit); + map.GetAllEnteries([&map_copy](const MetricAttributes &attributes, Aggregation &) { + map_copy.Set(attributes, std::unique_ptr(new DropAggregation())); + return true; + }); + EXPECT_EQ(map_copy.Size(), map.Size()); + EXPECT_NE(map_copy.Get(kOverflowAttributes), nullptr); + for (size_t i = 0; i < limit - 1; ++i) + { + MetricAttributes attr = {{"k", std::to_string(i)}}; + EXPECT_NE(map_copy.Get(attr), nullptr); + } +} diff --git a/tbump.toml b/tbump.toml index 59412f584e..e7e9c47ef2 100644 --- a/tbump.toml +++ b/tbump.toml @@ -21,7 +21,7 @@ github_url = "https://github.com/open-telemetry/opentelemetry-cpp" [version] -current = "1.23.0-dev" +current = "1.24.0-dev" # Example of a semver regexp. # Make sure this matches current_version before @@ -123,6 +123,10 @@ search = "short_version\\s*= [\"]{current_version}[\"]" src = "sdk/src/version/version.cc" search = "full_version\\s*= ['\"]{current_version}['\"]" +[[file]] +src = "functional/configuration/shelltests/kitchen-sink.test" +search = "telemetry.sdk.version: {current_version}" + # You can specify a list of commands to # run after the files have been patched