From 7ed2803e6bc8ecef2d7d92f7c8cdd0da86a9c5e7 Mon Sep 17 00:00:00 2001 From: Tom Tan Date: Wed, 1 Oct 2025 11:36:03 -0700 Subject: [PATCH 1/2] [SDK] Fix typo in hashmap method GetEnteries --- .../opentelemetry/sdk/metrics/state/attributes_hashmap.h | 2 +- sdk/src/metrics/state/temporal_metric_storage.cc | 8 ++++---- sdk/test/metrics/attributes_hashmap_test.cc | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sdk/include/opentelemetry/sdk/metrics/state/attributes_hashmap.h b/sdk/include/opentelemetry/sdk/metrics/state/attributes_hashmap.h index 2dd82a9991..110aa20f9f 100644 --- a/sdk/include/opentelemetry/sdk/metrics/state/attributes_hashmap.h +++ b/sdk/include/opentelemetry/sdk/metrics/state/attributes_hashmap.h @@ -188,7 +188,7 @@ class AttributesHashMapWithCustomHash /** * Iterate the hash to yield key and value stored in hash. */ - bool GetAllEnteries( + bool GetAllEntries( nostd::function_ref callback) const { for (auto &kv : hash_map_) diff --git a/sdk/src/metrics/state/temporal_metric_storage.cc b/sdk/src/metrics/state/temporal_metric_storage.cc index 9e991f73f9..29be34a8ea 100644 --- a/sdk/src/metrics/state/temporal_metric_storage.cc +++ b/sdk/src/metrics/state/temporal_metric_storage.cc @@ -67,7 +67,7 @@ bool TemporalMetricStorage::buildMetrics(CollectorHandle *collector, metric_data.end_ts = collection_ts; // Direct conversion of delta metrics to point data - delta_metrics->GetAllEnteries( + delta_metrics->GetAllEntries( [&metric_data](const MetricAttributes &attributes, Aggregation &aggregation) { PointDataAttributes point_data_attr; point_data_attr.point_data = aggregation.ToPoint(); @@ -102,7 +102,7 @@ bool TemporalMetricStorage::buildMetrics(CollectorHandle *collector, : kAggregationCardinalityLimit)); for (auto &agg_hashmap : unreported_list) { - agg_hashmap->GetAllEnteries( + agg_hashmap->GetAllEntries( [&merged_metrics, this](const MetricAttributes &attributes, Aggregation &aggregation) { auto agg = merged_metrics->Get(attributes); if (agg) @@ -135,7 +135,7 @@ bool TemporalMetricStorage::buildMetrics(CollectorHandle *collector, if (aggregation_temporarily == AggregationTemporality::kCumulative) { // merge current delta to previous cumulative - last_aggr_hashmap->GetAllEnteries( + last_aggr_hashmap->GetAllEntries( [&merged_metrics, this](const MetricAttributes &attributes, Aggregation &aggregation) { auto agg = merged_metrics->Get(attributes); if (agg) @@ -172,7 +172,7 @@ bool TemporalMetricStorage::buildMetrics(CollectorHandle *collector, metric_data.aggregation_temporality = aggregation_temporarily; metric_data.start_ts = last_collection_ts; metric_data.end_ts = collection_ts; - result_to_export->GetAllEnteries( + result_to_export->GetAllEntries( [&metric_data](const MetricAttributes &attributes, Aggregation &aggregation) { PointDataAttributes point_data_attr; point_data_attr.point_data = aggregation.ToPoint(); diff --git a/sdk/test/metrics/attributes_hashmap_test.cc b/sdk/test/metrics/attributes_hashmap_test.cc index 944bbef3b6..e65b8ebb14 100644 --- a/sdk/test/metrics/attributes_hashmap_test.cc +++ b/sdk/test/metrics/attributes_hashmap_test.cc @@ -71,9 +71,9 @@ TEST(AttributesHashMap, BasicTests) MetricAttributes m6 = {{"k1", "v2"}, {"k2", "v1"}}; EXPECT_EQ(hash_map.Has(m6), false); - // GetAllEnteries + // GetAllEntries size_t count = 0; - hash_map.GetAllEnteries( + hash_map.GetAllEntries( [&count](const MetricAttributes & /* attributes */, Aggregation & /* aggregation */) { count++; return true; @@ -210,7 +210,7 @@ TEST(AttributesHashMap, OverflowCardinalityLimitBehavior) // 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.GetAllEntries([&map_copy](const MetricAttributes &attributes, Aggregation &) { map_copy.Set(attributes, std::unique_ptr(new DropAggregation())); return true; }); From baa8d510102e8183f8b6f5d559558d9b3cc3a293 Mon Sep 17 00:00:00 2001 From: Tom Tan Date: Wed, 1 Oct 2025 11:39:16 -0700 Subject: [PATCH 2/2] Add changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fa87cbc131..4fb5449698 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,9 @@ Increment the: * [TEST] Remove workaround for metrics cardinality limit test [#3663](https://github.com/open-telemetry/opentelemetry-cpp/pull/3663) +* [SDK] Fix typo in hashmap method GetEnteries + [#3680](https://github.com/open-telemetry/opentelemetry-cpp/pull/3680) + ## [1.23 2025-09-25] * [CodeHealth] Fix clang-tidy warnings part 6