diff --git a/CHANGELOG.md b/CHANGELOG.md index 4efe946c78..9cf7485d58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,12 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re ## Unreleased +## [v0.30.2](https://github.com/thanos-io/thanos/tree/release-0.30) - 28.01.2023 + +### Fixed + +- [#6066](https://github.com/thanos-io/thanos/pull/6066) Tracing: fixed panic because of nil sampler + ## [v0.30.1](https://github.com/thanos-io/thanos/tree/release-0.30) - 4.01.2023 ### Fixed diff --git a/pkg/tracing/jaeger/config_yaml.go b/pkg/tracing/jaeger/config_yaml.go index 71009070b3..6bde1950ce 100644 --- a/pkg/tracing/jaeger/config_yaml.go +++ b/pkg/tracing/jaeger/config_yaml.go @@ -129,7 +129,10 @@ func getSampler(config Config) tracesdk.Sampler { case "remote": remoteOptions := getRemoteOptions(config) sampler = jaegerremote.New(config.ServiceName, remoteOptions...) + // Fallback always to default (rate limiting). case "ratelimiting": + fallthrough + default: // The same config options are applicable to both remote and rate-limiting samplers. remoteOptions := getRemoteOptions(config) sampler = jaegerremote.New(config.ServiceName, remoteOptions...) @@ -137,17 +140,17 @@ func getSampler(config Config) tracesdk.Sampler { if ok { sampler.Update(config.SamplerParam) } - default: - var root tracesdk.Sampler - var parentOptions []tracesdk.ParentBasedSamplerOption - if config.SamplerParentConfig.LocalParentSampled { - parentOptions = append(parentOptions, tracesdk.WithLocalParentSampled(root)) - } - if config.SamplerParentConfig.RemoteParentSampled { - parentOptions = append(parentOptions, tracesdk.WithRemoteParentSampled(root)) - } - sampler = tracesdk.ParentBased(root, parentOptions...) } + + var parentOptions []tracesdk.ParentBasedSamplerOption + if config.SamplerParentConfig.LocalParentSampled { + parentOptions = append(parentOptions, tracesdk.WithLocalParentSampled(sampler)) + } + if config.SamplerParentConfig.RemoteParentSampled { + parentOptions = append(parentOptions, tracesdk.WithRemoteParentSampled(sampler)) + } + sampler = tracesdk.ParentBased(sampler, parentOptions...) + return sampler }