Skip to content

Rename Resource's create_empty to get_empty #1653

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

Merged
merged 3 commits into from
Mar 1, 2021
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Rename `IdsGenerator` to `IdGenerator`
([#1651])(https://github.com/open-telemetry/opentelemetry-python/pull/1651)
- Rename Resource's `create_empty` to `get_empty`
([#1653])(https://github.com/open-telemetry/opentelemetry-python/pull/1653)

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def create(attributes: typing.Optional[Attributes] = None) -> "Resource":
return resource

@staticmethod
def create_empty() -> "Resource":
def get_empty() -> "Resource":
return _EMPTY_RESOURCE

@property
Expand Down
10 changes: 4 additions & 6 deletions opentelemetry-sdk/tests/resources/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def test_create(self):
self.assertEqual(resource.attributes, expected_with_envar)
os.environ[resources.OTEL_RESOURCE_ATTRIBUTES] = ""

resource = resources.Resource.create_empty()
resource = resources.Resource.get_empty()
self.assertEqual(resource, resources._EMPTY_RESOURCE)

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

def test_aggregated_resources_no_detectors(self):
aggregated_resources = resources.get_aggregated_resources([])
self.assertEqual(
aggregated_resources, resources.Resource.create_empty()
)
self.assertEqual(aggregated_resources, resources.Resource.get_empty())

def test_aggregated_resources_with_static_resource(self):
static_resource = resources.Resource({"static_key": "static_value"})
Expand Down Expand Up @@ -208,7 +206,7 @@ def test_resource_detector_ignore_error(self):
resource_detector.raise_on_error = False
self.assertEqual(
resources.get_aggregated_resources([resource_detector]),
resources.Resource.create_empty(),
resources.Resource.get_empty(),
)

def test_resource_detector_raise_error(self):
Expand Down Expand Up @@ -245,7 +243,7 @@ def tearDown(self) -> None:
def test_empty(self):
detector = resources.OTELResourceDetector()
os.environ[resources.OTEL_RESOURCE_ATTRIBUTES] = ""
self.assertEqual(detector.detect(), resources.Resource.create_empty())
self.assertEqual(detector.detect(), resources.Resource.get_empty())

def test_one(self):
detector = resources.OTELResourceDetector()
Expand Down