-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Comply with OpenTelemetry attributes specification #1703
Merged
Merged
Conversation
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
The OpenTelemetry specification requires attributes conform to a standard evaluated and returned by attribute.KeyValue.Valid. To comply with the specification, Resources created from NewWithAttributes need to only contain valid attributes. This adds a check to ensure this and drops invalid attributes passed as arguments.
MrAlias
requested review from
Aneurysm9,
dashpole,
evantorrie,
jmacd,
lizthegrey and
XSAM
as code owners
March 16, 2021 23:26
2 tasks
Codecov Report
@@ Coverage Diff @@
## main #1703 +/- ##
=====================================
Coverage 77.8% 77.8%
=====================================
Files 130 130
Lines 6988 6998 +10
=====================================
+ Hits 5438 5450 +12
+ Misses 1299 1297 -2
Partials 251 251
|
The attribute.Set is (possibly overly) optimized to avoid allocations. The returned value from the constructor is a value of a Set, not a pointer to the Set. A Set contains a lock value and pointer methods so passing the Set value raises the copylock go vet error. This copies the same nolint comment from the `NewSet` method this used to use.
MrAlias
commented
Mar 16, 2021
XSAM
reviewed
Mar 17, 2021
Co-authored-by: Sam Xie <[email protected]>
Aneurysm9
approved these changes
Mar 17, 2021
XSAM
approved these changes
Mar 17, 2021
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.
👍
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Currently attributes that a users tries to add to a
Span
are ensured to be compliant with the OpenTelemetry specification before they are added to theSpan
, otherwise they are dropped. This same logic is needed when attributes are used to create resources.This unifies the logic to check if an attribute is valid in a new
Valid
method on theattribute.KeyValue
type and adds this validation check to theresource
package.