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

sdk: Span.resource should default to an empty resource #702

Closed
toumorokoshi opened this issue May 17, 2020 · 0 comments · Fixed by #724
Closed

sdk: Span.resource should default to an empty resource #702

toumorokoshi opened this issue May 17, 2020 · 0 comments · Fixed by #724
Labels

Comments

@toumorokoshi
Copy link
Member

Right now, A resource object attached to a Span can be None:

https://github.com/open-telemetry/opentelemetry-python/blob/master/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py#L267

(also type is incorrect as it should also be a Resource object)

That means that there's two similar objects that refer to an empty resource: None, and the _EMPTY_RESOURCE global.

For simplicity I would argue that we should just always default to the _EMPTY_RESOURCE object: this avoids None checks in exporters.

We didn't use Resources in a meaningful way previously, which is why I believe this didn't come up before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant