Skip to content

Commit

Permalink
tracing: fixed panic because of nil sampler (thanos-io#6066)
Browse files Browse the repository at this point in the history
* fixed panic because of nil sampler

Signed-off-by: Vasiliy Rumyantsev <[email protected]>

* added CHANGELOG entry

Signed-off-by: Vasiliy Rumyantsev <[email protected]>

Signed-off-by: Vasiliy Rumyantsev <[email protected]>
  • Loading branch information
xBazilio authored and yeya24 committed Jan 29, 2023
1 parent 27e4714 commit 7fae899
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 13 additions & 10 deletions pkg/tracing/jaeger/config_yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,25 +129,28 @@ 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...)
sampler, ok := sampler.(*rateLimitingSampler)
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
}

Expand Down

0 comments on commit 7fae899

Please sign in to comment.