Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e503ef3

Browse files
authored
Rename Resource's create_empty to get_empty (open-telemetry#1653)
1 parent 290478e commit e503ef3

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
### Changed
1010
- Rename `IdsGenerator` to `IdGenerator`
1111
([#1651])(https://github.com/open-telemetry/opentelemetry-python/pull/1651)
12+
- Rename Resource's `create_empty` to `get_empty`
13+
([#1653])(https://github.com/open-telemetry/opentelemetry-python/pull/1653)
1214

1315
## [0.18b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v0.18b0) - 2021-02-16
1416

opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def create(attributes: typing.Optional[Attributes] = None) -> "Resource":
188188
return resource
189189

190190
@staticmethod
191-
def create_empty() -> "Resource":
191+
def get_empty() -> "Resource":
192192
return _EMPTY_RESOURCE
193193

194194
@property

opentelemetry-sdk/tests/resources/test_resources.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def test_create(self):
5959
self.assertEqual(resource.attributes, expected_with_envar)
6060
os.environ[resources.OTEL_RESOURCE_ATTRIBUTES] = ""
6161

62-
resource = resources.Resource.create_empty()
62+
resource = resources.Resource.get_empty()
6363
self.assertEqual(resource, resources._EMPTY_RESOURCE)
6464

6565
resource = resources.Resource.create(None)
@@ -140,9 +140,7 @@ def test_service_name_using_process_name(self):
140140

141141
def test_aggregated_resources_no_detectors(self):
142142
aggregated_resources = resources.get_aggregated_resources([])
143-
self.assertEqual(
144-
aggregated_resources, resources.Resource.create_empty()
145-
)
143+
self.assertEqual(aggregated_resources, resources.Resource.get_empty())
146144

147145
def test_aggregated_resources_with_static_resource(self):
148146
static_resource = resources.Resource({"static_key": "static_value"})
@@ -208,7 +206,7 @@ def test_resource_detector_ignore_error(self):
208206
resource_detector.raise_on_error = False
209207
self.assertEqual(
210208
resources.get_aggregated_resources([resource_detector]),
211-
resources.Resource.create_empty(),
209+
resources.Resource.get_empty(),
212210
)
213211

214212
def test_resource_detector_raise_error(self):
@@ -245,7 +243,7 @@ def tearDown(self) -> None:
245243
def test_empty(self):
246244
detector = resources.OTELResourceDetector()
247245
os.environ[resources.OTEL_RESOURCE_ATTRIBUTES] = ""
248-
self.assertEqual(detector.detect(), resources.Resource.create_empty())
246+
self.assertEqual(detector.detect(), resources.Resource.get_empty())
249247

250248
def test_one(self):
251249
detector = resources.OTELResourceDetector()

0 commit comments

Comments
 (0)