VolkovLabs / business-satellite

The Business Satellite data source for Grafana allows retrieving data from local and remote Grafana instances via HTTP API.
https://docs.volkovlabs.io
Apache License 2.0
12 stars 2 forks source link

Grafana HTTP API not loading Alerts/Annotations correctly #38

Closed centenico closed 1 year ago

centenico commented 1 year ago

Good morning, I'm having some issue displaying all my Grafana alerts/annotations correctly with the Grafana HTTP API data source. I've installed it and connected it with my token correctly, and in fact some of the panel (the two showing the infos/health status) work correctly, but the Annotations panel doesn't seems to be working and give me the following error:

image

What could be possibly causing this error?

Grafana HTTP API version: 1.2.0 Grafana version: 9.3.8 Main Data-source: Prometheus

image

Thanks a lot!

mikhail-vl commented 1 year ago

@centenico Are you using Unified Alerting? Do you use a token with Viewer, Editor, or Admin permissions?

The Alert rules endpoint is used to get an Alert UID. If it's not found, then it's not a unified alerting or permissions issue. I will take a look to see which one is it and will handle it.

centenico commented 1 year ago

Hi @mikhail-vl thanks for answering, I'm using a token with Editor permissions, but I've also tried with Admin. I think that yes, I'm using Unified Alerting but I'll leave you a bunch of screenshots and configurations to give you the most possible informations about my system/alert setup. Hope that'll be useful.

I've also tried logging the alerts via one apachEcharts with the following line: console.log(data.annotations); which returns an empty array.

image image

centenico commented 1 year ago

@mikhail-vl Hi, I seems to have solved my issue.

Problem being I had Grafana 9.3.8 whereby I needed some API which your component was calling that were introduced in Grafana 9.4.0.

Thanks a lot for your help anyway, it's always a pleasure working with your products for Grafana! Have a good day.

mikhail-vl commented 1 year ago

@centenico Thank you for confirming, then it makes sense to handle the not found error for the older versions.

mikhail-vl commented 1 year ago

@centenico I Appreciate the help. I added Exception Handling for the Alert Rules to support older versions of Grafana and removed Admin/Editor restrictions to retrieve Annotations.

Now Viewer permissions are enough, but you won't see the Alert name or UID. You can download the latest CI artifact to test before the official release: https://github.com/VolkovLabs/volkovlabs-grapi-datasource/actions/workflows/ci.yml