-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Update OTLP to v0.4.0 [Breaking change] #1142
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
Update OTLP to v0.4.0 [Breaking change] #1142
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1142 +/- ##
==========================================
- Coverage 87.49% 87.48% -0.02%
==========================================
Files 202 202
Lines 14525 14641 +116
==========================================
+ Hits 12709 12808 +99
- Misses 1376 1388 +12
- Partials 440 445 +5
Continue to review full report at Codecov.
|
e50951d to
211b5c9
Compare
f84fbe7 to
b746b29
Compare
b746b29 to
2a20003
Compare
|
@bogdandrutu please review especially the AttributeValue/AttributeMap changes. |
|
@keitwb |
|
@kbrockhoff there are some minor changes to golden data generator in this PR. You may want to review. |
| m.ForEach(func(k string, v pdata.AttributeValue) { | ||
| kvs = append(kvs, fmt.Sprintf("%q:%s", k, attributeValueToString(v, true))) | ||
| }) | ||
| return "{" + strings.Join(kvs, ",") + "}" |
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.
https://golang.org/pkg/strings/#Builder is more efficient
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.
Also is there any need to worry about escaping , in the key or value or are these "JSON-like strings" not meant to be strictly parsed?
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.
-
Changed to strings.Builder.
-
Escaping is handled correctly by %q formatter for the key and by recursive call to attributeValueToString for the values. Updated the tests to include backslash and double quote in the key and in the value.
2a20003 to
a39bb23
Compare
This is a breaking OTLP change. - Use AnyValue introduced in recent change to OTLP. Changes are encapsulated in AttributeValue and most of the codebase is unaffected, which proves the wrappers are very useful. - Rename AttributeKeyValue to KeyValue (the change comes from OTLP). - Use local protoc to compile ProtoBufs. Previously used znly/protoc docker image is outdated and results in incorrect code for gRPC-Gateway. TODO: - Need to add support for ARRAY value type. This is not urgent since there are no known data sources that use the ARRAY type yet. - Use Gogoproto `(gogoproto.nullable) = false` annotation for AnyValue to possibly improve performance further.
a39bb23 to
f75fb2f
Compare
| } | ||
|
|
||
| func attributeValueToString(attr pdata.AttributeValue) string { | ||
| func attributeValueToString(attr pdata.AttributeValue, jsonLike bool) string { |
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.
do we even translate this back from string?
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 am not sure I understand the question.
|
|
||
| case pdata.AttributeValueMAP: | ||
| // OpenCensus attributes cannot represent maps natively. Convert the | ||
| // map to a JSON-like string. |
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.
Why not JSON? Do we want this to be just human-readable representation or do we expect someone to attempt to translate it back?
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 is a stringified JSON. I think it is a good compromise since it preserves the full information and can be translated back, yet it is also more or less human readable.
I am open to other suggestions on how else we can translate this.
This is a breaking OTLP change. - Use AnyValue introduced in recent change to OTLP. Changes are encapsulated in AttributeValue and most of the codebase is unaffected, which proves the wrappers are very useful. - Rename AttributeKeyValue to KeyValue (the change comes from OTLP). - Use local protoc to compile ProtoBufs. Previously used znly/protoc docker image is outdated and results in incorrect code for gRPC-Gateway. TODO: - Need to add support for ARRAY value type. This is not urgent since there are no known data sources that use the ARRAY type yet. - Use Gogoproto `(gogoproto.nullable) = false` annotation for AnyValue to possibly improve performance further.
* Rename 'correlation' to 'baggage' * Rename CorrelationContext progator to Baggage * Update CHANGELOG
This is a breaking OTLP change.
Use AnyValue introduced in recent change to OTLP.
Changes are encapsulated in AttributeValue and most of the codebase is
unaffected, which proves the wrappers are very useful.
Rename AttributeKeyValue to KeyValue (the change comes from OTLP).
Use local protoc to compile ProtoBufs. Previously used znly/protoc
docker image is outdated and results in incorrect code for gRPC-Gateway.
TODO:
Need to add support for ARRAY value type. This is not urgent since
there are no known data sources that use the ARRAY type yet.
Use Gogoproto
(gogoproto.nullable) = falseannotation for AnyValueto possibly improve performance further.