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

[Bug] Summarizing on empty data should not return an error #871

Open
hyamanieu opened this issue Jun 6, 2024 · 1 comment
Open

[Bug] Summarizing on empty data should not return an error #871

hyamanieu opened this issue Jun 6, 2024 · 1 comment

Comments

@hyamanieu
Copy link

Describe the bug

Whether summarizing or not summarizing, if input is empty, it should return an empty value rather than throwing an error.
According to me, whether we:

  • receive an input with several elements, but all element do not pass the set Filter
  • or receive an input with no element
  • or receive an input with no element, while not using the summarizing function

the same result shall be received: an empty Table.

This is important as we cannot know in advance if our API call will return an array with 0 or several elements. It also impacts the use within alerts.

Steps to reproduce

  • Source: Inline
  • Summarize: sum(value)
  • Summarize by: group
  • Filter : value > 100
  • data: []

Result:

error getting data frame from inline data. summarize by field not found. Not applying summarize

I would expect the same result as follows:

  • Source: inline
  • Summarize: sum(value)
  • Summarize by: group
  • Filter : value > 100
  • data :
[
  {
    "group": "A",
    "id": 1,
    "value": 42
  },
  {
    "group": "B",
    "id": 2,
    "value": 37
  },
  {
    "group": "A",
    "id": 3,
    "value": 28
  },
  {
    "group": "C",
    "id": 4,
    "value": 53
  },
  {
    "group": "B",
    "id": 5,
    "value": 19
  },
  {
    "group": "C",
    "id": 6,
    "value": 45
  },
  {
    "group": "A",
    "id": 7,
    "value": 32
  },
  {
    "group": "B",
    "id": 8,
    "value": 29
  },
  {
    "group": "C",
    "id": 9,
    "value": 61
  }
]

Result: <0 series returned> (aka empty table)

or for

  • Source: Inline
  • Filter : value > 100
  • data: []

Result: <0 series returned> (aka empty table)

Version Details:

  • Grafana version : 10.4.1
  • Plugin version : 0.7.1
@digitalkristurner
Copy link

I have also had this issue and it trips me up often!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants