Loki: Fix null pointer exception in case request returned an error (#84398)

Loki: Fix nullpointer in case query returned an error
This commit is contained in:
Sven Grossmann
2024-03-13 18:14:21 +01:00
committed by GitHub
parent d3ef762cb9
commit 34f9bff9e0
+5
View File
@@ -240,6 +240,11 @@ func executeQuery(ctx context.Context, query *lokiQuery, req *backend.QueryDataR
defer span.End()
queryRes, err := runQuery(ctx, api, query, responseOpts, plog)
if queryRes == nil {
// we always want to return a backend.DataResponse object, even if we received just an error
queryRes = &backend.DataResponse{}
}
if err != nil {
span.RecordError(err)
span.SetStatus(codes.Error, err.Error())