From e6653e7e251c20762de4dced4929837040e651a1 Mon Sep 17 00:00:00 2001 From: Charles Korn Date: Mon, 13 Jan 2025 16:34:02 +1100 Subject: [PATCH] Include more information in spans produced by read consistency round-tripper (#10412) * Include more information in spans produced by read consistency round-tripper * Add changelog entry --- CHANGELOG.md | 1 + pkg/frontend/querymiddleware/read_consistency.go | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc5f0ffde44..7b9eecf1754 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ * [ENHANCEMENT] Dashboards: Add Query-Scheduler <-> Querier Inflight Requests row to Query Reads and Remote Ruler reads dashboards. #10290 * [ENHANCEMENT] OTLP: In addition to the flag `-distributor.otel-created-timestamp-zero-ingestion-enabled` there is now `-distributor.otel-start-time-quiet-zero` to convert OTel start timestamps to Prometheus QuietZeroNaNs. This flag is to make the change rollout safe between Ingesters and Distributors. #10238 * [ENHANCEMENT] Ruler: When rule concurrency is enabled for a rule group, its rules will now be reordered and run in batches based on their dependencies. This increases the number of rules that can potentially run concurrently. Note that the global and tenant-specific limits still apply #10400 +* [ENHANCEMENT] Query-frontend: include more information about read consistency in trace spans produced when using experimental ingest storage. #10412 * [BUGFIX] Distributor: Use a boolean to track changes while merging the ReplicaDesc components, rather than comparing the objects directly. #10185 * [BUGFIX] Querier: fix timeout responding to query-frontend when response size is very close to `-querier.frontend-client.grpc-max-send-msg-size`. #10154 * [BUGFIX] Query-frontend and querier: show warning/info annotations in some cases where they were missing (if a lazy querier was used). #10277 diff --git a/pkg/frontend/querymiddleware/read_consistency.go b/pkg/frontend/querymiddleware/read_consistency.go index 9c15ae0e025..1523c8617be 100644 --- a/pkg/frontend/querymiddleware/read_consistency.go +++ b/pkg/frontend/querymiddleware/read_consistency.go @@ -58,6 +58,7 @@ func (r *readConsistencyRoundTripper) RoundTrip(req *http.Request) (_ *http.Resp } if level != querierapi.ReadConsistencyStrong { + spanLog.DebugLog("msg", "evaluating query with eventually consistent read consistency") return r.next.RoundTrip(req) } @@ -76,10 +77,13 @@ func (r *readConsistencyRoundTripper) RoundTrip(req *http.Request) (_ *http.Resp return errors.Wrapf(err, "wait for last produced offsets of topic '%s'", offsetsReader.Topic()) } + headerValue := string(querierapi.EncodeOffsets(offsets)) reqHeaderLock.Lock() - req.Header.Add(headerKey, string(querierapi.EncodeOffsets(offsets))) + req.Header.Add(headerKey, headerValue) reqHeaderLock.Unlock() + spanLog.DebugLog("msg", "got offsets for strong read consistency", "header", headerKey, "value", headerValue) + return nil }) } @@ -88,6 +92,8 @@ func (r *readConsistencyRoundTripper) RoundTrip(req *http.Request) (_ *http.Resp return nil, err } + spanLog.DebugLog("msg", "evaluating query with strong read consistency") + return r.next.RoundTrip(req) }