fr-ser / grafana-sqlite-datasource

Grafana Plugin to enable SQLite as a Datasource
Apache License 2.0
124 stars 17 forks source link

Grafana Alerts for SQLite datasource seems to be broken #49

Closed droidbuzz closed 3 years ago

droidbuzz commented 3 years ago

Describe the bug Trying to setup alerts for Graph Panel (SQLite Datasource). But the alerting seems to be broken for this plugin - Test alerts are failing with following error:

tsdb.HandleRequest() error rpc error: code = Unavailable desc = connection error: desc = \"transport: error while dialing: dial unix /tmp/plugin124935319: connect: connection refused\"

Tried with multiple Notification Channels (Email/PagerDuty/AlertManager) - faced same issue with all.

Note: Tried generating test alert using other Datasources (non-SQLite), seems to be working fine. So the issue is only limited to this particular plugin.

To Reproduce Steps to reproduce the behavior:

  1. Go to Graph Panel
  2. Generate a Time-series Graph using SQLite Datasource
  3. Edit Panel -> Go to "Alert" Tab
  4. Specify a condition which would trigger an alert.
  5. Click on "Test Rule".

Additional context I was going through the change log - looks like Alerting is enabled/supported for this plugin/datasource since V1.0.1. Wondering if anyone was able to actually generate the alerts - let me know. Thanks.

fr-ser commented 3 years ago

I am looking into it. I already found one bug, which is related to the handling of empty query results for time-series data. This can happen often for alerting. (see https://github.com/fr-ser/grafana-sqlite-datasource/commit/e14a4abf247d1488397bb55c09ab94d21fec4130)

Another bug seems to be related to somehow not updating the query from the default value. This should also make the alerting feature brittle and I am currently investigating that one.

fr-ser commented 3 years ago

@droidbuzz would you care to try if the issue is fixed with https://github.com/fr-ser/grafana-sqlite-datasource/releases/tag/v2.0.1-rc.1 ?

In theory that should do the trick. I will test around a bit in the following days and see if it works as I expect it. If you could test it for your use case, however, that would certainly help as well.

droidbuzz commented 3 years ago

Sure thing - I'll test it over the weekend and report back.

Thanks again for such a quick turnaround - this plugin has been a lifesaver for me. :)

fr-ser commented 3 years ago

In this implementation (not sure if I'll stick with that one) I support two variables. All other variables are not supported, however, including custom ones. A bit more info here: https://github.com/fr-ser/grafana-sqlite-datasource/tree/alerting_bug#alerting

I am wondering, though, if I will replace the variables with using a timeFilter macro 🤔

fr-ser commented 3 years ago

I released the current release candidate without code changes as v2.0.1. It will take a while for this version to be available via the Grafana-CLI but I would consider the bug closed for now unless I hear something else 🤷🏻