Bundle panel and datasource plugin in one plugin

Hey,
I am working on a datasource and a panel plugin. They are coupled as what the datasource outputs can only be viewed with that specific panel (and with table). I wanted to bundle them together and have one plugin but it does not seem to be possible. I tried to create an empty app plugin which has a panel and a datasource includes, but it also does not seem to work. Can someone give me any direction or I have to do it in two separate plugins?

Cheers

Tamas

You should be able to bundle the plugins together as an app plugin. We’re lacking documentation for app plugins at the moment, but there’s a tutorial in progress over at:

It hasn’t been published yet, as it’s still incomplete, but it does cover your use case I believe. Let me know if you run into trouble!

Thank you for your response, I found this page and I tried to work based on what I read there. I do not have any pages or dashboards, so I left that out, also I do not have a modules.ts for the app itself. Can it cause troubles?
Because what I see is, even with defining my includes in my-app/src/plugin.json:

  "includes": [
    {
      "type": "panel",
      "name": "my-panel"
    },
    {
      "type": "datasource",
      "name": "my-datasource"
    }
  ],

having a plugin.json with datasource type in my-app/src/datasources/my-datasource
I can see grafana loads the plugin:

t=2021-01-21T16:02:38+0000 lvl=info msg="Registering plugin" logger=plugins name=my-datasource
t=2021-01-21T16:02:38+0000 lvl=dbug msg="Getting signature state of plugin" logger=plugins plugin=asd-my-datasource
t=2021-01-21T16:02:38+0000 lvl=dbug msg="Plugins: Adding route" logger=http.server route=/public/plugins/asd-my-datasource dir=/var/lib/grafana/plugins/gitlabci-pipeline-app/dist/datasources/my-datasource

but the datasource is not showing up in the add new datasource page. The panel is visible when I want to add it to a dashboard. Any idea what can go wrong? I uploaded the prototype (based on the grafana panel and datasource templates to: GitHub - kalidasya/grafana-bundle-plugin-example: test project to demonstrate how to bundle a grafana panel and a datasource)

Maybe I am missing an enabling step? The doc is not clear to me about it.

btw its a great dev friendly ecosystem, I really liked the plugin templates and the tutorials, really nicely done.

I think I have found a solution from another plugin (devopsprodigy/kubegraf) after gathering more understanding. It seems u need to export a ConfigCtrl and create a template, then it will appear in the plugins page and u can click on the enable button. I updated the reference repo, but still have no idea why certain things have to be done like that (why ConfigCtrl, do we have an interface defined somewhere?, what is postUpdate and what does it have to return with?) and if all that code is really needed to make it work. I guess the doc update will answer to those questions.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.