Skip to content

Pass Request to DecodeResponse in case it is required. #1892

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

Merged
merged 2 commits into from
Dec 11, 2019

Conversation

cyriltovena
Copy link
Contributor

Loki has the concept of log Direction which is essential to know when
merging responses. This change allows Loki to inject the direction in the
response which can be then used when merging multiple responses.

Cortex doesn't need to use this.

Signed-off-by: Cyril Tovena [email protected]

Loki has the concept of log Direction which is essential to know when
merging responses. This change allows Loki to inject the direction in the
response which can be then used when merging multiple responses.

Signed-off-by: Cyril Tovena <[email protected]>
Copy link
Contributor

@jtlisi jtlisi left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@pracucci pracucci left a comment

Choose a reason for hiding this comment

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

LGTM! I just left a minor comment.

@@ -198,7 +198,7 @@ func (prometheusCodec) EncodeRequest(ctx context.Context, r Request) (*http.Requ
return req.WithContext(ctx), nil
}

func (prometheusCodec) DecodeResponse(ctx context.Context, r *http.Response) (Response, error) {
func (prometheusCodec) DecodeResponse(ctx context.Context, r *http.Response, _ Request) (Response, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest to add a comment to this function, explaining why we have _ Request, otherwise there's the risk we'll clean it up in the future because considered dead code.

Copy link
Contributor Author

@cyriltovena cyriltovena Dec 11, 2019

Choose a reason for hiding this comment

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

I added a note, but on the interface, I don't think here it matters.

Copy link
Contributor

@gouthamve gouthamve left a comment

Choose a reason for hiding this comment

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

LGTM thanks!

@gouthamve gouthamve merged commit 48122ac into cortexproject:master Dec 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants