Hi I want to make custom data source similar to the MYSQL datasource so I decided making a copy of the MYSQL plugin and calling it testplugin would be a good place to start. I changed the name and id both to testplugin in the plugin.json and testplugin appeared in the dropdown for data sources. However if I select it, it says module.ts not found.
However the module.ts file is there where it should be, except grafana isn’t recognizing it.
This led me to believe that grafana might be ignoring all the scripts in the plugins folders after it has been installed. Is this true? If so how do I go about testing custom datasource plugins? Do I need to rebuild grafana everytime I edit a plugin? How would I do that? Help would be appreciated as I am new to grafana plugin dev
Thanks in advance!
In case anyone stumbles on this again, you can’t edit the preinstalled default datasources directly. You’ll have to copy it to the directory for custom datasources and compile it with grunt for it to actually be read by grafana
Did you manage to get a working datasource plugin using this method? Were there additional modifications you had to make to the source code you copied over to make it work? I’m trying to do the same thing, but starting from the InfluxDB datasource instead of MySQL. As a first step, I just want to make an exact copy and load it as a plugin and make sure everything still works as designed before I start making modifications. But I’ve had a lot of trouble doing even that. It seems like the datasources that ship with Grafana are using features/dependencies that aren’t available to plugins. What has been your experience?
As far as I know, all the default datasources including InfluxDB are written in typescript. To compile a typescript plugin, you need different dependencies than a javascript plugin. Either try using the Gruntfile and package.json from this https://github.com/grafana/typescript-template-datasource
or try renaming the files as .js instead of .ts and edit the syntax to make it js appropriate. This is usually easy as I’ve only needed to change the variable declaration syntax from the typescript way to the javascript way and it usually worked for me. Hope this helps