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

UI bug when query returns nothing for creating new Alert (Unified Alerting 9.2.3) #281

Closed
AlexeiZenin opened this issue Jan 18, 2023 · 7 comments
Assignees

Comments

@AlexeiZenin
Copy link

Describe the bug
Get an error page in the Grafana UI when trying to create an alert on a time series which returns no results from clickhouse.

Versions
Grafana 9.3.2 and Plugin version 2.0.3

Query
Errors in the last X minutes

SELECT toStartOfInterval(timestamp, INTERVAL 20 second) as time, serviceName, count(*) as numErrors
FROM x.x
WHERE serviceName = 'x' AND $__timeFilter(timestamp) AND hasError = true
AND responseStatusCode != '' AND toInt16(responseStatusCode) >= 500
GROUP BY time, serviceName
ORDER BY time

To Reproduce
Create a time series which returns no data in the alert panel, and click Run Query a few times until you get the error page. See screenshots

Expected behavior
Should not error out as time series should not always be expected to return a value and return some default set of values we can use with Alerting. When the time series has data (their are errors within whatever time period, it doesn't error out)

Screenshots
After clicking on Run Query the 1st time:
Screen Shot 2023-01-18 at 12 01 43 PM
After clicking on Run Query the 2nd time:
Screen Shot 2023-01-18 at 12 00 37 PM
Screen Shot 2023-01-18 at 12 00 49 PM

@mshustov mshustov added the type/bug Something isn't working label Jan 25, 2023
@bossinc
Copy link
Collaborator

bossinc commented Feb 1, 2023

Hello, I believe you can only return numeric values. Try removing serviceName from your example and see if you get the same issue. 🙂

@bossinc
Copy link
Collaborator

bossinc commented Feb 15, 2023

@AlexeiZenin did removing serviceName resolve this or is there still an issue?

@AlexeiZenin
Copy link
Author

@AlexeiZenin did removing serviceName resolve this or is there still an issue?

I didn't try this but for my requirements I need to keep serviceName to have the query use that as the label value for the alert so I can easily query for alerts for certain services.

According to the docs it should still work correct? https://grafana.com/grafana/plugins/grafana-clickhouse-datasource/

To create multi-line time series, the query must return at least 3 fields in the following order:

field 1: datetime field with an alias of time
field 2: value to group by
field 3+: the metric values

@AlexeiZenin
Copy link
Author

AlexeiZenin commented Feb 16, 2023

My workaround was to do some ugly unions on a default row (WITH clause) when no errors were there where I would create a time series with 1 row with value 0

@bossinc
Copy link
Collaborator

bossinc commented Mar 17, 2023

This seems related to #207 I am looking into this more. Thank you for the update @AlexeiZenin

@bossinc
Copy link
Collaborator

bossinc commented Mar 31, 2023

We are still aware of this issue. I'll have time to look into this next week. I'll have an update then 🙂

@bossinc bossinc self-assigned this Apr 27, 2023
@bossinc
Copy link
Collaborator

bossinc commented Apr 28, 2023

@AlexeiZenin this issue is fixed as of Grafana v9.5.1 😄
Please reopen if you have more questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

4 participants