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

Array values for span attributes #807

Merged

Conversation

thisthat
Copy link
Member

@thisthat thisthat commented Jan 30, 2020

This PR implements the specification introduced in open-telemetry/opentelemetry-specification#368 and resolves #801

@codecov-io
Copy link

codecov-io commented Jan 30, 2020

Codecov Report

Merging #807 into master will increase coverage by 0.09%.
The diff coverage is 87.32%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #807      +/-   ##
============================================
+ Coverage     85.55%   85.65%   +0.09%     
- Complexity     1066     1073       +7     
============================================
  Files           137      137              
  Lines          3932     3994      +62     
  Branches        348      354       +6     
============================================
+ Hits           3364     3421      +57     
- Misses          430      437       +7     
+ Partials        138      136       -2     
Impacted Files Coverage Δ Complexity Δ
...io/opentelemetry/exporters/otlp/CommonAdapter.java 87.50% <0.00%> (-3.81%) 6.00 <0.00> (ø)
...n/java/io/opentelemetry/common/AttributeValue.java 80.48% <84.90%> (+7.15%) 9.00 <4.00> (+4.00)
...ava/io/opentelemetry/exporters/jaeger/Adapter.java 96.70% <100.00%> (+0.50%) 20.00 <0.00> (+4.00)
...ntelemetry/sdk/trace/RecordEventsReadableSpan.java 85.40% <100.00%> (+0.15%) 47.00 <0.00> (+1.00)
...ava/io/opentelemetry/sdk/trace/SpanBuilderSdk.java 94.84% <100.00%> (+1.70%) 37.00 <0.00> (-2.00) ⬆️
...elemetry/sdk/trace/export/BatchSpansProcessor.java 93.23% <0.00%> (+1.50%) 9.00% <0.00%> (ø%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 83eb97e...84c0eb3. Read the comment docs.

@jkwatson
Copy link
Contributor

looks like this needs a format

@carlosalberto
Copy link
Contributor

Left a few comments. The important one for me is the one regarding null values in the arrays - it feels like a slight overkill, but something needed. Not sold on this one though. Thoughts?

@Oberon00
Copy link
Member

Oberon00 commented Feb 3, 2020

@carlosalberto This should be dealt with in open-telemetry/opentelemetry-specification#431 (you gave it the 0.4 milestone before the array aspect came up)

@thisthat
Copy link
Member Author

thisthat commented Feb 28, 2020

@open-telemetry/java-approvers PTAL again since open-telemetry/opentelemetry-specification#459 was merged! I will provide a followup PR to address the null and empty str cases of #948

Copy link
Member

@arminru arminru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up (#948):

  • ignore null arrays instead of replacing them with empty ones (but remove previously set attribute, if any)
  • store empty arrays since those are valid values
  • tests for the changes above

@jkwatson
Copy link
Contributor

Looks like this needs a rebase to pick up the java11 build.

@thisthat thisthat force-pushed the array-span-attributes branch from 4dfd8b2 to e85d427 Compare March 2, 2020 09:26
@bogdandrutu
Copy link
Member

Please rebase and add an issue to make sure we keep this in sync with specs.

@thisthat thisthat force-pushed the array-span-attributes branch from e85d427 to a9ff82c Compare March 16, 2020 13:26
@thisthat thisthat force-pushed the array-span-attributes branch from cb82343 to 1be4815 Compare March 24, 2020 06:07
@thisthat
Copy link
Member Author

@carlosalberto done!

@thisthat thisthat force-pushed the array-span-attributes branch from 1be4815 to 84c0eb3 Compare April 1, 2020 11:25
@jkwatson
Copy link
Contributor

jkwatson commented Apr 1, 2020

@thisthat In this PR, you call everything "array", but the return values are all Lists. With List<Boolean>, you'll require boxing all primitives into objects. did you consider actually implementing this with arrays, so that primitives don't need to be boxed (and so the name matches the type)?

@thisthat
Copy link
Member Author

thisthat commented Apr 2, 2020

@jkwatson Yes, I considered that! I also would like to have pure arrays without all the boxing. Unfortunately, AutoValue does not support arrays (see here). An array-only implementation is possible but cumbersome, so I preferred implementing this with List<> and AutoValue. To guarantee immutability, we would need to duplicate the array internally so attributes are stored using a new pointer that is not visible by the OTel users.

@carlosalberto
Copy link
Contributor

@bogdandrutu I remember you had a few doubts about this in the past, so please comment, or else we will merge soon ;) (you can always fill an issue later, though)

@bogdandrutu
Copy link
Member

Let's merge this, will go with a flow and see where we will be in the future :)

@bogdandrutu bogdandrutu merged commit 4bcfdb7 into open-telemetry:master Apr 21, 2020
davebarda pushed a commit to davebarda/opentelemetry-java that referenced this pull request Apr 24, 2020
* [API] - Add Arrays for span attributes

* [SDK] - Add Arrays for span attributes

* [Exporters/Shim] - Add Arrays for span attributes

* add tests

* Adjust jaeger exporter to specification. Add tests.

* Fix checkstyle naming issue

* Add further tests.

* Align null value behavior of attributes with spec

* fix javadoc @SInCE

* API must not crash on misusage of AttributeValue

* API - Remove Attribute ArrayValues from Span surface

* Immutable String array values for AttributeValue

* Immutable values for AttributeValue arrays

* ./gradlew goJF

* Implement ArrayAttribute

* Rebase and add tests

* Adapt RecordEventsReadableSpan
@thisthat thisthat deleted the array-span-attributes branch April 30, 2020 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement array (list) span attributes (spec#368)
7 participants