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

Fix sampling strategies overwriting service entry when no sampling ty… #1244

Merged
merged 4 commits into from
Jan 16, 2019

Conversation

objectiser
Copy link
Contributor

…pe is specified

Signed-off-by: Gary Brown [email protected]

Which problem is this PR solving?

Resolves #1205
If the service strategy does not define a sampling type, it reuses the default sampling strategy but applies the operation sampling strategies. End result is that all services (that don't define a sampling type) will share a single entry with identical details (i.e. the ones associated with the last initialised entry).

Short description of the changes

Although it is an error state, if no sampling type is defined and the default sampling strategy is to be used, then it should return a copy.

@yurishkuro
Copy link
Member

If the service strategy does not define a sampling type,

what do you mean by "sampling type"?

Taking a copy seems fine, but what does it fix? Do we modify the returned struct somehow, so that the default is affected for every service?

@codecov
Copy link

codecov bot commented Dec 11, 2018

Codecov Report

Merging #1244 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #1244   +/-   ##
======================================
  Coverage     100%    100%           
======================================
  Files         161     161           
  Lines        7185    7193    +8     
======================================
+ Hits         7185    7193    +8
Impacted Files Coverage Δ
...in/sampling/strategystore/static/strategy_store.go 100% <100%> (ø) ⬆️

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 0a47389...2bead4c. Read the comment docs.

@objectiser
Copy link
Contributor Author

For example, as shown here. The service level sampling type.

Yes the defaultStrategy is being modified.

@objectiser
Copy link
Contributor Author

Maybe not in this PR, but I think in general it would be better to enable the service specific sampling strategy to be optional, and if not defined, then the default defined in the config should be used. Only if that is not defined, should the hardcoded default be used.

@@ -136,6 +136,7 @@ func (h *strategyStore) parseStrategy(strategy *strategy) *sampling.SamplingStra
}
default:
h.logger.Warn("Failed to parse sampling strategy", zap.Any("strategy", strategy))
return &defaultStrategy
copyOfDefaultStrategy := defaultStrategy
return &copyOfDefaultStrategy
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure this way of copying is correct. It only works for primitive strategies, anything nested would still have the same issue. I think it needs a deep copy.

@objectiser
Copy link
Contributor Author

@yurishkuro What is the preferred approach for doing deep copy in Jaeger?

@yurishkuro
Copy link
Member

We haven't done it anywhere afaik. One option is to use encoding/glob to marshal/unmarshal.

@objectiser objectiser force-pushed the sampling branch 2 times, most recently from 4d36bf8 to c35e894 Compare January 3, 2019 17:11
Signed-off-by: Gary Brown <[email protected]>
@objectiser
Copy link
Contributor Author

@yurishkuro Updated.

@ghost ghost assigned yurishkuro Jan 15, 2019
@pavolloffay pavolloffay merged commit d1f365a into jaegertracing:master Jan 16, 2019
@ghost ghost removed the review label Jan 16, 2019
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