Skip to content

Commit

Permalink
Include more information in spans produced by read consistency round-…
Browse files Browse the repository at this point in the history
…tripper (#10412)

* Include more information in spans produced by read consistency round-tripper

* Add changelog entry
  • Loading branch information
charleskorn authored Jan 13, 2025
1 parent ccb73ed commit e6653e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion pkg/frontend/querymiddleware/read_consistency.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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
})
}
Expand All @@ -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)
}

Expand Down

0 comments on commit e6653e7

Please sign in to comment.