mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Prometheus: Add Victoria metrics to Prometheus type dropdown in datasource config (#66984)
* add VictoriaMetrics to prometheus type dropdown
This commit is contained in:
@@ -46,7 +46,7 @@ To configure basic settings for the data source, complete the following steps:
|
|||||||
1. Set the data source's basic configuration options:
|
1. Set the data source's basic configuration options:
|
||||||
|
|
||||||
| Name | Description |
|
| Name | Description |
|
||||||
| ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `Name` | The data source name. This is how you refer to the data source in panels and queries. |
|
| `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. |
|
| `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`. |
|
| `URL` | The URL of your Prometheus server, for example, `http://prometheus.example.org:9090`. |
|
||||||
@@ -57,7 +57,7 @@ To configure basic settings for the data source, complete the following steps:
|
|||||||
| `Manage alerts via Alerting UI` | Toggle whether to enable Alertmanager integration for this data source. |
|
| `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. |
|
| `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. |
|
| `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. |
|
| `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. |
|
| `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. |
|
| `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 '&'. |
|
| `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 '&'. |
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { IconName } from '../../types';
|
|||||||
import { Icon } from '../Icon/Icon';
|
import { Icon } from '../Icon/Icon';
|
||||||
import { Tooltip } from '../Tooltip/Tooltip';
|
import { Tooltip } from '../Tooltip/Tooltip';
|
||||||
|
|
||||||
export type BadgeColor = 'blue' | 'red' | 'green' | 'orange' | 'purple';
|
export type BadgeColor = 'blue' | 'red' | 'green' | 'orange' | 'purple' | 'black';
|
||||||
|
|
||||||
export interface BadgeProps extends HTMLAttributes<HTMLDivElement> {
|
export interface BadgeProps extends HTMLAttributes<HTMLDivElement> {
|
||||||
text: React.ReactNode;
|
text: React.ReactNode;
|
||||||
|
|||||||
@@ -77,4 +77,15 @@ export const PromFlavorVersions: { [index: string]: Array<{ value?: string; labe
|
|||||||
{ value: '1.13.0', label: '1.13.x' },
|
{ value: '1.13.0', label: '1.13.x' },
|
||||||
{ value: '1.14.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' },
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ const prometheusFlavorSelectItems: PrometheusSelectItemsType = [
|
|||||||
{ value: PromApplication.Cortex, label: PromApplication.Cortex },
|
{ value: PromApplication.Cortex, label: PromApplication.Cortex },
|
||||||
{ value: PromApplication.Mimir, label: PromApplication.Mimir },
|
{ value: PromApplication.Mimir, label: PromApplication.Mimir },
|
||||||
{ value: PromApplication.Thanos, label: PromApplication.Thanos },
|
{ value: PromApplication.Thanos, label: PromApplication.Thanos },
|
||||||
|
{ value: PromApplication.VictoriaMetrics, label: PromApplication.VictoriaMetrics },
|
||||||
];
|
];
|
||||||
|
|
||||||
type Props = Pick<DataSourcePluginOptionsEditorProps<PromOptions>, 'options' | 'onOptionsChange'>;
|
type Props = Pick<DataSourcePluginOptionsEditorProps<PromOptions>, 'options' | 'onOptionsChange'>;
|
||||||
@@ -118,6 +119,11 @@ const setPrometheusVersion = (
|
|||||||
// This will save the current state of the form, as the url is needed for this API call to function
|
// This will save the current state of the form, as the url is needed for this API call to function
|
||||||
onUpdate(options)
|
onUpdate(options)
|
||||||
.then((updatedOptions) => {
|
.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()
|
getBackendSrv()
|
||||||
.get(`/api/datasources/uid/${updatedOptions.uid}/resources/version-detect`)
|
.get(`/api/datasources/uid/${updatedOptions.uid}/resources/version-detect`)
|
||||||
.then((rawResponse: PromBuildInfoResponse) => {
|
.then((rawResponse: PromBuildInfoResponse) => {
|
||||||
@@ -139,11 +145,11 @@ const setPrometheusVersion = (
|
|||||||
} else {
|
} else {
|
||||||
unableToDeterminePrometheusVersion();
|
unableToDeterminePrometheusVersion();
|
||||||
}
|
}
|
||||||
});
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch(unableToDeterminePrometheusVersion);
|
||||||
unableToDeterminePrometheusVersion(error);
|
}
|
||||||
});
|
})
|
||||||
|
.catch(unableToDeterminePrometheusVersion);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const PromSettings = (props: Props) => {
|
export const PromSettings = (props: Props) => {
|
||||||
|
|||||||
@@ -173,6 +173,8 @@ export class PrometheusDatasource
|
|||||||
this._isDatasourceVersionGreaterOrEqualTo('2.0.0', PromApplication.Mimir) ||
|
this._isDatasourceVersionGreaterOrEqualTo('2.0.0', PromApplication.Mimir) ||
|
||||||
// https://github.com/cortexproject/cortex/discussions/4542
|
// https://github.com/cortexproject/cortex/discussions/4542
|
||||||
this._isDatasourceVersionGreaterOrEqualTo('1.11.0', PromApplication.Cortex) ||
|
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/pull/3566
|
||||||
//https://github.com/thanos-io/thanos/releases/tag/v0.18.0
|
//https://github.com/thanos-io/thanos/releases/tag/v0.18.0
|
||||||
this._isDatasourceVersionGreaterOrEqualTo('0.18.0', PromApplication.Thanos)
|
this._isDatasourceVersionGreaterOrEqualTo('0.18.0', PromApplication.Thanos)
|
||||||
@@ -992,6 +994,7 @@ export class PrometheusDatasource
|
|||||||
[PromApplication.Mimir]: '/public/app/plugins/datasource/prometheus/img/mimir_logo.svg',
|
[PromApplication.Mimir]: '/public/app/plugins/datasource/prometheus/img/mimir_logo.svg',
|
||||||
[PromApplication.Prometheus]: '/public/app/plugins/datasource/prometheus/img/prometheus_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.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> = {
|
const COLORS: Record<PromApplication, BadgeColor> = {
|
||||||
@@ -999,6 +1002,7 @@ export class PrometheusDatasource
|
|||||||
[PromApplication.Mimir]: 'orange',
|
[PromApplication.Mimir]: 'orange',
|
||||||
[PromApplication.Prometheus]: 'red',
|
[PromApplication.Prometheus]: 'red',
|
||||||
[PromApplication.Thanos]: 'purple', // Purple hex taken from thanos.io
|
[PromApplication.Thanos]: 'purple', // Purple hex taken from thanos.io
|
||||||
|
[PromApplication.VictoriaMetrics]: 'black',
|
||||||
};
|
};
|
||||||
|
|
||||||
const AppDisplayNames: Record<PromApplication, string> = {
|
const AppDisplayNames: Record<PromApplication, string> = {
|
||||||
@@ -1006,6 +1010,7 @@ export class PrometheusDatasource
|
|||||||
[PromApplication.Mimir]: 'Mimir',
|
[PromApplication.Mimir]: 'Mimir',
|
||||||
[PromApplication.Prometheus]: 'Prometheus',
|
[PromApplication.Prometheus]: 'Prometheus',
|
||||||
[PromApplication.Thanos]: 'Thanos',
|
[PromApplication.Thanos]: 'Thanos',
|
||||||
|
[PromApplication.VictoriaMetrics]: 'VictoriaMetrics',
|
||||||
};
|
};
|
||||||
|
|
||||||
const application = this.datasourceConfigurationPrometheusFlavor ?? buildInfo.application;
|
const application = this.datasourceConfigurationPrometheusFlavor ?? buildInfo.application;
|
||||||
|
|||||||
BIN
public/app/plugins/datasource/prometheus/img/vm_logo.png
Normal file
BIN
public/app/plugins/datasource/prometheus/img/vm_logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
@@ -64,6 +64,7 @@ export enum PromApplication {
|
|||||||
Mimir = 'Mimir',
|
Mimir = 'Mimir',
|
||||||
Prometheus = 'Prometheus',
|
Prometheus = 'Prometheus',
|
||||||
Thanos = 'Thanos',
|
Thanos = 'Thanos',
|
||||||
|
VictoriaMetrics = 'VictoriaMetrics',
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PromBuildInfoResponse {
|
export interface PromBuildInfoResponse {
|
||||||
|
|||||||
Reference in New Issue
Block a user