Skip to content

QueryFrontend error cannot be parsed correctly in Grafana #5324

Closed
@yeya24

Description

@yeya24

Describe the bug
When query frontend throws error, Grafana will show error message like below.

readObjectStart: expect { or n, but found z, error found in #1 byte of ...|zero or neg|..., bigger context ...|zero or negative query resolution step widths are n|...

This is not very readable and not user friendly. The issue is that Grafana expects errors to be returned with Prometheus' Error format. However, query frontend doesn't format error using the Prometheus error response format, it just returns the raw error string like https://github.com/cortexproject/cortex/blob/master/pkg/querier/tripperware/queryrange/query_range.go#L183.

{
  "status": "success" | "error",
  "data": <data>,

  // Only set if status is "error". The data field may still hold
  // additional data.
  "errorType": "<string>",
  "error": "<string>",

  // Only if there were warnings while executing the request.
  // There will still be data in the data field.
  "warnings": ["<string>"]
}

Same issue happened at past as well, like #5260. Now we always forwards the request to querier to return error and this is very inefficient. Also there are errors happened in QueryFrontend only and returning to querier won't work.

We should format the error response correctly in query frontend, like Prometheus does.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions