stephenyeargin / hubot-grafana

📈🤖 Query Grafana dashboards
http://docs.grafana.org/tutorials/hubot_howto/
MIT License
154 stars 48 forks source link

hubot-grafana does not work for Grafana 8 #138

Closed superbrothers closed 3 years ago

superbrothers commented 3 years ago

In Grafana 8, GET /dashboards/db/:slug has been removed. hubot-grafana has used that API endpoint, so it does not work for Grafana 8 :cry:

https://github.com/stephenyeargin/hubot-grafana/blob/1f94916ad152a59c74cba4f9d9e894b2f3c28e88/src/grafana.coffee#L185-L187

imyuliz commented 3 years ago

me too,

imyuliz commented 3 years ago

slug deprecated in Grafana v5.0, https://grafana.com/docs/grafana/latest/http_api/dashboard/

What should we do

superbrothers commented 3 years ago

I have created a patch to support Grafana 8. This patch may not be compatible with older Grafana, so it will be difficult to merge this in.

stephenyeargin commented 3 years ago

/cc #68

So with this change, what should the user interaction expectation be for working with a specific dashboard? Can we no longer have a command that shorthands it out to !graf db my-great-dashboard instead of !graf db d3adbe3f?

stephenyeargin commented 3 years ago

Reviewing the search API, I don't see a way to guarantee that we always return a single dashboard if we were to try and transform an existing user-friendly URI. It seems like a lot to ask for folks to learn a nine-character, case-sensitive UID to pull up their dashboard.

I see a handful of ways forward:

  1. Declare that this Hubot package supports only Grafana 7.x and below, effectively sun-setting this project (I don't like this option)
  2. Release v3.0.0 that merges @superbrothers's branch with instructions for users of < 8 to remain on the 2.x release
  3. Add an environment variable that enables Grafana 8 support (switch statement on how to query/return data). This allows folks to opt-in, but requires a manual step.
  4. Continue seeing if there's a way to handle the changes "under the hood" using the Search API in an attempt mitigate changes in user space

/cc @torkelo if you'd like to weigh in.

superbrothers commented 3 years ago
  1. Release v3.0.0 that merges @superbrothers branch with instructions for users of < 8 to remain on the 2.x release

I think this is the better way.

stephenyeargin commented 3 years ago

Making a note that the test coverage is rather extensive for this package. I started the process of updating it, but it will take a few sessions to get it all done.