-
Notifications
You must be signed in to change notification settings - Fork 685
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
Add runtime validation in setAttribute #348
Merged
toumorokoshi
merged 27 commits into
open-telemetry:master
from
jakemalachowski:ISSUE-347/attribue-value-type-enforcement
Jan 20, 2020
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
6914ff3
Validate attribute value data types before adding to span
jakemalachowski 59107ad
Change order of checks to remove an else condition
jakemalachowski 8152fdb
Create separate sequence check method, add tests, fix linting issues
jakemalachowski 1d972e8
Fix attribute value typing
jakemalachowski c535e0c
Apply linting changes
jakemalachowski 59dd5f5
Use is not None, use optional type instead of union with None
jakemalachowski 2a5df2b
Validate attribute value data types before adding to span
jakemalachowski bacb09b
Change order of checks to remove an else condition
jakemalachowski 3e67a9e
Create separate sequence check method, add tests, fix linting issues
jakemalachowski ff61b9e
Fix attribute value typing
jakemalachowski 4d74316
Apply linting changes
jakemalachowski 8a7ec1c
Use is not None, use optional type instead of union with None
jakemalachowski f05956b
Merge branch 'ISSUE-347/attribue-value-type-enforcement' of github.co…
jakemalachowski e7e976a
Update opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py
jakemalachowski 75261d8
Clarify variable and method names, remove redundant check
jakemalachowski ca68796
Merge branch 'ISSUE-347/attribue-value-type-enforcement' of github.co…
jakemalachowski a9c554a
Merge branch 'master' of https://github.com/open-telemetry/openteleme…
jakemalachowski 1321134
Re-add explicit return None
jakemalachowski 269b006
Commit lint changes
jakemalachowski 47a5887
Merge branch 'master' of https://github.com/open-telemetry/openteleme…
jakemalachowski 669b3eb
Lint changes
jakemalachowski 4a5812c
Lint changes
jakemalachowski 6f1dd5d
Use number instead of int, float
jakemalachowski 5225928
Revert AttributeValue typing change
jakemalachowski b83dc7b
Prevent duplicate isinstance checks, run linter
jakemalachowski d8e5946
Lint
jakemalachowski ad58890
Move length check inside validation method
jakemalachowski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a potential edge case where AttributeValues that are lists can be mutated afterward, resulting in invalid types that exporters will run into.
I've added a followup ticket on that here: #352
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great catch. Would adding a copy of the list rather than the original list resolve this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could store the copies of the sequence values in tuples. Now that you mention this, instead of accepting lists or tuples we should accept sequences.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I think that's a good solution. Would be good to make a separate PR for that.