Skip to content

Commit

Permalink
Show warnings in query frontend (thanos-io#7289)
Browse files Browse the repository at this point in the history
* Show warnings in query frontend

QFE currently does not parse warnings from downstream queriers.
This commit fixes that by adding the field to proto messages and
modifies the merge function to take warnings into account.

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>

* Add CHANGELOG entry

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>

* Omit empty warnings

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>

---------

Signed-off-by: Filip Petkovski <filip.petkovsky@gmail.com>
  • Loading branch information
fpetkovski authored and jnyi committed Jun 1, 2024
1 parent 9d280ae commit 2d3dcf6
Show file tree
Hide file tree
Showing 6 changed files with 226 additions and 102 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ We use *breaking :warning:* to mark changes that are not backward compatible (re
- [#7244](https://github.com/thanos-io/thanos/pull/7244) Query: Fix Internal Server Error unknown targetHealth: "unknown" when trying to open the targets page.
- [#7248](https://github.com/thanos-io/thanos/pull/7248) Receive: Fix RemoteWriteAsync was sequentially executed causing high latency in the ingestion path.
- [#7271](https://github.com/thanos-io/thanos/pull/7271) Query: fixing dedup iterator when working on mixed sample types.
- [#7289](https://github.com/thanos-io/thanos/pull/7289) Query Frontend: show warnings from downstream queries.

### Added

Expand Down
15 changes: 10 additions & 5 deletions internal/cortex/querier/queryrange/query_range.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,17 @@ func (prometheusCodec) MergeResponse(_ Request, responses ...Response) (Response
// Merge the responses.
sort.Sort(byFirstTime(promResponses))

analyzes := make([]*Analysis, 0, len(responses))
var (
analyzes = make([]*Analysis, 0, len(responses))
warnings []string = nil
)
for i := range promResponses {
if promResponses[i].Data.GetAnalysis() == nil {
continue
if promResponses[i].Data.GetAnalysis() != nil {
analyzes = append(analyzes, promResponses[i].Data.GetAnalysis())
}
if len(promResponses[i].Warnings) > 0 {
warnings = append(warnings, promResponses[i].Warnings...)
}

analyzes = append(analyzes, promResponses[i].Data.GetAnalysis())
}

response := PrometheusResponse{
Expand All @@ -277,6 +281,7 @@ func (prometheusCodec) MergeResponse(_ Request, responses ...Response) (Response
Stats: StatsMerge(responses),
Analysis: AnalyzesMerge(analyzes...),
},
Warnings: warnings,
}
response.Headers = QueryBytesFetchedPrometheusResponseHeaders(responses...)
if len(resultsCacheGenNumberHeaderValues) != 0 {
Expand Down
Loading

0 comments on commit 2d3dcf6

Please sign in to comment.