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

None ("null") should not be encouraged in sequences ("arrays") #1738

Closed
Oberon00 opened this issue Apr 2, 2021 · 3 comments
Closed

None ("null") should not be encouraged in sequences ("arrays") #1738

Oberon00 opened this issue Apr 2, 2021 · 3 comments

Comments

@Oberon00
Copy link
Member

Oberon00 commented Apr 2, 2021

See the spec at https://github.com/open-telemetry/opentelemetry-specification/blob/v1.1.0/specification/common/common.md#attributes

null values SHOULD NOT be allowed in arrays. However, if it is impossible to
make sure that no null values are accepted
(e.g. in languages that do not have appropriate compile-time type checking),
null values within arrays MUST be preserved as-is (i.e., passed on to span
processors / exporters as null).

While Python cannot actually prevent None values, we at least can make sure that those who use mypy are made aware that they are adding an invalid value to an array by changing the Sequence[Optional[primitive]] to Sequence[primitive] in https://github.com/open-telemetry/opentelemetry-python/blob/v1.0.0/opentelemetry-api/src/opentelemetry/util/types.py#L23-L26

Actual code that is in place to accept None should continue to work as before.

@github-actions
Copy link

github-actions bot commented May 3, 2021

This issue was marked stale due to lack of activity. It will be closed in 30 days.

@eddyleelin
Copy link
Contributor

I'd like to take a look into this as a good first issue! Would appreciate any help/direction for getting started on this.

@ocelotl
Copy link
Contributor

ocelotl commented May 13, 2021

@Oberon00 suggests that mypy users could use more information by changing the line pointed in the link. I would suggests getting somewhat familiar with what mypy is and does, @eddyleelin if you are not yet 👍

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

No branches or pull requests

4 participants