Revert "Prometheus: Add Victoria metrics to Prometheus type dropdown in datasource config" (#67150)

Revert "Prometheus: Add Victoria metrics to Prometheus type dropdown in datasource config (#66984)"

This reverts commit 7cb4d65584.
This commit is contained in:
Galen Kistler 2023-04-24 12:59:27 -05:00 committed by GitHub
parent e57e0769ca
commit a6577cc6fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 47 additions and 70 deletions

View File

@ -45,28 +45,28 @@ To configure basic settings for the data source, complete the following steps:
1. Set the data source's basic configuration options:
| Name | Description |
| ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Name` | The data source name. This is how you refer to the data source in panels and queries. |
| `Default` | Default data source that is pre-selected for new panels. |
| `URL` | The URL of your Prometheus server, for example, `http://prometheus.example.org:9090`. |
| `Access` | Only Server access mode is functional. If Server mode is already selected this option is hidden. Otherwise change to Server mode to prevent errors. |
| `Basic Auth` | Enable basic authentication to the Prometheus data source. |
| `User` | User name for basic authentication. |
| `Password` | Password for basic authentication. |
| `Manage alerts via Alerting UI` | Toggle whether to enable Alertmanager integration for this data source. |
| `Scrape interval` | Set this to the typical scrape and evaluation interval configured in Prometheus. Defaults to 15s. |
| `HTTP method` | Use either POST or GET HTTP method to query your data source. POST is the recommended and pre-selected method as it allows bigger queries. Change this to GET if you have a Prometheus version older than 2.1 or if POST requests are restricted in your network. |
| `Type` | The type of your Prometheus server; `Prometheus`, `Cortex`, `Thanos`, `Mimir`. When selected, the **Version** field attempts to populate automatically using the Prometheus [buildinfo](https://prometheus.io/docs/prometheus/latest/querying/api/#build-information) API. Some Prometheus types, such as Cortex or VictoriaMetrics, don't support this API or provide version info, and must be manually populated. |
| `Version` | The version of your Prometheus server, note that this field is not visible until the Prometheus type is selected. |
| `Disable metrics lookup` | Checking this option will disable the metrics chooser and metric/label support in the query field's autocomplete. This helps if you have performance issues with bigger Prometheus instances. |
| `Custom query parameters` | Add custom parameters to the Prometheus query URL. For example `timeout`, `partial_response`, `dedup`, or `max_source_resolution`. Multiple parameters should be concatenated together with an '&'. |
| **Exemplars configuration** | |
| `Internal link` | Enable this option if you have an internal link. When enabled, this reveals the data source selector. Select the backend tracing data store for your exemplar data. |
| `Data source` | _(Visible only if you enable `Internal link`)_ Selects the backend tracing data store for your exemplar data. |
| `URL` | _(Visible only if you disable `Internal link`)_ Defines the external link's full URL. You can interpolate the value from the field by using the [`${__value.raw}` macro]({{< relref "../..//panels-visualizations/configure-data-links/#value-variables" >}}). |
| `URL Label` | _(Optional)_ Adds a custom display label to override the value of the `Label name` field. |
| `Label name` | Adds a name for the exemplar traceID property. |
| Name | Description |
| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Name` | The data source name. This is how you refer to the data source in panels and queries. |
| `Default` | Default data source that is pre-selected for new panels. |
| `URL` | The URL of your Prometheus server, for example, `http://prometheus.example.org:9090`. |
| `Access` | Only Server access mode is functional. If Server mode is already selected this option is hidden. Otherwise change to Server mode to prevent errors. |
| `Basic Auth` | Enable basic authentication to the Prometheus data source. |
| `User` | User name for basic authentication. |
| `Password` | Password for basic authentication. |
| `Manage alerts via Alerting UI` | Toggle whether to enable Alertmanager integration for this data source. |
| `Scrape interval` | Set this to the typical scrape and evaluation interval configured in Prometheus. Defaults to 15s. |
| `HTTP method` | Use either POST or GET HTTP method to query your data source. POST is the recommended and pre-selected method as it allows bigger queries. Change this to GET if you have a Prometheus version older than 2.1 or if POST requests are restricted in your network. |
| `Type` | The type of your Prometheus server; `Prometheus`, `Cortex`, `Thanos`, `Mimir`. When selected, the **Version** field attempts to populate automatically using the Prometheus [buildinfo](https://semver.org/) API. Some Prometheus types, such as Cortex, don't support this API and must be manually populated. |
| `Version` | The version of your Prometheus server, note that this field is not visible until the Prometheus type is selected. |
| `Disable metrics lookup` | Checking this option will disable the metrics chooser and metric/label support in the query field's autocomplete. This helps if you have performance issues with bigger Prometheus instances. |
| `Custom query parameters` | Add custom parameters to the Prometheus query URL. For example `timeout`, `partial_response`, `dedup`, or `max_source_resolution`. Multiple parameters should be concatenated together with an '&amp;'. |
| **Exemplars configuration** | |
| `Internal link` | Enable this option if you have an internal link. When enabled, this reveals the data source selector. Select the backend tracing data store for your exemplar data. |
| `Data source` | _(Visible only if you enable `Internal link`)_ Selects the backend tracing data store for your exemplar data. |
| `URL` | _(Visible only if you disable `Internal link`)_ Defines the external link's full URL. You can interpolate the value from the field by using the [`${__value.raw}` macro]({{< relref "../..//panels-visualizations/configure-data-links/#value-variables" >}}). |
| `URL Label` | _(Optional)_ Adds a custom display label to override the value of the `Label name` field. |
| `Label name` | Adds a name for the exemplar traceID property. |
### Provision the data source

View File

@ -9,7 +9,7 @@ import { IconName } from '../../types';
import { Icon } from '../Icon/Icon';
import { Tooltip } from '../Tooltip/Tooltip';
export type BadgeColor = 'blue' | 'red' | 'green' | 'orange' | 'purple' | 'black';
export type BadgeColor = 'blue' | 'red' | 'green' | 'orange' | 'purple';
export interface BadgeProps extends HTMLAttributes<HTMLDivElement> {
text: React.ReactNode;

View File

@ -77,15 +77,4 @@ export const PromFlavorVersions: { [index: string]: Array<{ value?: string; labe
{ value: '1.13.0', label: '1.13.x' },
{ value: '1.14.0', label: '> 1.13.x' },
],
VictoriaMetrics: [
{ value: '1.23.0', label: '< 1.24.0' },
{ value: '1.24.0', label: '>= 1.24.x' },
{ value: '1.30.0', label: '1.3x' },
{ value: '1.40.0', label: '1.4x' },
{ value: '1.50.0', label: '1.5x' },
{ value: '1.60.0', label: '1.6x' },
{ value: '1.70.0', label: '1.7x' },
{ value: '1.80.0', label: '1.8x' },
{ value: '1.90.0', label: '>= 1.9x' },
],
};

View File

@ -56,7 +56,6 @@ const prometheusFlavorSelectItems: PrometheusSelectItemsType = [
{ value: PromApplication.Cortex, label: PromApplication.Cortex },
{ value: PromApplication.Mimir, label: PromApplication.Mimir },
{ value: PromApplication.Thanos, label: PromApplication.Thanos },
{ value: PromApplication.VictoriaMetrics, label: PromApplication.VictoriaMetrics },
];
type Props = Pick<DataSourcePluginOptionsEditorProps<PromOptions>, 'options' | 'onOptionsChange'>;
@ -119,37 +118,32 @@ const setPrometheusVersion = (
// This will save the current state of the form, as the url is needed for this API call to function
onUpdate(options)
.then((updatedOptions) => {
// Not seeing version info in buildinfo response from VictoriaMetrics, and Cortex doesn't support yet, users will need to manually select version
if (
updatedOptions.jsonData.prometheusType !== PromApplication.VictoriaMetrics &&
updatedOptions.jsonData.prometheusType !== PromApplication.Cortex
) {
getBackendSrv()
.get(`/api/datasources/uid/${updatedOptions.uid}/resources/version-detect`)
.then((rawResponse: PromBuildInfoResponse) => {
const rawVersionStringFromApi = rawResponse.data?.version ?? '';
if (rawVersionStringFromApi && semver.valid(rawVersionStringFromApi)) {
const parsedVersion = getVersionString(rawVersionStringFromApi, updatedOptions.jsonData.prometheusType);
// If we got a successful response, let's update the backend with the version right away if it's new
if (parsedVersion) {
onUpdate({
...updatedOptions,
jsonData: {
...updatedOptions.jsonData,
prometheusVersion: parsedVersion,
},
}).then((updatedUpdatedOptions) => {
onOptionsChange(updatedUpdatedOptions);
});
}
} else {
unableToDeterminePrometheusVersion();
getBackendSrv()
.get(`/api/datasources/uid/${updatedOptions.uid}/resources/version-detect`)
.then((rawResponse: PromBuildInfoResponse) => {
const rawVersionStringFromApi = rawResponse.data?.version ?? '';
if (rawVersionStringFromApi && semver.valid(rawVersionStringFromApi)) {
const parsedVersion = getVersionString(rawVersionStringFromApi, updatedOptions.jsonData.prometheusType);
// If we got a successful response, let's update the backend with the version right away if it's new
if (parsedVersion) {
onUpdate({
...updatedOptions,
jsonData: {
...updatedOptions.jsonData,
prometheusVersion: parsedVersion,
},
}).then((updatedUpdatedOptions) => {
onOptionsChange(updatedUpdatedOptions);
});
}
})
.catch(unableToDeterminePrometheusVersion);
}
} else {
unableToDeterminePrometheusVersion();
}
});
})
.catch(unableToDeterminePrometheusVersion);
.catch((error) => {
unableToDeterminePrometheusVersion(error);
});
};
export const PromSettings = (props: Props) => {

View File

@ -173,8 +173,6 @@ export class PrometheusDatasource
this._isDatasourceVersionGreaterOrEqualTo('2.0.0', PromApplication.Mimir) ||
// https://github.com/cortexproject/cortex/discussions/4542
this._isDatasourceVersionGreaterOrEqualTo('1.11.0', PromApplication.Cortex) ||
//https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.24.0
this._isDatasourceVersionGreaterOrEqualTo('1.24.0', PromApplication.VictoriaMetrics) ||
// https://github.com/thanos-io/thanos/pull/3566
//https://github.com/thanos-io/thanos/releases/tag/v0.18.0
this._isDatasourceVersionGreaterOrEqualTo('0.18.0', PromApplication.Thanos)
@ -994,7 +992,6 @@ export class PrometheusDatasource
[PromApplication.Mimir]: '/public/app/plugins/datasource/prometheus/img/mimir_logo.svg',
[PromApplication.Prometheus]: '/public/app/plugins/datasource/prometheus/img/prometheus_logo.svg',
[PromApplication.Thanos]: '/public/app/plugins/datasource/prometheus/img/thanos_logo.svg',
[PromApplication.VictoriaMetrics]: '/public/app/plugins/datasource/prometheus/img/vm_logo.svg',
};
const COLORS: Record<PromApplication, BadgeColor> = {
@ -1002,7 +999,6 @@ export class PrometheusDatasource
[PromApplication.Mimir]: 'orange',
[PromApplication.Prometheus]: 'red',
[PromApplication.Thanos]: 'purple', // Purple hex taken from thanos.io
[PromApplication.VictoriaMetrics]: 'black',
};
const AppDisplayNames: Record<PromApplication, string> = {
@ -1010,7 +1006,6 @@ export class PrometheusDatasource
[PromApplication.Mimir]: 'Mimir',
[PromApplication.Prometheus]: 'Prometheus',
[PromApplication.Thanos]: 'Thanos',
[PromApplication.VictoriaMetrics]: 'VictoriaMetrics',
};
const application = this.datasourceConfigurationPrometheusFlavor ?? buildInfo.application;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -64,7 +64,6 @@ export enum PromApplication {
Mimir = 'Mimir',
Prometheus = 'Prometheus',
Thanos = 'Thanos',
VictoriaMetrics = 'VictoriaMetrics',
}
export interface PromBuildInfoResponse {