From 13e44494024d94994d0b357312c3f44265884cc8 Mon Sep 17 00:00:00 2001 From: Neeraj Nagure Date: Mon, 25 Mar 2024 20:58:56 +0530 Subject: [PATCH 1/4] added missing sampler types Signed-off-by: Neeraj Nagure --- pkg/tracing/otlp/otlp.go | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/pkg/tracing/otlp/otlp.go b/pkg/tracing/otlp/otlp.go index 6843896de2..bf29d3622b 100644 --- a/pkg/tracing/otlp/otlp.go +++ b/pkg/tracing/otlp/otlp.go @@ -24,11 +24,14 @@ import ( ) const ( - TracingClientGRPC string = "grpc" - TracingClientHTTP string = "http" - AlwaysSample string = "alwayssample" - NeverSample string = "neversample" - RatioBasedSample string = "traceidratiobased" + TracingClientGRPC string = "grpc" + TracingClientHTTP string = "http" + AlwaysSample string = "alwayssample" + NeverSample string = "neversample" + TraceIDRatioBasedSample string = "traceidratiobased" + ParentBasedAlwaysSample string = "parentbasedalwayssample" + ParentBasedNeverSample string = "parentbasedneversample" + ParentBasedTraceIDRatioBasedSample string = "parentbasedtraceidratiobased" ) // NewOTELTracer returns an OTLP exporter based tracer. @@ -106,10 +109,20 @@ func newTraceProvider(ctx context.Context, processor tracesdk.SpanProcessor, log func getSampler(config Config) (tracesdk.Sampler, error) { switch strings.ToLower(config.SamplerType) { case AlwaysSample: - return tracesdk.ParentBased(tracesdk.AlwaysSample()), nil + return tracesdk.AlwaysSample(), nil case NeverSample: + return tracesdk.NeverSample(), nil + case TraceIDRatioBasedSample: + arg, err := strconv.ParseFloat(config.SamplerParam, 64) + if err != nil { + return tracesdk.TraceIDRatioBased(1.0), err + } + return tracesdk.TraceIDRatioBased(arg), nil + case ParentBasedAlwaysSample: + return tracesdk.ParentBased(tracesdk.AlwaysSample()), nil + case ParentBasedNeverSample: return tracesdk.ParentBased(tracesdk.NeverSample()), nil - case RatioBasedSample: + case ParentBasedTraceIDRatioBasedSample: arg, err := strconv.ParseFloat(config.SamplerParam, 64) if err != nil { return tracesdk.ParentBased(tracesdk.TraceIDRatioBased(1.0)), err From 3ee6e2a7ac57670f649beb8bbf36469630b5f944 Mon Sep 17 00:00:00 2001 From: Neeraj Nagure Date: Mon, 25 Mar 2024 22:02:51 +0530 Subject: [PATCH 2/4] added changelog entry Signed-off-by: Neeraj Nagure --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 046696862e..f990da17c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re - [#7224](https://github.com/thanos-io/thanos/pull/7224) Query-frontend: Add Redis username to the client configuration. ### Added +- [#7231](https://github.com/thanos-io/thanos/pull/7231) Tracing: added missing sampler types - [#7194](https://github.com/thanos-io/thanos/pull/7194) Downsample: retry objstore related errors - [#7105](https://github.com/thanos-io/thanos/pull/7105) Rule: add flag `--query.enable-x-functions` to allow usage of extended promql functions (xrate, xincrease, xdelta) in loaded rules - [#6867](https://github.com/thanos-io/thanos/pull/6867) Query UI: Tenant input box added to the Query UI, in order to be able to specify which tenant the query should use. From 82a43599715b31f9ddd12c61e61d9050379c3752 Mon Sep 17 00:00:00 2001 From: Neeraj Nagure Date: Sun, 31 Mar 2024 18:03:10 +0530 Subject: [PATCH 3/4] fixed changelog entry Signed-off-by: Neeraj Nagure --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fa10f9bf7..f7e2be1d23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re - [#7220](https://github.com/thanos-io/thanos/pull/7220) Store Gateway: Fix lazy expanded postings caching partial expanded postings and bug of estimating remove postings with non existent value. Added `PromQLSmith` based fuzz test to improve correctness. ### Added +- [#7231](https://github.com/thanos-io/thanos/pull/7231) Tracing: added missing sampler types - [#7194](https://github.com/thanos-io/thanos/pull/7194) Downsample: retry objstore related errors - [#7105](https://github.com/thanos-io/thanos/pull/7105) Rule: add flag `--query.enable-x-functions` to allow usage of extended promql functions (xrate, xincrease, xdelta) in loaded rules - [#6867](https://github.com/thanos-io/thanos/pull/6867) Query UI: Tenant input box added to the Query UI, in order to be able to specify which tenant the query should use. From d3b261851f77da700677bd2ddbbdcbd73062ab65 Mon Sep 17 00:00:00 2001 From: Neeraj Nagure Date: Sun, 31 Mar 2024 18:12:34 +0530 Subject: [PATCH 4/4] Fixed changelog entry conflict Signed-off-by: Neeraj Nagure --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7e2be1d23..618bc39b9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re - [#7220](https://github.com/thanos-io/thanos/pull/7220) Store Gateway: Fix lazy expanded postings caching partial expanded postings and bug of estimating remove postings with non existent value. Added `PromQLSmith` based fuzz test to improve correctness. ### Added + - [#7231](https://github.com/thanos-io/thanos/pull/7231) Tracing: added missing sampler types - [#7194](https://github.com/thanos-io/thanos/pull/7194) Downsample: retry objstore related errors - [#7105](https://github.com/thanos-io/thanos/pull/7105) Rule: add flag `--query.enable-x-functions` to allow usage of extended promql functions (xrate, xincrease, xdelta) in loaded rules