Skip to content

Prototype of removing bare span attribute keys#1097

Closed
jkwatson wants to merge 3 commits intoopen-telemetry:masterfrom
newrelic-forks:remove_bare_attribute_keys
Closed

Prototype of removing bare span attribute keys#1097
jkwatson wants to merge 3 commits intoopen-telemetry:masterfrom
newrelic-forks:remove_bare_attribute_keys

Conversation

@jkwatson
Copy link
Copy Markdown
Contributor

@jkwatson jkwatson commented Apr 9, 2020

As discussed extensively in #1076 , there is a desire to make the semantic attributes easier to apply in the context of a SpanBuilder. This suggestion replaces the bare String keys on the Span attribute setters, replacing them with interface-based methods that enforce the type of the value.

This is a follow-on from the prototype in #1096, where the interfaces were introduced.

Prototype suggestion for #1076 , #1075

@codecov-io
Copy link
Copy Markdown

Codecov Report

Merging #1097 into master will decrease coverage by 0.02%.
The diff coverage is 90.74%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1097      +/-   ##
============================================
- Coverage     85.58%   85.55%   -0.03%     
- Complexity     1085     1087       +2     
============================================
  Files           138      138              
  Lines          3990     3968      -22     
  Branches        355      355              
============================================
- Hits           3415     3395      -20     
+ Misses          434      432       -2     
  Partials        141      141              
Impacted Files Coverage Δ Complexity Δ
api/src/main/java/io/opentelemetry/trace/Span.java 100.00% <ø> (ø) 0.00 <0.00> (ø)
...metry/trace/attributes/BooleanAttributeSetter.java 55.55% <0.00%> (+11.11%) 3.00 <0.00> (+1.00)
...emetry/trace/attributes/DoubleAttributeSetter.java 55.55% <0.00%> (+11.11%) 3.00 <0.00> (+1.00)
...ava/io/opentelemetry/opentracingshim/SpanShim.java 44.11% <25.00%> (ø) 14.00 <0.00> (ø)
.../main/java/io/opentelemetry/trace/DefaultSpan.java 80.00% <100.00%> (ø) 19.00 <0.00> (ø)
...ain/java/io/opentelemetry/trace/DefaultTracer.java 94.87% <100.00%> (ø) 5.00 <0.00> (ø)
...elemetry/trace/attributes/LongAttributeSetter.java 77.77% <100.00%> (ø) 4.00 <1.00> (ø)
...telemetry/trace/attributes/SemanticAttributes.java 100.00% <100.00%> (ø) 1.00 <1.00> (ø)
...emetry/trace/attributes/StringAttributeSetter.java 77.77% <100.00%> (ø) 4.00 <1.00> (ø)
...ntelemetry/sdk/trace/RecordEventsReadableSpan.java 84.74% <100.00%> (ø) 44.00 <4.00> (ø)
... and 1 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 8b0fcfb...804797c. Read the comment docs.

@trask
Copy link
Copy Markdown
Member

trask commented Apr 9, 2020

Is there any relevant spec guidance, or guidance from other language's implementations that might be helpful in making this decision?

@jkwatson
Copy link
Copy Markdown
Contributor Author

Might be worth taking a look at the JavaScript codebase. Sounds like they have a lot of instrumentation, from what we heard this morning.

@jkwatson
Copy link
Copy Markdown
Contributor Author

That being said, for type-safe languages, we might have the most skin in the game at this point.

Copy link
Copy Markdown
Member

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

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

Overall it is not clear to me what is the benefit of having these new interfaces. Can you describe that in the description?

package io.opentelemetry.common;

public interface BooleanValuedKey {
String key();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What is the benefit of having this as an interface? Also have you thought about doing something like in the proto, extend the AttributeValue to be AttributeKeyValue?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes! This was another possible suggestion in #1076 . There, we were calling it simply "Attribute". That's another possibility, but would introduce an extra allocation for each attribute application, which probably isn't desirable.


package io.opentelemetry.trace.attributes;

import static io.opentelemetry.trace.attributes.LongAttributeSetter.longKey;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Attributes are used in other places like Resource would be good to have this helper in common.

@jkwatson
Copy link
Copy Markdown
Contributor Author

I'm closing this in favor of work being prototyped in #1130

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.

4 participants