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

Convert Attributes to an interface #2134

Merged
merged 6 commits into from
Dec 1, 2020

Conversation

jkwatson
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Nov 25, 2020

Codecov Report

Merging #2134 (323b457) into master (6be6337) will decrease coverage by 0.02%.
The diff coverage is 96.07%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2134      +/-   ##
============================================
- Coverage     85.02%   84.99%   -0.03%     
+ Complexity     2168     2159       -9     
============================================
  Files           248      249       +1     
  Lines          8318     8291      -27     
  Branches        924      917       -7     
============================================
- Hits           7072     7047      -25     
- Misses          909      910       +1     
+ Partials        337      334       -3     
Impacted Files Coverage Δ Complexity Δ
...pentelemetry/api/common/ArrayBackedAttributes.java 92.30% <92.30%> (ø) 10.00 <10.00> (?)
...metry/api/common/ArrayBackedAttributesBuilder.java 97.14% <97.14%> (ø) 26.00 <26.00> (?)
...n/java/io/opentelemetry/api/common/Attributes.java 100.00% <100.00%> (+3.84%) 9.00 <3.00> (-9.00) ⬆️
...java/io/opentelemetry/sdk/trace/data/SpanData.java 92.85% <0.00%> (-7.15%) 1.00% <0.00%> (+1.00%) ⬇️
...ntelemetry/sdk/testing/assertj/SpanDataAssert.java 94.96% <0.00%> (-1.47%) 49.00% <0.00%> (-6.00%)
...xtension/incubator/trace/data/SpanDataBuilder.java 62.00% <0.00%> (-0.97%) 7.00% <0.00%> (-1.00%)
...ntelemetry/sdk/trace/RecordEventsReadableSpan.java 99.52% <0.00%> (-0.01%) 71.00% <0.00%> (-1.00%)
...n/java/io/opentelemetry/sdk/trace/SpanWrapper.java 100.00% <0.00%> (ø) 21.00% <0.00%> (-1.00%)
...ava/io/opentelemetry/sdk/trace/SpanBuilderSdk.java 100.00% <0.00%> (ø) 36.00% <0.00%> (ø%)
...java/io/opentelemetry/exporter/jaeger/Adapter.java 92.52% <0.00%> (ø) 21.00% <0.00%> (ø%)
... and 7 more

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 6be6337...323b457. Read the comment docs.


@AutoValue
@Immutable
abstract static class ArrayBackedAttributes extends Attributes {
abstract class ArrayBackedAttributes extends ImmutableKeyValuePairs<AttributeKey, Object>
Copy link
Contributor

Choose a reason for hiding this comment

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

This class is public - can you move it to a top level package private class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ooh. good point. yes, will do so.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -20,16 +23,25 @@
* <p>Null keys will be silently dropped.
*
* <p>Note: The behavior of null-valued attributes is undefined, and hence strongly discouraged.
*
* <p>Implementations of this interface *must* be immutable and have well-defined value-based
Copy link
Contributor

Choose a reason for hiding this comment

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

By the way - must they be immutable? Actually one of the, completely unsupported but wild, use cases that came up for me for this interface is mutable attributes in resource. Docker cgroups come to mind, but I wouldn't be surprised if there are some good use cases for process-related information that is updatable at runtime.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'd much rather start by strongly suggesting immutability, then maybe relax it if we find it's ok for them to be mutable.

@@ -39,47 +51,65 @@
public AttributesBuilder toBuilder() {
Copy link
Member

Choose a reason for hiding this comment

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

in order for the javaagent to provide a single implementation that satisfies both the shaded and unshaded interfaces, we need the return value here to be an interface, so that its implementation use a covariant return type that satisfies both, similar to the TraceState.getTraceState() example in #1946 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. please take a look

@jkwatson
Copy link
Contributor Author

@marcingrzejszczak FYI this is potentially a breaking change

@jkwatson jkwatson force-pushed the attributes_as_interface branch from f3dfa20 to f19b5a5 Compare November 30, 2020 18:59
@jkwatson jkwatson force-pushed the attributes_as_interface branch from f19b5a5 to bf41f09 Compare December 1, 2020 17:36
@jkwatson jkwatson merged commit e90a6a8 into open-telemetry:master Dec 1, 2020
@jkwatson jkwatson deleted the attributes_as_interface branch December 1, 2020 23:54
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.

3 participants