Alerts: strange 'pending' state changes

Hi,

I use Grafana v6.1.4, and I setup an alert on an OpenTSDB data source. Because transient false alarms are possible (something a bit specific to how OpenTSDB does queries, aggregation and interpolation), I thought I’d give a try to the ‘for’ alert feature which on paper would do the trick nicely. However I see some weirdness around this…

An example, with a timeseries that only updates every few minutes (e.g. every 5m). The values can be 1 if it’s OK, 0 if there is an issue:

The alert condition is ‘when last() of query(A,15m,now) is below 0.49’, evaluated every 60s for 3m:

You can see many transitions from ‘pending’ to OK, whereas I would expect a single transition to Pending, then go to Alert (we had a 0 for over 3 minutes), and quickly go back to OK (we have a 1 for minutes after the 0).
Any idea why Grafana behaves differently than I expect? Have I misunderstood something, or does it look like a bug?

Thanks,
Thibault

ps: I didn’t see any change that could be related to that behaviour issue in the changelog between 6.1.4 and the latest.