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

avg_over_time might trigger aggregation operator '"sum"' without grouping error at specified intervals #13287

Open
ghost opened this issue Jun 21, 2024 · 2 comments
Assignees
Labels
type/bug Somehing is not working as expected

Comments

@ghost
Copy link

ghost commented Jun 21, 2024

Describe the bug
Running avg_over_time query fails when run against certain intervals of time
Other functions _over_time seem to behave properly without failing.
The job does not need to exist, no data is needed to reproduce the error. The problem is independent of the producer, collector or log format.

To Reproduce
Steps to reproduce the behavior:

  1. Run avg_over_time({job="nojob/nojob"} | json | keep http_route, response_time | unwrap response_time [$__auto])
  2. Alternative query from @slim-bean that exhibits the same behaviour
    avg by (http_route) (avg_over_time({job="nojob/nojob"} |json | keep http_route, response_time | unwrap response_time [$__auto]))
  3. Use Grafana UI and set a range of time last 5 min, get empty (or values)
{
  "queries": [
    {
      "refId": "A",
      "expr": "avg_over_time({job=\"pi-logs-custom3/pi-logs-custom3\"} |json | keep http_route, response_time | unwrap response_time [$__auto])",
      "queryType": "range",
      "datasource": {
        "type": "loki",
        "uid": "grafanacloud-logs"
      },
      "editorMode": "code",
      "legendFormat": "",
      "datasourceId": 7,
      "intervalMs": 200,
      "maxDataPoints": 1343
    }
  ],
  "from": "1719009561800",
  "to": "1719009861802"
}
  1. Use Grafana UI and set a range of time last 6 hours, get 500 error aggregation operator '"sum"' without grouping
    Payload:
{
  "queries": [
    {
      "refId": "A",
      "expr": "avg_over_time({job=\"pi-logs-custom3/pi-logs-custom3\"} |json | keep http_route, response_time | unwrap response_time [$__auto])",
      "queryType": "range",
      "datasource": {
        "type": "loki",
        "uid": "grafanacloud-logs"
      },
      "editorMode": "code",
      "legendFormat": "",
      "datasourceId": 7,
      "intervalMs": 15000,
      "maxDataPoints": 1343
    }
  ],
  "from": "1718988150000",
  "to": "1719009750941"
}
{
    "results": {
        "A": {
            "error": "aggregation operator '\"sum\"' without grouping",
            "errorSource": "downstream",
            "status": 500
        }
    }
}

Expected behavior
I expect values being returned, or empty if no data is found

Environment:

  • Grafana Cloud
  • Grafana Cloud Loki

Screenshots, Promtail config, or terminal output
n/a

@ghost ghost assigned slim-bean Jun 21, 2024
@JStickler JStickler added the type/bug Somehing is not working as expected label Jun 24, 2024
@ghost
Copy link
Author

ghost commented Jun 25, 2024

Related #12176

@Kamilcuk
Copy link

Hi. I hit the same error. As for now, just adding avg_over_time(....) by (this, list, of, labels) solved the problem for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Somehing is not working as expected
Projects
None yet
Development

No branches or pull requests

3 participants