Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: frozenset object has no attribute items #2727

Merged
merged 3 commits into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#2714](https://github.com/open-telemetry/opentelemetry-python/pull/2714))
- narrow protobuf dependencies to exclude protobuf >= 4
([#2720](https://github.com/open-telemetry/opentelemetry-python/pull/2720))
- fix: frozenset object has no attribute items
([#2727](https://github.com/open-telemetry/opentelemetry-python/pull/2727))

## [1.12.0rc1-0.31b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.12.0rc1-0.31b0) - 2022-05-17

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ def consume_measurement(self, measurement: Measurement) -> None:
else:
attributes = {}

attributes = frozenset(attributes.items())
aggr_key = frozenset(attributes.items())

if attributes not in self._attributes_aggregation:
if aggr_key not in self._attributes_aggregation:
with self._lock:
if attributes not in self._attributes_aggregation:
if aggr_key not in self._attributes_aggregation:
if not isinstance(
self._view._aggregation, DefaultAggregation
):
Expand All @@ -118,9 +118,9 @@ def consume_measurement(self, measurement: Measurement) -> None:
attributes,
self._start_time_unix_nano,
)
self._attributes_aggregation[attributes] = aggregation
self._attributes_aggregation[aggr_key] = aggregation

self._attributes_aggregation[attributes].aggregate(measurement)
self._attributes_aggregation[aggr_key].aggregate(measurement)

def collect(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def test_collect(self):

number_data_point = number_data_points[0]

self.assertEqual(number_data_point.attributes, frozenset({("c", "d")}))
self.assertEqual(number_data_point.attributes, {"c": "d"})
self.assertEqual(number_data_point.value, 0)

def test_setting_aggregation(self):
Expand Down