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
Loki: Improve handling of empty responses #52397
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
// it's hard to say if this is an error-case or not. | ||
// we know the http-response was a success-response | ||
// (otherwise we wouldn't be here in the code), | ||
// so we will go with a success, with no data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the comment. However, since this seems like a rare occasion, should we add some logging here? But I am also fine without it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm.. i'd say let's go without logging for now. i'm planning to add some way to record this strange response in a separate PR.
(cherry picked from commit 46eec85)
helps with #52046
the loki http response parser calls
converter.ReadPrometheusStyleResult
(https://github.com/grafana/grafana/blob/main/pkg/util/converter/prom.go#L27), which can return a nil-pointer. the loki code did not handle this case.the linked github-issue describes such a situation.
this pull-request adds code to handle the nil-pointer case.
how to test:
(NOTE: this will not resolve the reported issue (why are we not getting back any data for the log-volume-query), but we should handle the nil-pointer-case.