-
Notifications
You must be signed in to change notification settings - Fork 934
Prototype: Complex attributes (Option C) #7813
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a8085a5
Prototype: Complex attributes (Option C - minimal)
trask d9ed983
Remove String, Value<?> overload
trask fa87c47
Add javadoc explaining coersion
trask 5cfe4ab
more javadoc
trask 42d4b8a
more javadoc
trask 99668f0
more
trask 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 hidden or 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 hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,5 +17,6 @@ public enum AttributeType { | |
| STRING_ARRAY, | ||
| BOOLEAN_ARRAY, | ||
| LONG_ARRAY, | ||
| DOUBLE_ARRAY | ||
| DOUBLE_ARRAY, | ||
| VALUE | ||
| } | ||
This file contains hidden or 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
Oops, something went wrong.
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.
hm, should these be identical?
put("abc", Value.of("xyz"))put("abc", "xyz")they should be identical over OTLP
but should they be exposed identically to in-memory processors?
specifically, is the following behavior ok for
put("abc", Value.of("xyz"))Attributes.get(stringKey("abc"))returnsnullAttributes.forEach()andAttributes.asMap()both represent the key value pair as an attribute key with AttributeTypeVALUEand a value with typeValueI think this is ok, since you're explicitly opting in to an AttributeKey with AttributeType
VALUEwhen you're setting the attributeOh wait, maybe this is a good reason not to have this overload
put(String, Value<?>)and require callingput(AttributeKey, Value<?>).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.
I think yes since if they are not identical, then every in-memory processors has extra work to do if they want to perform the simple task of accessing a scalar value.
This isn't a good enough defense because a caller could just call
put(AttriubteKey.valueKey("abc"), Value.of("xyz")and achieve the same affect.We could have the default implementation of
put(String, Value)andput(AttributeKey, Value):put(String, String)for string)ValueUh oh!
There was an error while loading. Please reload this page.
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.
It's my hot take that any time one finds oneself re/inventing a type system in a language to try and work around the language's type system shortcomings, you're in for a bad time. 😬
But yeah, if we go this route, the a value of type
Stringmust be necessarily different from aValueof typeString. So yeah,ValueString(which isAValue<String>) does not have semantic equivalence to aStringstring.I'm sure this will trip up someone, or at least cause them to cuss about this, but it doesn't seem like a deal breaker to me.
...or as was already mentioned, requires other code to do more work to check.
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.
I drafted javadoc to help us evaluate this option: fa87c47