K-Phoen / backstage-plugin-grafana

Grafana plugin for Backstage
Apache License 2.0
53 stars 28 forks source link

Support multiple tags + AND/OR behavior #50

Closed arnouthoebreckx closed 1 year ago

arnouthoebreckx commented 1 year ago

Hi,

We would like to set multiple dashboards + some generic ones on each of our components, this would require us to use multiple tags that act as OR to display these dashboards that use different tags.

e.g.

genericdash1 with tags: generic
genericdash2 with tags: generic
specificAdash with tags: specificA
specificBdash with tags: specificB

For component specificA and component specificB we would like to display their own dashboard with corresponding tag but also the generic one. Instead of adding the specific[A-Z] tag to the generic dashboards, I would suggest adding some extra logic to handle a list of tags as an OR operation to display multiple dashboards.

We can also use this suggestion to allow the declaration of multiple tags e.g. /api/search?tag=app&tag=specificA that by default works in an AND way in the Grafana API.

Simple suggestion as example but could definitely use feedback:

grafana/tag-selector: "specificA, generic"
grafana/method: "OR"
arnouthoebreckx commented 1 year ago

Pull request already open for this feature

jobosk commented 1 year ago

I would love to see this feature happen. If anything, I'd write that within the same annotation, like:

(tagA or tagB) and tagC

Maybe...

(tagA | tagB) & tagC

... with "," being translated as "and"/"&" by default.

But anyway, thanks @ivangonzalezacuna for the great work!

jobosk commented 1 year ago

I did what I requested :P @K-Phoen would you be kind enough to review my PR and consider its aproval?