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

Add probability to decision when appropriate #1116

Merged

Conversation

jkwatson
Copy link
Contributor

Resolves #1087

Does this look like what you're looking for, @pavolloffay ?

Copy link
Member

@Oberon00 Oberon00 left a comment

Choose a reason for hiding this comment

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

IMHO, this must go through spec first, otherwise we risk coming up with incompatible definitions for these attributes relative to other languages.

@thisthat
Copy link
Member

You might add an entry in the SemanticAttributes class and use that. This way, if in the spec we agree to a different name, the update will be straight forward

@@ -125,5 +125,9 @@
/** JDBC substring like "mysql://db.example.com:3306" */
public static final StringAttributeSetter DB_URL = StringAttributeSetter.create("db.url");

/** Probability value used by a probability-based Span sampling strategy. */
public static final DoubleAttributeSetter SAMPLING_PROBABILITY =
Copy link
Member

Choose a reason for hiding this comment

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

I would put this in the SDK since it is SDK specific.

Copy link
Member

Choose a reason for hiding this comment

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

It's probably also useful for vendor API implementations though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can you give an example of how an API user would want to use this attribute?

Copy link
Member

Choose a reason for hiding this comment

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

@jkwatson this is for the moment only in java so we cannot have it here. I would suggest two things:

  • Open a PR in specs to add this
  • Move it as internal member in probability sampler for the moment. and document that we need to follow the specs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, strong agree. I'll make it happen.

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 see. Do you think there's a whole class of stuff that an alternate SDK implementation would want to use from the default SDK?

Copy link
Member

Choose a reason for hiding this comment

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

Even if that is the case, I am not sure we can have this in the API: Sampler is not part of the API (and explicitly removed from the API any "sampling" logic).

So I think this should be moved to SDK anyway.

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 was just wondering if there was going to be a need for some sort of "SDK Support" module that could contain this kind of thing. I'm not suggesting we do that now, though. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, moved into the SDK. PTAL, @bogdandrutu

sdk/src/main/java/io/opentelemetry/sdk/trace/Samplers.java Outdated Show resolved Hide resolved
@@ -125,5 +125,9 @@
/** JDBC substring like "mysql://db.example.com:3306" */
public static final StringAttributeSetter DB_URL = StringAttributeSetter.create("db.url");

/** Probability value used by a probability-based Span sampling strategy. */
public static final DoubleAttributeSetter SAMPLING_PROBABILITY =
Copy link
Member

Choose a reason for hiding this comment

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

Even if that is the case, I am not sure we can have this in the API: Sampler is not part of the API (and explicitly removed from the API any "sampling" logic).

So I think this should be moved to SDK anyway.

@codecov-io
Copy link

codecov-io commented Apr 20, 2020

Codecov Report

Merging #1116 into master will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1116      +/-   ##
============================================
+ Coverage     85.68%   85.73%   +0.05%     
- Complexity     1081     1082       +1     
============================================
  Files           138      138              
  Lines          3974     3981       +7     
  Branches        351      351              
============================================
+ Hits           3405     3413       +8     
+ Misses          427      426       -1     
  Partials        142      142              
Impacted Files Coverage Δ Complexity Δ
...main/java/io/opentelemetry/sdk/trace/Samplers.java 89.13% <100.00%> (+1.95%) 4.00 <0.00> (ø)
...ava/io/opentelemetry/sdk/trace/SpanBuilderSdk.java 93.13% <100.00%> (ø) 39.00 <0.00> (ø)
...emetry/trace/attributes/DoubleAttributeSetter.java 55.55% <0.00%> (+11.11%) 3.00% <0.00%> (+1.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 adf82e7...94ab8f5. Read the comment docs.

Comment on lines 32 to 33
public static final DoubleAttributeSetter SAMPLING_PROBABILITY =
DoubleAttributeSetter.create("sampling.probability");
Copy link
Member

Choose a reason for hiding this comment

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

As I mentioned in a previous comment, I would make this internal in the Samplers until a decision in the specs is made. I think this was the confusion from the other thread, but would not expose it for the moment, my comment there was that if we decide to expose it will definitely not going to be in the API.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh yeah. I somehow spaced on that part of things. I'll move it in there for the nonce.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, please do it before merging :)

Copy link
Member

Choose a reason for hiding this comment

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

Also good to wait for @Oberon00 because they requested changes.

Copy link
Contributor Author

@jkwatson jkwatson Apr 20, 2020

Choose a reason for hiding this comment

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

moved into the Samplers, near the usage.

Comment on lines 32 to 33
public static final DoubleAttributeSetter SAMPLING_PROBABILITY =
DoubleAttributeSetter.create("sampling.probability");
Copy link
Member

Choose a reason for hiding this comment

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

Thanks, please do it before merging :)

@bogdandrutu
Copy link
Member

@Oberon00 you requested changes. Are you ok with moving forward with this being an internal member for the moment until specs are written?

@bogdandrutu
Copy link
Member

@Oberon00 ping :)

@bogdandrutu bogdandrutu merged commit 4d62068 into open-telemetry:master Apr 22, 2020
@pavolloffay
Copy link
Member

Thanks for the PR @jkwatson

davebarda pushed a commit to davebarda/opentelemetry-java that referenced this pull request Apr 24, 2020
* add the sampling probability to the decision, when appropriate.

* formatting

* normalize a method name and move attribute to semantic convention attributes

* move the sampling attribute to its own class in the SDK

* Move the sampling priority attribute to a non-public spot
@jkwatson jkwatson added this to the May Release milestone May 1, 2020
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.

Add sampler's probablity value to sampling attributes
7 participants