From f0bdc321f5dad83c34e43b6bbba1d4f3e95419a5 Mon Sep 17 00:00:00 2001 From: adityachopra29 Date: Wed, 8 Jan 2025 00:33:58 +0530 Subject: [PATCH] use 'valid' tag for DefaultSamplingProbability, remove unnecessary 'options' input from functions Signed-off-by: adityachopra29 --- cmd/jaeger/internal/all-in-one.yaml | 2 +- .../extension/remotesampling/config.go | 13 ++--- .../extension/remotesampling/config_test.go | 4 +- .../extension/remotesampling/factory.go | 4 +- idl | 2 +- .../strategyprovider/static/constants.go | 6 +-- .../strategyprovider/static/options.go | 4 +- .../strategyprovider/static/provider.go | 51 +++++++++---------- .../strategyprovider/static/provider_test.go | 41 ++++++++------- 9 files changed, 61 insertions(+), 66 deletions(-) diff --git a/cmd/jaeger/internal/all-in-one.yaml b/cmd/jaeger/internal/all-in-one.yaml index a5c4d0b1aac3..70fe648660d7 100644 --- a/cmd/jaeger/internal/all-in-one.yaml +++ b/cmd/jaeger/internal/all-in-one.yaml @@ -31,8 +31,8 @@ extensions: # We can either use file or adaptive sampling strategy in remote_sampling file: path: + default_sampling_probability: 1 reload_interval: 1s - default_sampling_probability: 0.001 # adaptive: # sampling_store: some_store # initial_sampling_probability: 0.1 diff --git a/cmd/jaeger/internal/extension/remotesampling/config.go b/cmd/jaeger/internal/extension/remotesampling/config.go index d2a6f9443bc1..7f8819b14879 100644 --- a/cmd/jaeger/internal/extension/remotesampling/config.go +++ b/cmd/jaeger/internal/extension/remotesampling/config.go @@ -18,10 +18,9 @@ import ( ) var ( - errNoProvider = errors.New("no sampling strategy provider specified, expecting 'adaptive' or 'file'") - errMultipleProviders = errors.New("only one sampling strategy provider can be specified, 'adaptive' or 'file'") - errNegativeInterval = errors.New("reload interval must be a positive value, or zero to disable automatic reloading") - errInvalidDefaultProbability = errors.New("default sampling probability must be between 0 and 1") + errNoProvider = errors.New("no sampling strategy provider specified, expecting 'adaptive' or 'file'") + errMultipleProviders = errors.New("only one sampling strategy provider can be specified, 'adaptive' or 'file'") + errNegativeInterval = errors.New("reload interval must be a positive value, or zero to disable automatic reloading") ) var ( @@ -52,7 +51,7 @@ type FileConfig struct { // 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"` + DefaultSamplingProbability float64 `mapstructure:"default_sampling_probability" valid:"range(0|1)"` } type AdaptiveConfig struct { @@ -107,10 +106,6 @@ func (cfg *Config) Validate() error { return errNegativeInterval } - if cfg.File != nil && (cfg.File.DefaultSamplingProbability > 1 || cfg.File.DefaultSamplingProbability < 0) { - return errInvalidDefaultProbability - } - _, err := govalidator.ValidateStruct(cfg) return err } diff --git a/cmd/jaeger/internal/extension/remotesampling/config_test.go b/cmd/jaeger/internal/extension/remotesampling/config_test.go index 8336dd589d35..b4cd7d9e3e6f 100644 --- a/cmd/jaeger/internal/extension/remotesampling/config_test.go +++ b/cmd/jaeger/internal/extension/remotesampling/config_test.go @@ -63,14 +63,14 @@ func Test_Validate(t *testing.T) { config: &Config{ File: &FileConfig{Path: "", DefaultSamplingProbability: -0.5}, }, - expectedErr: "default sampling probability must be between 0 and 1", + expectedErr: "File.DefaultSamplingProbability: -0.5 does not validate as range(0|1)", }, { name: "File provider has default sampling probability greater than 1", config: &Config{ File: &FileConfig{Path: "", DefaultSamplingProbability: 1.5}, }, - expectedErr: "default sampling probability must be between 0 and 1", + expectedErr: "File.DefaultSamplingProbability: 1.5 does not validate as range(0|1)", }, { name: "Invalid Adaptive provider", diff --git a/cmd/jaeger/internal/extension/remotesampling/factory.go b/cmd/jaeger/internal/extension/remotesampling/factory.go index 51e9f2e1e453..ed0373cd16f4 100644 --- a/cmd/jaeger/internal/extension/remotesampling/factory.go +++ b/cmd/jaeger/internal/extension/remotesampling/factory.go @@ -13,6 +13,7 @@ import ( "go.opentelemetry.io/collector/extension" "github.com/jaegertracing/jaeger/plugin/sampling/strategyprovider/adaptive" + "github.com/jaegertracing/jaeger/plugin/sampling/strategyprovider/static" "github.com/jaegertracing/jaeger/ports" ) @@ -43,7 +44,8 @@ func createDefaultConfig() component.Config { }, }, File: &FileConfig{ - Path: "", // path needs to be specified + Path: "", // path needs to be specified + DefaultSamplingProbability: static.DefaultDefaultSamplingProbability, }, Adaptive: &AdaptiveConfig{ SamplingStore: "", // storage name needs to be specified diff --git a/idl b/idl index de97430b579c..63f6e7e5b134 160000 --- a/idl +++ b/idl @@ -1 +1 @@ -Subproject commit de97430b579cac669422048a0becc5db981b05ad +Subproject commit 63f6e7e5b134ec6fb78830f48bd4bd2f1e8fd295 diff --git a/plugin/sampling/strategyprovider/static/constants.go b/plugin/sampling/strategyprovider/static/constants.go index 9c431c35c51f..20f4d6e4eaf2 100644 --- a/plugin/sampling/strategyprovider/static/constants.go +++ b/plugin/sampling/strategyprovider/static/constants.go @@ -16,9 +16,9 @@ const ( // only up to a fixed number of traces per second. samplerTypeRateLimiting = "ratelimiting" - // defaultDefaultSamplingProbability is the default "defaultSamplingProbability" - // used by the Strategy Store in case no defaultSamplingProbability is defined is given - defaultDefaultSamplingProbability = 0.001 + // DefaultDefaultSamplingProbability is the default value for "DefaultSamplingProbability" + // used by the Strategy Store in case no DefaultSamplingProbability is defined + DefaultDefaultSamplingProbability = 0.001 ) // defaultStrategy is the default sampling strategy the Strategy Store will return diff --git a/plugin/sampling/strategyprovider/static/options.go b/plugin/sampling/strategyprovider/static/options.go index 017040a9030e..9dbb059d861c 100644 --- a/plugin/sampling/strategyprovider/static/options.go +++ b/plugin/sampling/strategyprovider/static/options.go @@ -15,7 +15,7 @@ const ( samplingStrategiesFile = "sampling.strategies-file" samplingStrategiesReloadInterval = "sampling.strategies-reload-interval" samplingStrategiesBugfix5270 = "sampling.strategies.bugfix-5270" - samplingStrategiesDefaultSamplingProbability = "sampling.stategies-default-sampling-probability" + samplingStrategiesDefaultSamplingProbability = "sampling.default-sampling-probability" ) // Options holds configuration for the static sampling strategy store. @@ -37,7 +37,7 @@ 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.") + flagSet.Float64(samplingStrategiesDefaultSamplingProbability, DefaultDefaultSamplingProbability, "Sampling probability used by the Strategy Store for static sampling. Value must be between 0 and 1.") } // InitFromViper initializes Options with properties from viper diff --git a/plugin/sampling/strategyprovider/static/provider.go b/plugin/sampling/strategyprovider/static/provider.go index 3b03f0cf4094..2ffd2a170f27 100644 --- a/plugin/sampling/strategyprovider/static/provider.go +++ b/plugin/sampling/strategyprovider/static/provider.go @@ -71,13 +71,13 @@ func NewProvider(options Options, logger *zap.Logger) (ss.Provider, error) { h.logger.Warn("Default operations level strategies will not be included for Ratelimiting service strategies." + "This behavior will be changed in future releases. " + "Cf. https://github.com/jaegertracing/jaeger/issues/5270") - h.parseStrategies_deprecated(options, strategies) + h.parseStrategies_deprecated(strategies) } else { - h.parseStrategies(options, strategies) + h.parseStrategies(strategies) } if options.ReloadInterval > 0 { - go h.autoUpdateStrategies(ctx, options.ReloadInterval, loadFn, options) + go h.autoUpdateStrategies(ctx, loadFn) } return h, nil } @@ -154,21 +154,21 @@ func (h *samplingProvider) samplingStrategyLoader(strategiesFile string) strateg } } -func (h *samplingProvider) autoUpdateStrategies(ctx context.Context, interval time.Duration, loader strategyLoader, options Options) { +func (h *samplingProvider) autoUpdateStrategies(ctx context.Context, loader strategyLoader) { lastValue := string(nullJSON) - ticker := time.NewTicker(interval) + ticker := time.NewTicker(h.options.ReloadInterval) defer ticker.Stop() for { select { case <-ticker.C: - lastValue = h.reloadSamplingStrategy(options, loader, lastValue) + lastValue = h.reloadSamplingStrategy(loader, lastValue) case <-ctx.Done(): return } } } -func (h *samplingProvider) reloadSamplingStrategy(options Options, loadFn strategyLoader, lastValue string) string { +func (h *samplingProvider) reloadSamplingStrategy(loadFn strategyLoader, lastValue string) string { newValue, err := loadFn() if err != nil { h.logger.Error("failed to re-load sampling strategies", zap.Error(err)) @@ -177,19 +177,19 @@ func (h *samplingProvider) reloadSamplingStrategy(options Options, loadFn strate if lastValue == string(newValue) { return lastValue } - if err := h.updateSamplingStrategy(options, newValue); err != nil { + if err := h.updateSamplingStrategy(newValue); err != nil { h.logger.Error("failed to update sampling strategies", zap.Error(err)) return lastValue } return string(newValue) } -func (h *samplingProvider) updateSamplingStrategy(options Options, dataBytes []byte) error { +func (h *samplingProvider) updateSamplingStrategy(dataBytes []byte) error { var strategies strategies if err := json.Unmarshal(dataBytes, &strategies); err != nil { return fmt.Errorf("failed to unmarshal sampling strategies: %w", err) } - h.parseStrategies(options, &strategies) + h.parseStrategies(&strategies) h.logger.Info("Updated sampling strategies:" + string(dataBytes)) return nil } @@ -208,10 +208,10 @@ func loadStrategies(loadFn strategyLoader) (*strategies, error) { return strategies, nil } -func (h *samplingProvider) parseStrategies_deprecated(options Options, strategies *strategies) { - newStore := defaultStrategies(options.DefaultSamplingProbability) +func (h *samplingProvider) parseStrategies_deprecated(strategies *strategies) { + newStore := defaultStrategies(h.options.DefaultSamplingProbability) if strategies.DefaultStrategy != nil { - newStore.defaultStrategy = h.parseServiceStrategies(options, strategies.DefaultStrategy) + newStore.defaultStrategy = h.parseServiceStrategies(strategies.DefaultStrategy) } merge := true @@ -221,7 +221,7 @@ func (h *samplingProvider) parseStrategies_deprecated(options Options, strategie } for _, s := range strategies.ServiceStrategies { - newStore.serviceStrategies[s.Service] = h.parseServiceStrategies(options, s) + newStore.serviceStrategies[s.Service] = h.parseServiceStrategies(s) // Merge with the default operation strategies, because only merging with // the default strategy has no effect on service strategies (the default strategy @@ -247,14 +247,14 @@ func (h *samplingProvider) parseStrategies_deprecated(options Options, strategie h.storedStrategies.Store(newStore) } -func (h *samplingProvider) parseStrategies(options Options, strategies *strategies) { - newStore := defaultStrategies(options.DefaultSamplingProbability) +func (h *samplingProvider) parseStrategies(strategies *strategies) { + newStore := defaultStrategies(h.options.DefaultSamplingProbability) if strategies.DefaultStrategy != nil { - newStore.defaultStrategy = h.parseServiceStrategies(options, strategies.DefaultStrategy) + newStore.defaultStrategy = h.parseServiceStrategies(strategies.DefaultStrategy) } for _, s := range strategies.ServiceStrategies { - newStore.serviceStrategies[s.Service] = h.parseServiceStrategies(options, s) + newStore.serviceStrategies[s.Service] = h.parseServiceStrategies(s) // Config for this service may not have per-operation strategies, // but if the default strategy has them they should still apply. @@ -302,19 +302,19 @@ func mergePerOperationSamplingStrategies( return a } -func (h *samplingProvider) parseServiceStrategies(options Options, strategy *serviceStrategy) *api_v2.SamplingStrategyResponse { - resp := h.parseStrategy(options, &strategy.strategy) +func (h *samplingProvider) parseServiceStrategies(strategy *serviceStrategy) *api_v2.SamplingStrategyResponse { + resp := h.parseStrategy(&strategy.strategy) if len(strategy.OperationStrategies) == 0 { return resp } opS := &api_v2.PerOperationSamplingStrategies{ - DefaultSamplingProbability: options.DefaultSamplingProbability, + DefaultSamplingProbability: h.options.DefaultSamplingProbability, } if resp.StrategyType == api_v2.SamplingStrategyType_PROBABILISTIC { opS.DefaultSamplingProbability = resp.ProbabilisticSampling.SamplingRate } for _, operationStrategy := range strategy.OperationStrategies { - s, ok := h.parseOperationStrategy(options, operationStrategy, opS) + s, ok := h.parseOperationStrategy(operationStrategy, opS) if !ok { continue } @@ -330,11 +330,10 @@ func (h *samplingProvider) parseServiceStrategies(options Options, strategy *ser } func (h *samplingProvider) parseOperationStrategy( - options Options, strategy *operationStrategy, parent *api_v2.PerOperationSamplingStrategies, ) (s *api_v2.SamplingStrategyResponse, ok bool) { - s = h.parseStrategy(options, &strategy.strategy) + s = h.parseStrategy(&strategy.strategy) if s.StrategyType == api_v2.SamplingStrategyType_RATE_LIMITING { // TODO OperationSamplingStrategy only supports probabilistic sampling h.logger.Warn( @@ -348,7 +347,7 @@ func (h *samplingProvider) parseOperationStrategy( return s, true } -func (h *samplingProvider) parseStrategy(options Options, strategy *strategy) *api_v2.SamplingStrategyResponse { +func (h *samplingProvider) parseStrategy(strategy *strategy) *api_v2.SamplingStrategyResponse { switch strategy.Type { case samplerTypeProbabilistic: return &api_v2.SamplingStrategyResponse{ @@ -366,7 +365,7 @@ func (h *samplingProvider) parseStrategy(options Options, strategy *strategy) *a } default: h.logger.Warn("Failed to parse sampling strategy", zap.Any("strategy", strategy)) - return defaultStrategyResponse(options.DefaultSamplingProbability) + return defaultStrategyResponse(h.options.DefaultSamplingProbability) } } diff --git a/plugin/sampling/strategyprovider/static/provider_test.go b/plugin/sampling/strategyprovider/static/provider_test.go index 827787c647b7..9fe3ada5b132 100644 --- a/plugin/sampling/strategyprovider/static/provider_test.go +++ b/plugin/sampling/strategyprovider/static/provider_test.go @@ -94,16 +94,16 @@ func mockStrategyServer(t *testing.T) (*httptest.Server, *atomic.Pointer[string] } func TestStrategyStoreWithFile(t *testing.T) { - _, err := NewProvider(Options{StrategiesFile: "fileNotFound.json", DefaultSamplingProbability: defaultDefaultSamplingProbability}, zap.NewNop()) + _, err := NewProvider(Options{StrategiesFile: "fileNotFound.json", DefaultSamplingProbability: DefaultDefaultSamplingProbability}, zap.NewNop()) require.ErrorContains(t, err, "failed to read strategies file fileNotFound.json") - _, err = NewProvider(Options{StrategiesFile: "fixtures/bad_strategies.json", DefaultSamplingProbability: defaultDefaultSamplingProbability}, zap.NewNop()) + _, err = NewProvider(Options{StrategiesFile: "fixtures/bad_strategies.json", DefaultSamplingProbability: DefaultDefaultSamplingProbability}, zap.NewNop()) require.EqualError(t, err, "failed to unmarshal strategies: json: cannot unmarshal string into Go value of type static.strategies") // Test default strategy logger, buf := testutils.NewLogger() - provider, err := NewProvider(Options{DefaultSamplingProbability: defaultDefaultSamplingProbability}, logger) + provider, err := NewProvider(Options{DefaultSamplingProbability: DefaultDefaultSamplingProbability}, logger) require.NoError(t, err) assert.Contains(t, buf.String(), "No sampling strategies source provided, using defaults") s, err := provider.GetSamplingStrategy(context.Background(), "foo") @@ -130,7 +130,7 @@ func TestStrategyStoreWithURL(t *testing.T) { // Test default strategy when URL is temporarily unavailable. logger, buf := testutils.NewLogger() mockServer, _ := mockStrategyServer(t) - provider, err := NewProvider(Options{StrategiesFile: mockServer.URL + "/service-unavailable", DefaultSamplingProbability: defaultDefaultSamplingProbability}, logger) + provider, err := NewProvider(Options{StrategiesFile: mockServer.URL + "/service-unavailable", DefaultSamplingProbability: DefaultDefaultSamplingProbability}, logger) require.NoError(t, err) assert.Contains(t, buf.String(), "No sampling strategies found or URL is unavailable, using defaults") s, err := provider.GetSamplingStrategy(context.Background(), "foo") @@ -154,11 +154,11 @@ func TestPerOperationSamplingStrategies(t *testing.T) { tests := []struct { options Options }{ - {Options{StrategiesFile: "fixtures/operation_strategies.json", DefaultSamplingProbability: defaultDefaultSamplingProbability}}, + {Options{StrategiesFile: "fixtures/operation_strategies.json", DefaultSamplingProbability: DefaultDefaultSamplingProbability}}, {Options{ StrategiesFile: "fixtures/operation_strategies.json", IncludeDefaultOpStrategies: true, - DefaultSamplingProbability: defaultDefaultSamplingProbability, + DefaultSamplingProbability: DefaultDefaultSamplingProbability, }}, } @@ -246,11 +246,11 @@ func TestPerOperationSamplingStrategies(t *testing.T) { func TestMissingServiceSamplingStrategyTypes(t *testing.T) { logger, buf := testutils.NewLogger() - provider, err := NewProvider(Options{StrategiesFile: "fixtures/missing-service-types.json", DefaultSamplingProbability: defaultDefaultSamplingProbability}, logger) + provider, err := NewProvider(Options{StrategiesFile: "fixtures/missing-service-types.json", DefaultSamplingProbability: DefaultDefaultSamplingProbability}, logger) assert.Contains(t, buf.String(), "Failed to parse sampling strategy") require.NoError(t, err) - expected := makeResponse(api_v2.SamplingStrategyType_PROBABILISTIC, defaultDefaultSamplingProbability) + expected := makeResponse(api_v2.SamplingStrategyType_PROBABILISTIC, DefaultDefaultSamplingProbability) s, err := provider.GetSamplingStrategy(context.Background(), "foo") require.NoError(t, err) @@ -259,12 +259,12 @@ func TestMissingServiceSamplingStrategyTypes(t *testing.T) { require.NotNil(t, s.OperationSampling) opSampling := s.OperationSampling - assert.InDelta(t, defaultDefaultSamplingProbability, opSampling.DefaultSamplingProbability, 1e-4) + assert.InDelta(t, DefaultDefaultSamplingProbability, opSampling.DefaultSamplingProbability, 1e-4) require.Len(t, opSampling.PerOperationStrategies, 1) assert.Equal(t, "op1", opSampling.PerOperationStrategies[0].Operation) assert.InDelta(t, 0.2, opSampling.PerOperationStrategies[0].ProbabilisticSampling.SamplingRate, 0.001) - expected = makeResponse(api_v2.SamplingStrategyType_PROBABILISTIC, defaultDefaultSamplingProbability) + expected = makeResponse(api_v2.SamplingStrategyType_PROBABILISTIC, DefaultDefaultSamplingProbability) s, err = provider.GetSamplingStrategy(context.Background(), "bar") require.NoError(t, err) @@ -306,17 +306,17 @@ func TestParseStrategy(t *testing.T) { }, } logger, buf := testutils.NewLogger() - provider := &samplingProvider{options: Options{DefaultSamplingProbability: defaultDefaultSamplingProbability}, logger: logger} + provider := &samplingProvider{options: Options{DefaultSamplingProbability: DefaultDefaultSamplingProbability}, logger: logger} for _, test := range tests { tt := test t.Run("", func(t *testing.T) { - assert.EqualValues(t, tt.expected, *provider.parseStrategy(provider.options, &tt.strategy.strategy)) + assert.EqualValues(t, tt.expected, *provider.parseStrategy(&tt.strategy.strategy)) }) } assert.Empty(t, buf.String()) // Test nonexistent strategy type - actual := *provider.parseStrategy(provider.options, &strategy{Type: "blah", Param: 3.5}) + actual := *provider.parseStrategy(&strategy{Type: "blah", Param: 3.5}) expected := makeResponse(api_v2.SamplingStrategyType_PROBABILISTIC, provider.options.DefaultSamplingProbability) assert.EqualValues(t, expected, actual) assert.Contains(t, buf.String(), "Failed to parse sampling strategy") @@ -375,7 +375,7 @@ func TestAutoUpdateStrategyWithFile(t *testing.T) { assert.EqualValues(t, makeResponse(api_v2.SamplingStrategyType_PROBABILISTIC, 0.8), *s) // verify that reloading is a no-op - value := provider.reloadSamplingStrategy(provider.options, provider.samplingStrategyLoader(dstFile), string(srcBytes)) + value := provider.reloadSamplingStrategy(provider.samplingStrategyLoader(dstFile), string(srcBytes)) assert.Equal(t, string(srcBytes), value) // update file with new probability of 0.9 @@ -397,7 +397,7 @@ func TestAutoUpdateStrategyWithFile(t *testing.T) { func TestAutoUpdateStrategyWithURL(t *testing.T) { mockServer, mockStrategy := mockStrategyServer(t) ss, err := NewProvider(Options{ - DefaultSamplingProbability: defaultDefaultSamplingProbability, + DefaultSamplingProbability: DefaultDefaultSamplingProbability, StrategiesFile: mockServer.URL, ReloadInterval: 10 * time.Millisecond, }, zap.NewNop()) @@ -412,7 +412,6 @@ func TestAutoUpdateStrategyWithURL(t *testing.T) { // verify that reloading in no-op value := provider.reloadSamplingStrategy( - provider.options, provider.samplingStrategyLoader(mockServer.URL), *mockStrategy.Load(), ) @@ -455,25 +454,25 @@ func TestAutoUpdateStrategyErrors(t *testing.T) { defer provider.Close() // check invalid file path or read failure - assert.Equal(t, "blah", provider.reloadSamplingStrategy(provider.options, provider.samplingStrategyLoader(tempFile.Name()+"bad-path"), "blah")) + assert.Equal(t, "blah", provider.reloadSamplingStrategy(provider.samplingStrategyLoader(tempFile.Name()+"bad-path"), "blah")) assert.Len(t, logs.FilterMessage("failed to re-load sampling strategies").All(), 1) // check bad file content require.NoError(t, os.WriteFile(tempFile.Name(), []byte("bad value"), 0o644)) - assert.Equal(t, "blah", provider.reloadSamplingStrategy(provider.options, provider.samplingStrategyLoader(tempFile.Name()), "blah")) + assert.Equal(t, "blah", provider.reloadSamplingStrategy(provider.samplingStrategyLoader(tempFile.Name()), "blah")) assert.Len(t, logs.FilterMessage("failed to update sampling strategies").All(), 1) // check invalid url - assert.Equal(t, "duh", provider.reloadSamplingStrategy(provider.options, provider.samplingStrategyLoader("bad-url"), "duh")) + assert.Equal(t, "duh", provider.reloadSamplingStrategy(provider.samplingStrategyLoader("bad-url"), "duh")) assert.Len(t, logs.FilterMessage("failed to re-load sampling strategies").All(), 2) // check status code other than 200 mockServer, _ := mockStrategyServer(t) - assert.Equal(t, "duh", provider.reloadSamplingStrategy(provider.options, provider.samplingStrategyLoader(mockServer.URL+"/bad-status"), "duh")) + assert.Equal(t, "duh", provider.reloadSamplingStrategy(provider.samplingStrategyLoader(mockServer.URL+"/bad-status"), "duh")) assert.Len(t, logs.FilterMessage("failed to re-load sampling strategies").All(), 3) // check bad content from url - assert.Equal(t, "duh", provider.reloadSamplingStrategy(provider.options, provider.samplingStrategyLoader(mockServer.URL+"/bad-content"), "duh")) + assert.Equal(t, "duh", provider.reloadSamplingStrategy(provider.samplingStrategyLoader(mockServer.URL+"/bad-content"), "duh")) assert.Len(t, logs.FilterMessage("failed to update sampling strategies").All(), 2) }