-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Make all-in-one.yaml file independant of sampling-strategies.json file #6431
base: main
Are you sure you want to change the base?
Make all-in-one.yaml file independant of sampling-strategies.json file #6431
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- you are working off a stale
main
, please rebase. There should be no changes to submodules in your PR - you have not made any changes to the logic, so why are you sending this for review?
- you need to test that sampling endpoint returns expected stratery
$ curl "http://localhost:5778/?service=x"
{"strategyType":0,"probabilisticSampling":{"samplingRate":1}}%
d95c1a3
to
a884a32
Compare
Hi @yurishkuro,
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6431 +/- ##
==========================================
- Coverage 96.27% 96.25% -0.03%
==========================================
Files 369 369
Lines 21048 21048
==========================================
- Hits 20264 20259 -5
- Misses 600 604 +4
- Partials 184 185 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
## Which problem is this PR solving? - Accidentally stumbled upon this when looking at #6431 - Turns out v2 config did not support all the options from v1 ## Description of the changes - Add support for reload interval ## How was this change tested? `go run ./cmd/jaeger` ``` $ curl "http://localhost:5778/?service=x" {"strategyType":0,"probabilisticSampling":{"samplingRate":1}}% ``` Edit cmd/jaeger/sampling-strategies.json to change default to 0.1. Observe server logs showing new values. ``` $ curl "http://localhost:5778/?service=x" {"strategyType":0,"probabilisticSampling":{"samplingRate":0.1}}% ``` --------- Signed-off-by: Yuri Shkuro <[email protected]> Signed-off-by: Yuri Shkuro <[email protected]>
The current default behavior is to return probability 1.0, not 0.001. There is a hardcoded constant |
make sure to pull from remote branch before you continue work, to pick up the changes I made |
Okay. So the initial issue regarding the dependancy of sampling-strategies.json file in all-in-one.yaml is resolved right? This is a new issue which needs to be solved? |
The original issue is not resolved since these changes return different results from what v2.1.0 Jaeger container returns. There is no need for any multiplier, the default probability should be made parameterizable via the provider API so that we can pass it from jaeger-v2 sampling extension (see #6441 for the pattern). |
Signed-off-by: adityachopra29 <[email protected]>
Signed-off-by: adityachopra29 <[email protected]>
Signed-off-by: adityachopra29 <[email protected]>
Signed-off-by: adityachopra29 <[email protected]>
Signed-off-by: adityachopra29 <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
bb1e6b0
to
8097990
Compare
@yurishkuro Please have a look once now.
Instead of
whch you wanted. I wanted to confirm what change I have to do to set this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove idl submodule change
@@ -104,6 +107,10 @@ func (cfg *Config) Validate() error { | |||
return errNegativeInterval | |||
} | |||
|
|||
if cfg.File != nil && (cfg.File.DefaultSamplingProbability > 1 || cfg.File.DefaultSamplingProbability < 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should be able to achieve similar validation by adding a valid
tag to the field, perhaps valid:range(0, 1)
// ReloadInterval is the time interval to check and reload sampling strategies file | ||
ReloadInterval time.Duration `mapstructure:"reload_interval"` | ||
// DefaultSamplingProbability is the sampling probability used by the Strategy Store for static sampling | ||
DefaultSamplingProbability float64 `mapstructure:"default_sampling_probability"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to assign default value to this in factory/createDefaultConfig
cmd/jaeger/internal/all-in-one.yaml
Outdated
reload_interval: 1s | ||
default_sampling_probability: 0.001 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not 1.0? I think this would be equivalent to the previous config where the stategies file was specified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on the right track
samplingStrategiesFile = "sampling.strategies-file" | ||
samplingStrategiesReloadInterval = "sampling.strategies-reload-interval" | ||
samplingStrategiesBugfix5270 = "sampling.strategies.bugfix-5270" | ||
samplingStrategiesDefaultSamplingProbability = "sampling.stategies-default-sampling-probability" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
samplingStrategiesDefaultSamplingProbability = "sampling.stategies-default-sampling-probability" | |
samplingStrategiesDefaultSamplingProbability = "sampling.default-sampling-probability" |
} | ||
|
||
// AddFlags adds flags for Options | ||
func AddFlags(flagSet *flag.FlagSet) { | ||
flagSet.Duration(samplingStrategiesReloadInterval, 0, "Reload interval to check and reload sampling strategies file. Zero value means no reloading") | ||
flagSet.String(samplingStrategiesFile, "", "The path for the sampling strategies file in JSON format. See sampling documentation to see format of the file") | ||
flagSet.Bool(samplingStrategiesBugfix5270, true, "Include default operation level strategies for Ratesampling type service level strategy. Cf. https://github.com/jaegertracing/jaeger/issues/5270") | ||
flagSet.Float64(samplingStrategiesDefaultSamplingProbability, defaultDefaultSamplingProbability, "Sampling probability used by the Strategy Store for static sampling. Value must be between 0 and 1.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defaultDefaultSamplingProbability
default-default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. it is the default value for options.DefaultSamplingProbability ... so i named it accordingly
And wherever defaultSamlingProbability was used I replaced it with this.
} | ||
|
||
if options.ReloadInterval > 0 { | ||
go h.autoUpdateStrategies(ctx, options.ReloadInterval, loadFn) | ||
go h.autoUpdateStrategies(ctx, options.ReloadInterval, loadFn, options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- if you are passing options no need to pass options.ReloadInterval
- do we need to pass either of those? It seems
h
already has access toh.options
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it seems we dont need to pass them. Removed now.
## Which problem is this PR solving? - Accidentally stumbled upon this when looking at jaegertracing#6431 - Turns out v2 config did not support all the options from v1 ## Description of the changes - Add support for reload interval ## How was this change tested? `go run ./cmd/jaeger` ``` $ curl "http://localhost:5778/?service=x" {"strategyType":0,"probabilisticSampling":{"samplingRate":1}}% ``` Edit cmd/jaeger/sampling-strategies.json to change default to 0.1. Observe server logs showing new values. ``` $ curl "http://localhost:5778/?service=x" {"strategyType":0,"probabilisticSampling":{"samplingRate":0.1}}% ``` --------- Signed-off-by: Yuri Shkuro <[email protected]> Signed-off-by: Yuri Shkuro <[email protected]>
@yurishkuro I have made the changes. Please have a look. |
Which problem is this PR solving?
Description of the changes
How was this change tested?
sampling-strategies.json
(the service "foo").jaeger/cmd/jaeger/internal/extension/remotesampling/extension_test.go
Line 83 in b02900c
the
sampling-strategies.json
file could not be removed1.) TestServerHTTP_TracesRequest,
2.) all 3 tests in cmd/query/app
which are not passing even on the main branch itself (according to me, otherwise I have made some mistake), and hence these same tests are not passing after I made my changes (my changes should not affect them anyway).
Checklist
jaeger
:make lint test
jaeger-ui
:npm run lint
andnpm run test