diff options
Diffstat (limited to 'vendor/github.com/uber/jaeger-client-go')
6 files changed, 67 insertions, 33 deletions
diff --git a/vendor/github.com/uber/jaeger-client-go/CHANGELOG.md b/vendor/github.com/uber/jaeger-client-go/CHANGELOG.md index c4590bf93..5e7e9d5e5 100644 --- a/vendor/github.com/uber/jaeger-client-go/CHANGELOG.md +++ b/vendor/github.com/uber/jaeger-client-go/CHANGELOG.md @@ -1,6 +1,16 @@ Changes by Version ================== +2.20.1 (2019-11-08) +------------------- + +Minor patch via https://github.com/jaegertracing/jaeger-client-go/pull/468 + +- Make `AdaptiveSamplerUpdater` usable with default values; Resolves #467 +- Create `OperationNameLateBinding` sampler option and config option +- Make `SamplerOptions` var of public type, so that its functions are discoverable via godoc + + 2.20.0 (2019-11-06) ------------------- diff --git a/vendor/github.com/uber/jaeger-client-go/config/config.go b/vendor/github.com/uber/jaeger-client-go/config/config.go index 965f7c3ee..a0c32d804 100644 --- a/vendor/github.com/uber/jaeger-client-go/config/config.go +++ b/vendor/github.com/uber/jaeger-client-go/config/config.go @@ -76,17 +76,26 @@ type SamplerConfig struct { // Can be set by exporting an environment variable named JAEGER_SAMPLER_MANAGER_HOST_PORT SamplingServerURL string `yaml:"samplingServerURL"` - // MaxOperations is the maximum number of operations that the sampler - // will keep track of. If an operation is not tracked, a default probabilistic - // sampler will be used rather than the per operation specific sampler. - // Can be set by exporting an environment variable named JAEGER_SAMPLER_MAX_OPERATIONS - MaxOperations int `yaml:"maxOperations"` - // SamplingRefreshInterval controls how often the remotely controlled sampler will poll // jaeger-agent for the appropriate sampling strategy. // Can be set by exporting an environment variable named JAEGER_SAMPLER_REFRESH_INTERVAL SamplingRefreshInterval time.Duration `yaml:"samplingRefreshInterval"` + // MaxOperations is the maximum number of operations that the PerOperationSampler + // will keep track of. If an operation is not tracked, a default probabilistic + // sampler will be used rather than the per operation specific sampler. + // Can be set by exporting an environment variable named JAEGER_SAMPLER_MAX_OPERATIONS. + MaxOperations int `yaml:"maxOperations"` + + // Opt-in feature for applications that require late binding of span name via explicit + // call to SetOperationName when using PerOperationSampler. When this feature is enabled, + // the sampler will return retryable=true from OnCreateSpan(), thus leaving the sampling + // decision as non-final (and the span as writeable). This may lead to degraded performance + // in applications that always provide the correct span name on trace creation. + // + // For backwards compatibility this option is off by default. + OperationNameLateBinding bool `yaml:"operationNameLateBinding"` + // Options can be used to programmatically pass additional options to the Remote sampler. Options []jaeger.SamplerOption } @@ -335,7 +344,7 @@ func (sc *SamplerConfig) NewSampler( return jaeger.NewProbabilisticSampler(sc.Param) } return nil, fmt.Errorf( - "Invalid Param for probabilistic sampler: %v. Expecting value between 0 and 1", + "invalid Param for probabilistic sampler; expecting value between 0 and 1, received %v", sc.Param, ) } @@ -353,17 +362,14 @@ func (sc *SamplerConfig) NewSampler( jaeger.SamplerOptions.Metrics(metrics), jaeger.SamplerOptions.InitialSampler(initSampler), jaeger.SamplerOptions.SamplingServerURL(sc.SamplingServerURL), - } - if sc.MaxOperations != 0 { - options = append(options, jaeger.SamplerOptions.MaxOperations(sc.MaxOperations)) - } - if sc.SamplingRefreshInterval != 0 { - options = append(options, jaeger.SamplerOptions.SamplingRefreshInterval(sc.SamplingRefreshInterval)) + jaeger.SamplerOptions.MaxOperations(sc.MaxOperations), + jaeger.SamplerOptions.OperationNameLateBinding(sc.OperationNameLateBinding), + jaeger.SamplerOptions.SamplingRefreshInterval(sc.SamplingRefreshInterval), } options = append(options, sc.Options...) return jaeger.NewRemotelyControlledSampler(serviceName, options...), nil } - return nil, fmt.Errorf("Unknown sampler type %v", sc.Type) + return nil, fmt.Errorf("unknown sampler type (%s)", sc.Type) } // NewReporter instantiates a new reporter that submits spans to the collector diff --git a/vendor/github.com/uber/jaeger-client-go/constants.go b/vendor/github.com/uber/jaeger-client-go/constants.go index 0da47b02f..5d27b628d 100644 --- a/vendor/github.com/uber/jaeger-client-go/constants.go +++ b/vendor/github.com/uber/jaeger-client-go/constants.go @@ -22,7 +22,7 @@ import ( const ( // JaegerClientVersion is the version of the client library reported as Span tag. - JaegerClientVersion = "Go-2.20.0" + JaegerClientVersion = "Go-2.20.1" // JaegerClientVersionTagKey is the name of the tag used to report client version. JaegerClientVersionTagKey = "jaeger.version" diff --git a/vendor/github.com/uber/jaeger-client-go/sampler.go b/vendor/github.com/uber/jaeger-client-go/sampler.go index 6195d59c5..f47004b1f 100644 --- a/vendor/github.com/uber/jaeger-client-go/sampler.go +++ b/vendor/github.com/uber/jaeger-client-go/sampler.go @@ -363,6 +363,9 @@ type PerOperationSamplerParams struct { // NewPerOperationSampler returns a new PerOperationSampler. func NewPerOperationSampler(params PerOperationSamplerParams) *PerOperationSampler { + if params.MaxOperations <= 0 { + params.MaxOperations = defaultMaxOperations + } samplers := make(map[string]*GuaranteedThroughputProbabilisticSampler) for _, strategy := range params.Strategies.PerOperationStrategies { sampler := newGuaranteedThroughputProbabilisticSampler( diff --git a/vendor/github.com/uber/jaeger-client-go/sampler_remote.go b/vendor/github.com/uber/jaeger-client-go/sampler_remote.go index 9bd0c9822..4448b8f64 100644 --- a/vendor/github.com/uber/jaeger-client-go/sampler_remote.go +++ b/vendor/github.com/uber/jaeger-client-go/sampler_remote.go @@ -258,8 +258,9 @@ func (u *RateLimitingSamplerUpdater) Update(sampler SamplerV2, strategy interfac // ----------------------- // AdaptiveSamplerUpdater is used by RemotelyControlledSampler to parse sampling configuration. +// Fields have the same meaning as in PerOperationSamplerParams. type AdaptiveSamplerUpdater struct { - MaxOperations int // required + MaxOperations int OperationNameLateBinding bool } diff --git a/vendor/github.com/uber/jaeger-client-go/sampler_remote_options.go b/vendor/github.com/uber/jaeger-client-go/sampler_remote_options.go index 7a292effc..3b5c6aa9c 100644 --- a/vendor/github.com/uber/jaeger-client-go/sampler_remote_options.go +++ b/vendor/github.com/uber/jaeger-client-go/sampler_remote_options.go @@ -23,12 +23,17 @@ import ( // SamplerOption is a function that sets some option on the sampler type SamplerOption func(options *samplerOptions) -// SamplerOptions is a factory for all available SamplerOption's -var SamplerOptions samplerOptions +// SamplerOptions is a factory for all available SamplerOption's. +var SamplerOptions SamplerOptionsFactory + +// SamplerOptionsFactory is a factory for all available SamplerOption's. +// The type acts as a namespace for factory functions. It is public to +// make the functions discoverable via godoc. Recommended to be used +// via global SamplerOptions variable. +type SamplerOptionsFactory struct{} type samplerOptions struct { metrics *Metrics - maxOperations int sampler SamplerV2 logger Logger samplingServerURL string @@ -36,11 +41,12 @@ type samplerOptions struct { samplingFetcher SamplingStrategyFetcher samplingParser SamplingStrategyParser updaters []SamplerUpdater + posParams PerOperationSamplerParams } // Metrics creates a SamplerOption that initializes Metrics on the sampler, // which is used to emit statistics. -func (samplerOptions) Metrics(m *Metrics) SamplerOption { +func (SamplerOptionsFactory) Metrics(m *Metrics) SamplerOption { return func(o *samplerOptions) { o.metrics = m } @@ -48,22 +54,30 @@ func (samplerOptions) Metrics(m *Metrics) SamplerOption { // MaxOperations creates a SamplerOption that sets the maximum number of // operations the sampler will keep track of. -func (samplerOptions) MaxOperations(maxOperations int) SamplerOption { +func (SamplerOptionsFactory) MaxOperations(maxOperations int) SamplerOption { + return func(o *samplerOptions) { + o.posParams.MaxOperations = maxOperations + } +} + +// OperationNameLateBinding creates a SamplerOption that sets the respective +// field in the PerOperationSamplerParams. +func (SamplerOptionsFactory) OperationNameLateBinding(enable bool) SamplerOption { return func(o *samplerOptions) { - o.maxOperations = maxOperations + o.posParams.OperationNameLateBinding = enable } } // InitialSampler creates a SamplerOption that sets the initial sampler // to use before a remote sampler is created and used. -func (samplerOptions) InitialSampler(sampler Sampler) SamplerOption { +func (SamplerOptionsFactory) InitialSampler(sampler Sampler) SamplerOption { return func(o *samplerOptions) { o.sampler = samplerV1toV2(sampler) } } // Logger creates a SamplerOption that sets the logger used by the sampler. -func (samplerOptions) Logger(logger Logger) SamplerOption { +func (SamplerOptionsFactory) Logger(logger Logger) SamplerOption { return func(o *samplerOptions) { o.logger = logger } @@ -71,7 +85,7 @@ func (samplerOptions) Logger(logger Logger) SamplerOption { // SamplingServerURL creates a SamplerOption that sets the sampling server url // of the local agent that contains the sampling strategies. -func (samplerOptions) SamplingServerURL(samplingServerURL string) SamplerOption { +func (SamplerOptionsFactory) SamplingServerURL(samplingServerURL string) SamplerOption { return func(o *samplerOptions) { o.samplingServerURL = samplingServerURL } @@ -79,28 +93,28 @@ func (samplerOptions) SamplingServerURL(samplingServerURL string) SamplerOption // SamplingRefreshInterval creates a SamplerOption that sets how often the // sampler will poll local agent for the appropriate sampling strategy. -func (samplerOptions) SamplingRefreshInterval(samplingRefreshInterval time.Duration) SamplerOption { +func (SamplerOptionsFactory) SamplingRefreshInterval(samplingRefreshInterval time.Duration) SamplerOption { return func(o *samplerOptions) { o.samplingRefreshInterval = samplingRefreshInterval } } // SamplingStrategyFetcher creates a SamplerOption that initializes sampling strategy fetcher. -func (samplerOptions) SamplingStrategyFetcher(fetcher SamplingStrategyFetcher) SamplerOption { +func (SamplerOptionsFactory) SamplingStrategyFetcher(fetcher SamplingStrategyFetcher) SamplerOption { return func(o *samplerOptions) { o.samplingFetcher = fetcher } } // SamplingStrategyParser creates a SamplerOption that initializes sampling strategy parser. -func (samplerOptions) SamplingStrategyParser(parser SamplingStrategyParser) SamplerOption { +func (SamplerOptionsFactory) SamplingStrategyParser(parser SamplingStrategyParser) SamplerOption { return func(o *samplerOptions) { o.samplingParser = parser } } // Updaters creates a SamplerOption that initializes sampler updaters. -func (samplerOptions) Updaters(updaters ...SamplerUpdater) SamplerOption { +func (SamplerOptionsFactory) Updaters(updaters ...SamplerUpdater) SamplerOption { return func(o *samplerOptions) { o.updaters = updaters } @@ -116,9 +130,6 @@ func (o *samplerOptions) applyOptionsAndDefaults(opts ...SamplerOption) *sampler if o.logger == nil { o.logger = log.NullLogger } - if o.maxOperations <= 0 { - o.maxOperations = defaultMaxOperations - } if o.samplingServerURL == "" { o.samplingServerURL = DefaultSamplingServerURL } @@ -139,7 +150,10 @@ func (o *samplerOptions) applyOptionsAndDefaults(opts ...SamplerOption) *sampler } if o.updaters == nil { o.updaters = []SamplerUpdater{ - &AdaptiveSamplerUpdater{MaxOperations: o.maxOperations}, + &AdaptiveSamplerUpdater{ + MaxOperations: o.posParams.MaxOperations, + OperationNameLateBinding: o.posParams.OperationNameLateBinding, + }, new(ProbabilisticSamplerUpdater), new(RateLimitingSamplerUpdater), } |