How to build individual plugins

I do some change on Graph plugin. Could I just build the graph plugin . and then deploy the plugin on directory ‘/usr/local/var/lib/grafana/plugins’ , so I can use the modifyed plugin and share the plugin to others.

how to do it? thank you.

Not sure what you want to achieve, but assuming that you want to have your development work to be reflected in the locally running Grafana instance…

Simply put a symbolic link in the Grafana plugin directory to the $PLUGIN_ROOT/dist, which in your case seems to be something like;

# current directory is the plugin development directory
ln -s `pwd`/dist /usr/local/var/lib/grafana/plugins

(The /usr/local/var/lib/grafana/plugins is not the recommended location, but I assume this stems from a non-package-manager installation.)

Once Grafana is restarted, the plugin should show up. I also have a permanent habit of restarting (which is super quick) Grafana after each change.

thank you for your answer. My english is poor. so I can not exactly say what I want , but I will try my best.

after execute yarn build , generate some files located under ‘/public/build’ directory.
those files seems can not use as plugins.

How to generate the /dist directory ? which command should I execute.

Why are we looking inside grafana/grafana at all?

You don’t add plugins inside Grafana source directory, but in separate project/repository. See the Grafana Tookit for setting up a skeleton plugin. grafana/packages/grafana-toolkit at main · grafana/grafana · GitHub

If you want to build and or run Grafana from its sources, then do

make build

for building the distribution, or

make run

to start Grafana directly “in-place” of the sources.

And for the latter, add a symbolic link (as described before) in the GRAFANA/data/plugins directory to your dist/ directory of the plugin you are developing (if any).

Hope that helps.
Niclas

@aa125791202 what you’re trying to do seems similar to this other question from a couple of days ago: Custom Prometheus data source plugin. Maybe that discussion is helpful. In summary, I don’t think there’s an easy way to “break out” the existing graph plug-in (though would be interested in learning about one?)

For now, probably best to follow @niclash’s recommendation to start from a fresh example plugin

In my company , we use grafana to display some datas on TV.

For convenience ,we want graph automatic change metrics several seconds .

I’ve implement the function .

1). I add ‘auto play’ option for graph legend . If it is checked, the graph will has the automatic change metrics function . If it is unchecked, the graph will not has the function.
2). ‘play’ button is clicked will launch the function.
3). ‘pause’ button is clicked will pause the function.

The following two pictures show that ,a panel’s(in the red frame) ‘auto play’ option is checked in the dashboard, launch the automatic change metrics function .

I’ve implement the function ,but I don’t know how to generate the modified graph plugin. If I can build the modified graph plugin. Other team could use it easily. Just put it locate under ‘/usr/local/var/lib/grafana/plugins’ directory.

how to generate the modified graph plugin ?