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

Alerting: No Data should take "For" setting into account #16290

Open
azhiltsov opened this issue Mar 29, 2019 · 11 comments
Open

Alerting: No Data should take "For" setting into account #16290

azhiltsov opened this issue Mar 29, 2019 · 11 comments
Labels
area/alerting Grafana Alerting area/backend prio/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough interest in it. prio/unscheduled type/bug

Comments

@azhiltsov
Copy link
Contributor

What happened:
Alert notification send immediately after "No Data" condition
What you expected to happen:
Alert notification should be delayed the same way as for "Alerting" condition obeying "For" setting
How to reproduce it (as minimally and precisely as possible):
Create alert rule
set 'If no data or all values are null' to "No Data"
set For "5m"
simulate "No Data" condition from the data-source side
Receive notification immediately

Anything else we need to know?:

Environment:

  • Grafana version:
    5.4.3
  • Data source type & version:
    carbonapi (graphite 0.12 compatible)
  • OS Grafana is installed on:
    Linux Centos 7
  • User OS & Browser:
  • Grafana plugins:
  • Others:
@azhiltsov azhiltsov changed the title Bo Data state ignores Alert Config For setting "No Data" state ignores Alert Config "For" setting Mar 29, 2019
@torkelo torkelo added type/bug area/alerting Grafana Alerting area/backend prio/high Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Mar 29, 2019
@bergquist bergquist added this to the 6.3 milestone May 2, 2019
@bergquist bergquist self-assigned this May 2, 2019
@torkelo torkelo added this to Inbox in Backend Platform Backlog via automation Jun 26, 2019
@torkelo torkelo modified the milestones: 6.3.0-beta1, 6.4 Jun 26, 2019
@torkelo torkelo moved this from Inbox to Done in Backend Platform Backlog Jun 26, 2019
@torkelo torkelo moved this from Done to In progress in Backend Platform Backlog Jun 26, 2019
@torkelo torkelo moved this from In progress to Done in Backend Platform Backlog Jun 26, 2019
@torkelo torkelo moved this from Done to Inbox in Backend Platform Backlog Jun 26, 2019
@marefr marefr moved this from To do to Bugs & Investigations in Backend Platform Backlog Jul 3, 2019
@marefr marefr moved this from Bugs & Investigations to To do in Backend Platform Backlog Jul 3, 2019
@marefr marefr moved this from To do to Bugs & Investigations in Backend Platform Backlog Jul 11, 2019
@kylebrandt kylebrandt assigned kylebrandt and unassigned bergquist Jul 12, 2019
@kylebrandt kylebrandt moved this from Bugs & Investigations to In progress in Backend Platform Backlog Jul 15, 2019
@kylebrandt
Copy link
Contributor

kylebrandt commented Jul 15, 2019

I think the logic in pkg/services/alerting/eval_context.go > GetNewState() / getNewStateInternal() needs to change. GetNewState() will return on a no_data since it is no AlertStateAlerting , and this happens before the For logic could determine AlertStatePending.

@marefr marefr added type/feature-request prio/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough interest in it. and removed type/bug prio/high Must be staffed and worked on either currently, or very soon, ideally in time for the next release. labels Aug 14, 2019
@marefr marefr removed this from the 6.4 milestone Aug 14, 2019
@marefr marefr changed the title "No Data" state ignores Alert Config "For" setting Alerting: No Data should take "For" setting into account Aug 14, 2019
@marefr
Copy link
Member

marefr commented Aug 14, 2019

Re-labeled this as a feature request since the For feature was not built with No Data in mind.

@marefr marefr removed this from In progress in Backend Platform Backlog Aug 26, 2019
@patricktokeeffe
Copy link
Contributor

In current releases (e.g. 6.4.3), the default alert rule contains both

  • For: 5m
  • and If no data or all values or all → No Data

At the same time, documentation notes:

Do not use For with the If no data or all values are null setting set to No Data. The triggering of No Data will trigger instantly and not take For into consideration. This may also result in that an OK notification not being sent if alert transitions from No Data -> Pending -> OK.

Because 'No data' is about handling errors for a rule and "For" applies to the rule evaluation (not the conditions/query), I think the type/bug label was appropriate.

@marefr
Copy link
Member

marefr commented Oct 22, 2019

@patricktokeeffe thanks. I agree and your comment make sense. Changed to bug.

@saiful-wartek
Copy link

As this issue is marked with prio/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough interest in it. , we want to report that we are also impacted with this issue on Grafana 8.5.21.

This is how our alert is configured:

image

The State History panel showed us this history:

image

As you can see, on Mar 14, 2023 15:53:42, the alert transitioned into OK state, but on Mar 14, 2023 15:55:40 the alert transitioned into No Data. As the "For" field is set to 5 minutes, the notification should not be sent immediately, but in reality it was sent immediately.

Happy to provide more details if that helps this issue moving through!

@justfortherec
Copy link

There has not been any progress on this issue for a few years and releases now. Is there any way how this could be put on the agenda again? Or do you recommend looking for workarounds and alternatives?

@JacobsonMT
Copy link
Member

Hi @justfortherec, there's been a bit of progress here as of late. Grafana Alerting rules with NoDataState configuration set to Alerting will now respect "For" duration (See PR). The other parts of this issue are being tracked here: #55320

@Martchus
Copy link

We see the same issue on our instance - except that it happens with DatasourceError. Strangely, it worked at some point and only ceased to work recently. When it worked and when it ceased to work we were using version 9.4.7. Switching to 9.5.1 didn't help. We've been using the new alerting system for a while now. Just for additional context, that's the issue we're tracking this on our side: https://progress.opensuse.org/issues/128870

@manojm321
Copy link

I see a similar issue with 10.1.1

Screenshot from 2023-10-16 11-22-49

Alert settings:

image

For is set to 5min and eval to 1m

Documentation states:

Alert rules that are configured to fire when an evaluation returns no 
data or error only fire when the entire duration of the evaluation 
period has finished. This means that rather than immediately firing when
 the alert rule condition is breached, the alert rule waits until the 
time set as the For field has finished and then fires, reducing alert noise and allowing for temporary data availability issues.

But from he logs it's clear it fire immediately on error without waiting for 5min.

04:25:06 state=Normal
04:26:08 DataSourceError
04:26:08 Sending alert..

@jdverman
Copy link

jdverman commented Nov 2, 2023

We experience the same issue with AWS managed Grafana 9.4: DatasourceNoData immediately sending an alert instead of waiting for the 5 minute evaluation period. Please look into this!

@KaplanSarah
Copy link

The new 'Keep Last State' option as of 10.4 will respect the 'for' period.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/alerting Grafana Alerting area/backend prio/awaiting-more-evidence Lowest priority. Possibly useful, but not yet enough interest in it. prio/unscheduled type/bug
Projects
Status: Needs triage
Development

No branches or pull requests