Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle warnings from remote engines #6619

Merged
merged 1 commit into from
Aug 18, 2023

Conversation

fpetkovski
Copy link
Contributor

@fpetkovski fpetkovski commented Aug 16, 2023

The remote engine implementation currently converts warnings to errors. This prevents using partial response with the distributed engine since every warning will cause a query to fail.

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Verification

The remote engine implementation currently converts warnings to errors.
This prevents using partial response with the distributed engine since every
warning will cause a query to fail.

Signed-off-by: Filip Petkovski <[email protected]>
@@ -245,7 +250,8 @@ func (r *remoteQuery) Exec(ctx context.Context) *promql.Result {
}

if warn := msg.GetWarnings(); warn != "" {
return &promql.Result{Err: errors.New(warn)}
warnings = append(warnings, errors.New(warn))
continue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I am wondering if things need to change since remote engine (can be any implementation) might return both warning and results the same time? Can we safely ignore the results?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, it seems like either way we'd skip to the next iteration couple lines below if there are no series?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we can only have either a warning or a series in a response, at least that's how I understand the oneOf clause in the proto:

message QueryResponse {
oneof result {
/// warnings are additional messages coming from the PromQL engine.
string warnings = 1;
/// timeseries is one series from the result of the executed query.
prometheus_copy.TimeSeries timeseries = 2;
}
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I didn't realize it's oneof field, then this makes sense, thanks 👍

Copy link
Contributor

@yeya24 yeya24 Aug 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the proto def in Thanos, right? It is defined by us.
For the Prometheus query api itself, it can return both warning and results the same time?
I wonder if this oneof makes sense or not. At least from what I understand Prometheus query api can have both fields set in the response

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the remote engine talks to our grpc API, and that one will send warnings in separate messages even if the result contains series data: https://github.com/thanos-io/thanos/blob/main/pkg/api/query/grpc.go#L131-L135.

We don't have a remote engine to query HTTP endpoints yet. If we decide to add it, we would need to handle cases where warnings and series are sent in the same response.

Copy link
Collaborator

@matej-g matej-g left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good minus the comment from @yeya24 👍

@GiedriusS GiedriusS merged commit 180c573 into thanos-io:main Aug 18, 2023
harsh-ps-2003 pushed a commit to harsh-ps-2003/thanos that referenced this pull request Aug 22, 2023
The remote engine implementation currently converts warnings to errors.
This prevents using partial response with the distributed engine since every
warning will cause a query to fail.

Signed-off-by: Filip Petkovski <[email protected]>
coleenquadros pushed a commit to coleenquadros/thanos that referenced this pull request Sep 18, 2023
The remote engine implementation currently converts warnings to errors.
This prevents using partial response with the distributed engine since every
warning will cause a query to fail.

Signed-off-by: Filip Petkovski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants