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:
parent
b6953763f4
commit
7cb4d65584
@ -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:
|
||||
|
||||
| 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`. |
|
||||
@ -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. |
|
||||
| `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. |
|
||||
| `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 '&'. |
|
||||
|
@ -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';
|
||||
export type BadgeColor = 'blue' | 'red' | 'green' | 'orange' | 'purple' | 'black';
|
||||
|
||||
export interface BadgeProps extends HTMLAttributes<HTMLDivElement> {
|
||||
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.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.Mimir, label: PromApplication.Mimir },
|
||||
{ value: PromApplication.Thanos, label: PromApplication.Thanos },
|
||||
{ value: PromApplication.VictoriaMetrics, label: PromApplication.VictoriaMetrics },
|
||||
];
|
||||
|
||||
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
|
||||
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) => {
|
||||
@ -139,11 +145,11 @@ const setPrometheusVersion = (
|
||||
} else {
|
||||
unableToDeterminePrometheusVersion();
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
unableToDeterminePrometheusVersion(error);
|
||||
});
|
||||
.catch(unableToDeterminePrometheusVersion);
|
||||
}
|
||||
})
|
||||
.catch(unableToDeterminePrometheusVersion);
|
||||
};
|
||||
|
||||
export const PromSettings = (props: Props) => {
|
||||
|
@ -173,6 +173,8 @@ 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)
|
||||
@ -992,6 +994,7 @@ 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> = {
|
||||
@ -999,6 +1002,7 @@ 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> = {
|
||||
@ -1006,6 +1010,7 @@ export class PrometheusDatasource
|
||||
[PromApplication.Mimir]: 'Mimir',
|
||||
[PromApplication.Prometheus]: 'Prometheus',
|
||||
[PromApplication.Thanos]: 'Thanos',
|
||||
[PromApplication.VictoriaMetrics]: 'VictoriaMetrics',
|
||||
};
|
||||
|
||||
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',
|
||||
Prometheus = 'Prometheus',
|
||||
Thanos = 'Thanos',
|
||||
VictoriaMetrics = 'VictoriaMetrics',
|
||||
}
|
||||
|
||||
export interface PromBuildInfoResponse {
|
||||
|
Loading…
Reference in New Issue
Block a user