simPod / GrafanaJsonDatasource

Grafana datasource to load JSON data over your arbitrary HTTP backend
https://grafana.com/grafana/plugins/simpod-json-datasource/
MIT License
355 stars 72 forks source link

Add alerting support #630

Closed pcolladosoto closed 3 weeks ago

pcolladosoto commented 2 months ago

Hi @simPod! As seen on #34 there was some interest in having alerting support for the plugin.

I'm currently working on developing an OSS plugin for MongoDB databases and decided to base it off GrafanaJsonDatasource given how neat and to the point the codebase is.

In an effort to make alerting available for the soon-to-be MongoDB plugin I decided to add a full-fledged backend support to the GrafanaJsonDatasource plugin. Given how helpful it's been, the least I could do was to add this backend support before the code bases diverged so that you could integrate it into the plugin if you wanted to.

Anyhow, this PR strives to add a Go-based backend to the plugin so that it can leverage Grafana built-in goodies such as alerting. If I'm honest, the Infinity datasource plugin could be a bit overkill and, what's more, it doesn't add support for interactively building the query AFAIK.

Please bear in mind that the PR's contents are (very) rough around the edges. I just wanted to share the work before trying to transition it to something more robust to make sure you were interested. Otherwise I can just begin swapping out the HTTP-based backend for a MongoDB-based one and call it a day.

Also, please note that I have absolutely no idea about JS and the accompanying development environment. I've tried to play with it as little as possible but I do have some doubts; especially about how the ad-hoc filters can be applied.

Anyway, sorry for all the rambling and thanks for building GrafanaJsonDatasource and making it public 😄

P.D: Bear in mind some changes such as the authorship and so on have been altered thinking about the MongoDB plugin. All these changes can be revisited should a merge take place.

simPod commented 2 months ago

Hello @pcolladosoto, I'm currently on currently on kitesurfing holiday so I'll review this the next week when I get back home. I don't consider myself a Go developer but definitely can take a look. Thank you for your contribution in advance.

pcolladosoto commented 2 months ago

No worries! Have a great one! 🪁 🏄🏾

pcolladosoto commented 2 months ago

Hi @simPod! Thanks a ton for the comments and the change requests! I'll be a bit busy this week, but I didn't want to go without saying that all your suggestions are on point. Given I used this datasource plugin as a stepping stone towards a MongoDB datasource I just opened the PR before the codebase began diverging a bit more. I just wanted to make sure you were interested in the PR before honing down on the different rough edges. I'll be sure to address what you brought up plus all the other TODOs I littered here and there... Thanks again!

KrisztianKaszas commented 2 months ago

Dear @simPod, as mentioned in #34 we also planned to do the same. With a year delay, we also started in August to build a grafana backend plugin around the data source plugin, but due to some personal bottlenecks we did not get so far as @pcolladosoto yet.

Do I understand right, the plan is to add @pcolladosoto solution to 0.7.x so we can put our efforts to achieve the same task on hold?

Is there an ETA when 0.7.x will got this feature? Can we assist with this in any way?

pcolladosoto commented 2 months ago

Hi @KrisztianKaszas! My idea is to try and address the comments next week. However, I would really appreciate it if a second pair of eyes had a look at the changes: I'm sure there are many things to be improved!

Hopefully by the end of next week this PR can move into a review stage where all the changes have been migrated, hopefully making the inclusion in the plugin a reality soon.

Thanks a ton for your comment!

KrisztianKaszas commented 2 months ago

Hi @pcolladosoto, we will do a PR as well and will try to run some tests with our existing Grafana solution, that is using this great data source. If we find anything, will address them. BR!

github-actions[bot] commented 1 month ago

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 3 weeks ago

This pull request has not seen any activity since it was marked stale. Closing.