Menu

Important: This documentation is about an older version. It's relevant only to the release noted, many of the features and functions have been updated or replaced. Please view the current version.

Enterprise Open source

Data source plugin API

All data sources in Grafana are implemented as plugins.

Breaking change in 2.2

In Grafana 2.2 a breaking change was introduced for how data source query editors are structured, defined and loaded. This was in order to support mixing multiple data sources in the same panel.

In Grafana 2.2, the query editor is no longer defined using the partials section in plugin.json, but defined via an angular directive named using convention naming scheme like metricQueryEditor<data source type name>. For example

Graphite defines a directive like this:

JavaScript
module.directive('metricQueryEditorGraphite', function() {
  return {controller: 'GraphiteQueryCtrl', templateUrl: 'app/plugins/datasource/graphite/partials/query.editor.html'};
});

Even though the data source type name is with lowercase g, the directive uses capital G in Graphite because that is how angular directives needs to be named in order to match an element with name <metric-query-editor-graphite />. You also specify the query controller here instead of in the query.editor.html partial like before.