Docs: fix minor typos in datasources.md (#22092)

This commit is contained in:
Alex Khomenko 2020-02-11 14:32:20 +02:00 committed by GitHub
parent 34e4f182bc
commit 94b66258b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,7 +10,7 @@ weight = 5
# Data Sources
Data source plugins enables people to develop plugins for any database that
Data source plugins enable 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.
@ -20,7 +20,7 @@ time series data so that any grafana panel can then show it.
> code that people can look at. An example implementation of a data source can be
> found in this [example data source repo](https://github.com/grafana/simple-json-datasource)
To interact with the rest of grafana the plugins module file can export 5 different components.
To interact with the rest of grafana the plugins module file can export 4 different components.
- Datasource (Required)
- QueryCtrl (Required)
@ -31,12 +31,12 @@ To interact with the rest of grafana the plugins module file can export 5 differ
There are two data source specific settings for the plugin.json
```javascript
```json
"metrics": true,
"annotations": false,
```
These settings indicates what kind of data the plugin can deliver. At least one of them have to be true
These settings indicate what kind of data the plugin can deliver. At least one of them has to be true.
## Data source
@ -45,8 +45,8 @@ The javascript object that communicates with the database and transforms data to
The Data source should contain the following functions:
```javascript
query(options) //used by panels to get data
testDatasource() //used by data source configuration page to make sure the connection is working
query(options) // used by panels to get data
testDatasource() // used by data source configuration page to make sure the connection is working
annotationQuery(options) // used by dashboards to get annotations
metricFindQuery(options) // used by query editor to get metric suggestions.
```
@ -68,11 +68,11 @@ Request object passed to datasource.query function:
{ "refId": "A", "target": "upper_90" }
],
"format": "json",
"maxDataPoints": 2495 //decided by the panel
"maxDataPoints": 2495 // decided by the panel
}
```
There are two different kinds of results for data sources;
There are two different kinds of results for data sources:
time series and table. Time series is the most common format and is supported by all data sources and panels. Table format is only supported by the InfluxDB data source and table panel. But we might see more of this in the future.
Time series response from datasource.query.
@ -159,7 +159,7 @@ Expected result from datasource.annotationQuery:
"annotation": {
"name": "annotation name", //should match the annotation name in grafana
"enabled": true,
"datasource": "generic datasource",
"datasource": "generic datasource"
},
"title": "Cluster outage",
"time": 1457075272576,
@ -172,18 +172,18 @@ Expected result from datasource.annotationQuery:
## QueryCtrl
A JavaScript class that will be instantiated and treated as an Angular controller when the user edits metrics in a panel. This class has to inherit from the app/plugins/sdk.QueryCtrl class.
A JavaScript class that will be instantiated and treated as an Angular controller when the user edits metrics in a panel. This class has to inherit from the `app/plugins/sdk.QueryCtrl` class.
Requires a static template or templateUrl variable which will be rendered as the view for this controller.
Requires a static template or `templateUrl` variable which will be rendered as the view for this controller.
## ConfigCtrl
A JavaScript class that will be instantiated and treated as an Angular controller when a user tries to edit or create a new data source of this type.
Requires a static template or templateUrl variable which will be rendered as the view for this controller.
Requires a static template or `templateUrl` variable which will be rendered as the view for this controller.
## AnnotationsQueryCtrl
A JavaScript class that will be instantiated and treated as an Angular controller when the user choose this type of data source in the templating menu in the dashboard.
A JavaScript class that will be instantiated and treated as an Angular controller when the user chooses this type of data source in the templating menu in the dashboard.
Requires a static template or templateUrl variable which will be rendered as the view for this controller. The fields that are bound to this controller are then sent to the Database objects annotationQuery function.
Requires a static template or `templateUrl` variable which will be rendered as the view for this controller. The fields that are bound to this controller are then sent to the Database objects annotationQuery function.