mirror of
https://github.com/grafana/grafana.git
synced 2025-01-09 23:53:25 -06:00
Merge branch 'master' of github.com:grafana/grafana
This commit is contained in:
commit
7ecf057901
12
.github/ISSUE_TEMPLATE.md
vendored
Normal file
12
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
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?
|
0
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
0
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@ -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": [
|
||||
|
12
examples/nginx-app/src/datasource/datasource.js
Normal file
12
examples/nginx-app/src/datasource/datasource.js
Normal file
@ -0,0 +1,12 @@
|
||||
export default class NginxDatasource {
|
||||
|
||||
constructor() {}
|
||||
|
||||
query(options) {
|
||||
return [];
|
||||
}
|
||||
|
||||
testDatasource() {
|
||||
return false;
|
||||
}
|
||||
}
|
5
examples/nginx-app/src/datasource/module.js
Normal file
5
examples/nginx-app/src/datasource/module.js
Normal file
@ -0,0 +1,5 @@
|
||||
import {Datasource} from './datasource';
|
||||
|
||||
export {
|
||||
Datasource
|
||||
};
|
5
examples/nginx-app/src/datasource/plugin.json
Normal file
5
examples/nginx-app/src/datasource/plugin.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"type": "datasource",
|
||||
"name": "Nginx Datasource",
|
||||
"id": "nginx-datasource"
|
||||
}
|
Loading…
Reference in New Issue
Block a user