Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Grafana Library Panels #218

Closed

Conversation

malcolmholmes
Copy link
Collaborator

Adds support for Grafana library panels to Grizzly.

Also starts a transition to using the Golang client for Grafana. When
Grizzly was started, this was not sufficiently mature. This is no longer
the case. A transition to the golang client should reduce the amount
of code required in Grizzly.

@CLAassistant
Copy link

CLAassistant commented Jul 5, 2022

CLA assistant check
All committers have signed the CLA.

Copy link

@hsyed-dojo hsyed-dojo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

type LibraryPanelHandler struct {
Provider Provider
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: a type assertion here would be nice to assert that LibraryPanelHandler conforms to grizzly.Handler.

@ccjones88
Copy link

ccjones88 commented Sep 21, 2022

So I pulled this down locally to try it out and I'm kind of caught in this catch 22 of both dashboards using the library panel and the library panel itself saying that it cannot be found.

Steps for reproducing:

  1. Have two dashboards sharing 1 or more library panels
  2. grr pull library panels/dashboards ( I myself am using grr pull -d resources -t "LibraryPanel/*" -t "Dashboard/*" -l debug )
  3. Next grr apply to a Grafana instance that does not have those dashboards/library panels already existing. I've tried quite a few different ways here:
  • grr apply -d resources -t "Dashboard/*" -t "LibraryPanel/*" -l debug
  • grr apply -d resources -t "LibraryPanel/*" -t "Dashboard/*" -l debug
  • grr apply -d resources -t "LibraryPanel/SpecificUID" -l debug
  • grr apply -d resources -t "Dashboard/SpecificUID" -l debug
  • grr apply -d resources -t "LibraryPanel/SpecificUID" -t "Dashboard/SpecificUID" -l debug

Dashboard apply always ends up with {"message":"Error while connecting library panels"}
LibraryPanel apply has {"message":"library element could not be found"}
Server Side logs show level=error msg="Error while connecting library panels" error="library element could not be found" corresponding to grr apply for the Dashboard and level=error msg="library element could not be found" error="library element could not be found" corresponding to grr apply for Library Panels

My guess would be that, when trying to grr apply -d resources -t "LibraryPanel/*" it goes to get the remote value and then doesn't handle the value not existing and just has a fatal err. When ideally, it would handle it like dashboards and say LibrayPanel.UniqueID was not found, adding it...

I'm hoping I'm just missing something obvious, but figured it'd be beneficial to let you all know now before it's merged in case there is a further bug here. Let me know if I can add any more info.

Grafana v9.1.5
grr version dev-v0.2.0-1-g5f400a8-dirty

@dsotirakis dsotirakis removed their request for review December 13, 2022 09:28
theSuess added a commit that referenced this pull request Dec 14, 2023
This is a reimplementation/follow up to
#218, using the openapi client to keep in
line with the rest of the codebase. It allows pull & push of library panels and
variables.

Tested pull & push with a simple library panel and a dashboard using this panel
theSuess added a commit that referenced this pull request Dec 18, 2023
This is a reimplementation/follow up to
#218, using the openapi client to keep in
line with the rest of the codebase. It allows pull & push of library panels and
variables.

Tested pull & push with a simple library panel and a dashboard using this panel
julienduchesne pushed a commit that referenced this pull request Dec 20, 2023
* feat: add support for library elements

This is a reimplementation/follow up to
#218, using the openapi client to keep in
line with the rest of the codebase. It allows pull & push of library panels and
variables.

Tested pull & push with a simple library panel and a dashboard using this panel

* fix: correctly order handlers
@theSuess
Copy link
Member

Resolved in #282

@theSuess theSuess closed this Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants