Package a plugin Grafana documentation

In the tutorial we have extracted a method named query to take care of each query model. Since each plugin has their own unique query model, Grafana sends it to the backend plugin as JSON. Therefore the plugin needs to Unmarshal the query model into something easier to work with.

grafana plugin development

The settings for these options are passed as parameters to the /api/events API. Real-time performance and availability monitoring for the web’s most built upon products. We believe strongly in Dogfooding at Metrist and we use the plugin ourselves on our own on prem install and find it extremely valuable when exploring a given time period or issue. We could certainly pull all the data for an investigation from our datastores but not as quickly as we can visualize and dissect it in Grafana. Based on that goal, we set out to create our own Datasource plugin with the intent of including it in the Grafana Plugin Catalog and to ensure it could also be installed in Grafana Cloud. Our plugins are enriched with JavaScript, providing you with unparalleled customization options.

Dynamic Text Panel

Grafana is an incredibly powerful platform– and our company is generating some pretty interesting data. So we wanted to create a plugin for our customers so they could start to use our data to an even fuller potential. The MetricFire services include a flexible, scalable open-source infrastructure monitoring platform that supports your current and future requirements without vendor lock-in and other limitations.

grafana plugin development

A higher resolution means more points closer together, at the cost of more data being processed. SimpleOptions is an interface that describes the options object. You can access the panel properties through props, as seen in your plugin. Before we dive deeper, let’s look at some of the properties that are shared by all of them.

Getting Your Plugin Into The Catalog

In the previous step, we had to define the width of each bar in pixels. Instead, let’s use scales from the D3 library to make the width grafana plugin development of each bar depend on the width of the panel. In the next step, we’ll see how you can take advantage of D3’s data transformations.

For more information about panels, refer to the documentation on Panels.

Data Manipulation Panel 3.1.0

If you’re using the Grafana Plugin SDK for Go to implement your backend plugin, then the Prometheus instrumentation library for Go applications is built-in. This SDK gives you Go runtime metrics and process metrics out of the box. You can use the Prometheus instrumentation library to add custom metrics to instrument your backend plugin. The health checks capability allows a backend plugin to return the status of the plugin.

  • Restart Grafana and make sure that now you have the plugin configured.
  • Ultimately, all resource requests from the QueryEditor end up at the CallResource datasource method in your backend instance as described in the post.
  • Grafana usually ships with the support for the in-built Graphite data sources.
  • You can see in the code, how to get information from the setting JSONData, remember that there are two parts to the backend data source configuration, this is the unsecured part.
  • Our plugins are enriched with JavaScript, providing you with unparalleled customization options.
  • The Savantly heatmap enables Grafana to provide a graphical presentation consisting of cells that display values and are sorted out by timestamp.

For data source backend plugins, the health check is automatically called when a user edits a data source and selects Save & Test in the UI. Marcus Olsson has been building data infrastructure and cloud native applications for the past 9 years. He’s an experienced public speaker and educator on software architecture and development practices.

Apache ECharts Lite Panel

You’ve added a data source option, commonly used to set connection options and more. One thing we knew we wanted to do was to make filtering easy and intuitive within our custom query editor. We wanted to allow users to choose from context specific options based on what was present within their account. To do this, we decided to leverage GetResource from the query editor which would then call back into our backend plugin which could pull appropriate data for the filter multi selects. Grafana is a fantastic platform where you can quickly aggregate, visualize, and alert on data from any number of systems. Through its customizable query editors and the Datasource Plugins available you can quickly slice and dice data into usable sets that you can then feed into other tools, export, or alert on.

However, one limitation of these plugins is that they run on the client side, in the browser. Therefore, they can’t support use cases that require server-side features. Now that you’ve defined the query model you wish to support, the next step is to bind the model to a form. The FormField is a text field component from grafana/ui that lets you register a listener which will be invoked whenever the form field value changes.


You should replace constant with host, make sure to remove the number formatting. As I’ve mentioned before, I like to use files for grafana configurations. You can now follow the rest of the tutorial to add your datasource from the dashboard. I suggest you do that and get back to this post when you’re done.

grafana plugin development

With a tailored query editor built specifically around Metrist concepts that our users had become accustomed to. In addition to the data sources for Graphite and Prometheus, MetricFire also installs and supports the following plugins for you. In this file you will see the SampleDatasource struct which implements the backend.QueryDataHandler interface.

Dynamic Text Panel 4.1.0

As you can see, even if we’re using React to render the actual elements, the D3 library contains useful tools that you can use to transform your data before rendering it. One single rectangle might not be very exciting, so let’s see how you can create rectangles from data. D3.js is a JavaScript library for manipulating documents based on data. It lets you transform arbitrary data into HTML, and is commonly used for creating visualizations. Each request contains multiple queries to reduce traffic between Grafana and plugins.