Skip to content

Commit

Permalink
Update changelog and add tests to check __eq__ and __lt__ cases on ob…
Browse files Browse the repository at this point in the history
…ject
  • Loading branch information
vivek378521 committed Jul 2, 2024
1 parent ea15e79 commit 5bc3820
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#3965](https://github.com/open-telemetry/opentelemetry-python/pull/3965))
- Validate links at span creation
([#3991](https://github.com/open-telemetry/opentelemetry-python/pull/3991))
- Fix to add attributes field in get_meter and instrumentationScope
([#3695](https://github.com/open-telemetry/opentelemetry-python/issues/3695))

## Version 1.25.0/0.46b0 (2024-05-30)

Expand Down Expand Up @@ -1601,6 +1603,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
([#3778](https://github.com/open-telemetry/opentelemetry-python/pull/3778))
- Fix license field in pyproject.toml files
([#3803](https://github.com/open-telemetry/opentelemetry-python/pull/3803))
- Fix to add attributes field in get_meter and instrumentationScope
([#3695](https://github.com/open-telemetry/opentelemetry-python/issues/3695))

35 changes: 35 additions & 0 deletions opentelemetry-sdk/tests/metrics/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,41 @@ def test_get_meter_duplicate(self):
self.assertIs(meter1, meter2)
self.assertIsNot(meter1, meter3)

def test_get_meter_attributes_duplicate(self):
"""
Subsequent calls to `MeterProvider.get_meter` with the same arguments
should return the same `Meter` instance.
"""
mp = MeterProvider()
meter1 = mp.get_meter(
"name",
version="version",
schema_url="schema_url",
attributes={"key": "value", "key2": 5, "key3": "value3"},
)
meter2 = mp.get_meter(
"name",
version="version",
schema_url="schema_url",
attributes={"key": "value", "key2": 5, "key3": "value3"},
)
meter3 = mp.get_meter(
"name2",
version="version",
schema_url="schema_url",
)
meter4 = mp.get_meter(
"name",
version="version",
schema_url="schema_url",
attributes={"key": "value", "key2": 5, "key3": "value4"},
)
self.assertIs(meter1, meter2)
self.assertIsNot(meter1, meter3)
self.assertTrue(
meter3._instrumentation_scope > meter4._instrumentation_scope
)

def test_shutdown(self):

mock_metric_reader_0 = MagicMock(
Expand Down

0 comments on commit 5bc3820

Please sign in to comment.