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

null attributes that have been previously set results in the attribute being cleared and the key being dropped from the attribute set #998

Closed
codeboten opened this issue Aug 17, 2020 · 7 comments · Fixed by #1256
Assignees
Labels
api Affects the API package. help wanted release:required-for-ga To be resolved before GA release
Projects

Comments

@codeboten
Copy link
Contributor

To be compliant with the tracing spec: null attributes that have been previously set results in the attribute being cleared and the key being dropped from the attribute set

https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/trace/api.md#set-attributes

@codeboten codeboten added api Affects the API package. help wanted release:required-for-ga To be resolved before GA release labels Aug 17, 2020
@codeboten
Copy link
Contributor Author

@codeboten codeboten added this to To Do in GA Burndown Aug 31, 2020
@LetzNico
Copy link
Contributor

Hi there!

I would like to get started contributing on the repo. This is what I understood from the specs and the issue:

  • An attribute's value should never be None
  • Adding an attribute with a None value should be a no-op or fire a warning
  • The scope of this issue is to implement the following mechanism: modifying the value of an existing attribute from a valid value to None should pop the attribute

Can you confirm that I understood correctly? If yes, I'm down to write a PR 🙂

@lzchen
Copy link
Contributor

lzchen commented Sep 29, 2020

  • An attribute's value should never be None

See below.

  • Adding an attribute with a None value should be a no-op or fire a warning

Possibly. Maybe we can just let this occur and then the exporter deals with the value accordingly. Should be fine to implement it as a no-op though.

  • The scope of this issue is to implement the following mechanism: modifying the value of an existing attribute from a valid value to None should pop the attribute

Yes.

@LetzNico
Copy link
Contributor

LetzNico commented Oct 5, 2020

Thanks for your answer :). Gonna work on this and get back to you soon

LetzNico pushed a commit to LetzNico/opentelemetry-python that referenced this issue Oct 6, 2020
LetzNico added a commit to LetzNico/opentelemetry-python that referenced this issue Oct 6, 2020
LetzNico added a commit to LetzNico/opentelemetry-python that referenced this issue Oct 7, 2020
@LetzNico
Copy link
Contributor

Looks like the spec has changed regarding that topic: open-telemetry/opentelemetry-specification#992 defines updating an attribute value to null to be undefined behavior (disc here open-telemetry/opentelemetry-specification#797). In the current implementation, this is a no-op. According to this comment, it is acceptable.
I suggest to keep the code as is, ditch the PR and close the issue. What do you think?

@lzchen
Copy link
Contributor

lzchen commented Oct 13, 2020

@LetzNico
I believe your understanding is correct, we can leave the no-ops for setting attributes to None.

However, I think due to this logic, we still have the issue of None attributes in a Sequence type being dropped.

LetzNico added a commit to LetzNico/opentelemetry-python that referenced this issue Oct 17, 2020
LetzNico added a commit to LetzNico/opentelemetry-python that referenced this issue Oct 18, 2020
@LetzNico
Copy link
Contributor

@LetzNico
I believe your understanding is correct, we can leave the no-ops for setting attributes to None.

However, I think due to this logic, we still have the issue of None attributes in a Sequence type being dropped.

That is to comply this part of the spec, right?

null values within arrays MUST be preserved as-is (i.e., passed on to spanprocessors / exporters as null). If exporters do not support exporting null values, they MAY replace those values by 0, false, or empty strings.
This is required for map/dictionary structures represented as two arrays with indices that are kept in sync (e.g., two attributes header_keys and header_values, both containing an array of strings to represent a mapping header_keys[i] -> header_values[i]).

If yes, I've updated the PR, good for review :). Thanks for your help!

LetzNico added a commit to LetzNico/opentelemetry-python that referenced this issue Oct 19, 2020
LetzNico added a commit to LetzNico/opentelemetry-python that referenced this issue Oct 19, 2020
LetzNico added a commit to LetzNico/opentelemetry-python that referenced this issue Oct 19, 2020
LetzNico added a commit to LetzNico/opentelemetry-python that referenced this issue Oct 19, 2020
LetzNico added a commit to LetzNico/opentelemetry-python that referenced this issue Oct 24, 2020
LetzNico added a commit to LetzNico/opentelemetry-python that referenced this issue Oct 24, 2020
LetzNico added a commit to LetzNico/opentelemetry-python that referenced this issue Oct 25, 2020
GA Burndown automation moved this from To Do to Done Oct 26, 2020
srikanthccv pushed a commit to srikanthccv/opentelemetry-python that referenced this issue Nov 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Affects the API package. help wanted release:required-for-ga To be resolved before GA release
Projects
No open projects
GA Burndown
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants