Correlations: Allow creating correlations for provisioned data sources (#73737)

* Allow creating correlations for provisioned data sources

* Update docs

* Fix linting

* Add missing props

* Add missing props

* Fix linting

* Fix linting

* Clarify error name

* Removed error handling for a non-existing use case

* Create a list of deleted data datasources based on all configs

* Add org_id to correlations

* Add tests

* Allow org_id to be null in case org_id=0 is used

* Create organization to ensure stable id is generated

* Fix linting

* Ensure backwards compatibility

* Add deprecation information

* Update comments

* Override existing datasSource variable so the UID is retrieved correctly

* Migrate correlations indices

* Default org_id when migrating

* Remove redundant default

* Make PK non-nullable

* Post merge fixes

* Separate data sources / correlations provisioning

* Adjust comments

* Store new data sources in spy store so it can be used to test correlations as well

* Fix linting

* Update tests

* Ensure response is closed

* Avoid creating duplicates during provisioning

* Fix updating provisioned column and update tests

* Rename error message

* Fix linting errors

* Fix linting errors and rename variable

* Update test

* Update pkg/services/sqlstore/migrations/correlations_mig.go

Co-authored-by: Giordano Ricci <me@giordanoricci.com>

* Remove unused error

* Fix lining

---------

Co-authored-by: Giordano Ricci <me@giordanoricci.com>
This commit is contained in:
Piotr Jamróz
2023-09-13 15:10:09 +02:00
committed by GitHub
parent 38c3483594
commit 946da57b6a
21 changed files with 464 additions and 158 deletions

View File

@ -196,6 +196,7 @@ Content-Type: application/json
Query parameters:
- **page** - Optional. Specify which page number to return. Use the limit parameter to specify the number of correlations per page. The default is page 1.
- **limit** - Optional. Limits the number of returned correlations per page. The default is 100 correlations per page. The maximum limit is 1000 correlations in a page.
- **sourceUID** - Optional. Specify a source datasource UID to filter by. This can be repeated to filter by multiple datasources.
**Example request:**
@ -237,6 +238,7 @@ Content-Type: application/json
"sourceUID": "uyBf2637k",
"targetUID": "PDDA8E780A17E7EF1",
"uid": "J6gn7d31L",
"provisioned": false,
"config": {
"type": "query",
"field": "message",
@ -249,6 +251,7 @@ Content-Type: application/json
"sourceUID": "uyBf2637k",
"targetUID": "P15396BDD62B2BE29",
"uid": "uWCpURgVk",
"provisioned": false,
"config": {
"type": "query",
"field": "message",
@ -297,6 +300,7 @@ Content-Type: application/json
"sourceUID": "uyBf2637k",
"targetUID": "PDDA8E780A17E7EF1",
"uid": "J6gn7d31L",
"provisioned": false,
"config": {
"type": "query",
"field": "message",
@ -309,6 +313,7 @@ Content-Type: application/json
"sourceUID": "PDDA8E780A17E7EF1",
"targetUID": "P15396BDD62B2BE29",
"uid": "uWCpURgVk",
"provisioned": false,
"config": {
"type": "query",
"field": "message",