mirror of
https://github.com/grafana/grafana.git
synced 2025-07-29 10:42:40 +08:00

* Correlations: add migration * Correlations: Add CreateCorrelation API * Correlations: Make correlations work with provisioning * Handle version changes * Fix lining error * lint fixes * rebuild betterer results * add a UID to each correlation * Fix lint errors * add docs * better wording in API docs * remove leftover comment * handle ds updates * Fix error message typo * add bad data test * make correlations a separate table * skip readonly check when provisioning correlations * delete stale correlations when datasources are deleted * restore provisioned readonly ds * publish deletion event with full data * generate swagger and HTTP API docs * apply source datasource permission to create correlation API * Fix tests & lint errors * ignore empty deletion events * fix last lint errors * fix more lint error * Only publish deletion event if datasource was actually deleted * delete DS provisioning deletes correlations, added & fixed tests * Fix unmarshalling tests * Fix linting errors * Fix deltion event tests * fix small linting error * fix lint errors * update betterer * fix test * make path singular * Revert "make path singular" This reverts commit 420c3d315e83ef9a7154766c812a24c7b02fc104. * add integration tests * remove unneeded id from correlations table * update spec * update leftover references to CorrelationDTO * fix tests * cleanup tests * fix lint error
1.6 KiB
1.6 KiB
aliases | description | keywords | title | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Grafana Correlations HTTP API |
|
Correlations HTTP API |
Correlations API
This API can be used to define correlations between data sources.
Create correlations
POST /api/datasources/uid/:sourceUid/correlations
Creates a correlation between two data sources - the source data source indicated by the path UID, and the target data source which is specified in the body.
Example request:
POST /api/datasources/uid/uyBf2637k/correlations HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
{
"targetUid": "PDDA8E780A17E7EF1",
"label": "My Label",
"description": "Logs to Traces",
}
JSON body schema:
- targetUid – Target data source uid.
- label – A label for the correlation.
- description – A description for the correlation.
Example response:
HTTP/1.1 200
Content-Type: application/json
{
"message": "Correlation created",
"result": {
"description": "Logs to Traces",
"label": "My Label",
"sourceUid": "uyBf2637k",
"targetUid": "PDDA8E780A17E7EF1",
"uid": "50xhMlg9k"
}
}
Status codes:
- 200 – OK
- 400 - Errors (invalid JSON, missing or invalid fields)
- 401 – Unauthorized
- 403 – Forbidden, source data source is read-only
- 404 – Not found, either source or target data source could not be found
- 500 – Internal error