Commit 7ecf0579 by Torkel Ödegaard

Merge branch 'master' of github.com:grafana/grafana

parents 091726b3 ae3bda81
Thank you! For helping us make Grafana even better.
To help us respond to your issues faster, please make sure to add as much information as possible.
If this issue is about a plugin, please open the issue in that repository.
Tag your issues title with [Feature Request] / [Bug] / [Question] or no tag if your unsure.
Ex
* What grafana version are you using?
* What datasource are you using?
* What OS are you running grafana on?
......@@ -8,7 +8,7 @@ page_keywords: grafana, plugins, documentation
# Datasources
Datasource plugins enables people to develop plugins for any database that commuicates over http. Its up to the plugin to transform the data into time series data so that any grafana panel can then show it.
Datasource plugins enables people to develop plugins for any database that communicates over http. Its up to the plugin to transform the data into time series data so that any grafana panel can then show it.
To interact with the rest of grafana the plugins module file can export 5 different components.
......@@ -54,7 +54,7 @@ Request object passed to datasource.query function
```
There are two different kind of results for datasources.
Time series and table. Time series is the most common format and is suppoert by all datasources and panels. Table format is only support by the Influxdb datasource and table panel. But we might se more of this in the future.
Time series and table. Time series is the most common format and is supported by all datasources and panels. Table format is only support by the Influxdb datasource and table panel. But we might see more of this in the future.
Time series response from datasource.query
An array of
......
......@@ -17,13 +17,13 @@ This class have to inherit from sdk.PanelCtrl or sdk.MetricsPanelCtrl and be exp
};
```
This class will be instancieted once for every panel of its kind in a dashboard and treated as an AngularJs controller.
This class will be instantiated once for every panel of its kind in a dashboard and treated as an AngularJs controller.
## MetricsPanelCtrl or PanelCtrl
MetricsPanelCtrl inherits from PanelCtrl and adds some common features for datasource usage. So if your Panel will be working with a datasource you should inherit from MetricsPanelCtrl. If dont need to access any datasource then you should inherit from PanelCtrl instead.
MetricsPanelCtrl inherits from PanelCtrl and adds some common features for datasource usage. So if your Panel will be working with a datasource you should inherit from MetricsPanelCtrl. If don't need to access any datasource then you should inherit from PanelCtrl instead.
## Implementing a MetricsPanelCtrl
If you choose to inherit from MetricsPanelCtrl you should implement a function called refreshData that will take an datasource as inparameter when its time to get new data. Its recommended that the refreshData function calls the issueQueries in the base class but its not mandatory. An examples of such implementation can be found in our [example panel](https://github.com/grafana/grafana/blob/master/examples/panel-boilerplate-es5/module.js#L27-L38)
If you choose to inherit from MetricsPanelCtrl you should implement a function called refreshData that will take a datasource as in parameter when its time to get new data. Its recommended that the refreshData function calls the issueQueries in the base class but its not mandatory. An examples of such implementation can be found in our [example panel](https://github.com/grafana/grafana/blob/master/examples/panel-boilerplate-es5/module.js#L27-L38)
......@@ -34,6 +34,14 @@
"updated": "2015-02-10"
},
"includes": {
"dashboards": [],
"plugins": [
{"type": "panel", "name": "Nginx Panel"},
{"type": "datasource", "name": "Nginx Datasource"}
]
},
"dependencies": {
"grafanaVersion": "3.x.x",
"plugins": [
......
export default class NginxDatasource {
constructor() {}
query(options) {
return [];
}
testDatasource() {
return false;
}
}
import {Datasource} from './datasource';
export {
Datasource
};
\ No newline at end of file
{
"type": "datasource",
"name": "Nginx Datasource",
"id": "nginx-datasource"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment