Using Grafana v9.5.5 on Amazon Linux 2, attempted to update a Prometheus data source by specifying the Prometheus type as Cortex and the Cortex version to > 1.13.x (or 1.14.0) using the Data Source API.
The following command was used:
curl -X POST -H 'Content-Type: application/json' -d @"<working_dir>/data_source.json https://<user>:"<password>"@<url>/api/datasources
where data_source.json has these contents:
{
"orgId":999999,
"name":"<data source name>",
"type":"prometheus",
"typeName":"Prometheus",
"typeLogoUrl":"public/app/plugins/datasource/prometheus/img/prometheus_logo.svg",
"access":"proxy",
"url":"XXXXXXXXX",
"password":"",
"user":"",
"database":"",
"basicAuth":false,
"isDefault":false,
"jsonData": {
"httpMethod":"POST",
"manageAlerts":false,
"prometheusType":"Cortex",
"prometheusVersion":"1.14.0",
"sigV4Auth":true,
"sigV4AuthType":"default",
"sigV4Region":"us-east-1"
},
"readOnly":false
}
The error that resulted is below, and the data source was not updated. Got the same result when attempting other version like > 1.13.x, or even with type Prometheus and a version such as 2.40.x.
{"message":"bad request data","traceID":""}
I compared this to an existing data source that was configured manually as Cortex to determine what entries to include in the json. Below is what was received from a GET api command indicating that prometheusType and prometheusVersion are correct entries:
{"id":<id value>,
"uid":"<uid value>",
"orgId":<org id>,
"name": "data source name",
"type":"prometheus",
"typeName":"Prometheus",
"typeLogoUrl":"public/app/plugins/datasource/prometheus/img/prometheus_logo.svg",
"access":"proxy",
"url":"<url of data source>",
"user":"",
"database":"",
"basicAuth":false,
"isDefault":false,
"jsonData":{"httpMethod":"POST","manageAlerts":false,"prometheusType":"Cortex","prometheusVersion":"1.14.0","sigV4Auth":true,"sigV4AuthType":"default","sigV4Region":"us-east-1"},
"readOnly":false}
]
Does the API support this kind of update to a Prometheus data source? If not, can this be requested as a feature update to allow API automation for configuring Prometheus data sources as Cortex type?