Elasticsearch: Add deprecation notice for < 7.10 versions (#48506)

* Elasticsearch: Add deprecation notice for old versions

* Add option to remove notice

* Remove deprecation from editor

* Update

* Update public/app/plugins/datasource/elasticsearch/configuration/ConfigEditor.tsx

* Simplify

* Update documentation

* Update

* Update docs/sources/datasources/elasticsearch.md

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>

Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
This commit is contained in:
Ivana Huckova 2022-05-02 17:08:47 +02:00 committed by GitHub
parent 656cd4c8dd
commit da1d34e83d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 1 deletions

View File

@ -11,6 +11,17 @@ weight = 325
Grafana ships with advanced support for Elasticsearch. You can do many types of simple or complex Elasticsearch queries to
visualize logs or metrics stored in Elasticsearch. You can also annotate your graphs with log events stored in Elasticsearch.
Supported Elasticsearch versions:
- v2.0+ (deprecated)
- v5.0+ (deprecated)
- v6.0+ (deprecated)
- v7.0-v7.9+ (deprecated)
- v7.10+
- v8.0+ (experimental)
> **Note:** Deprecated versions (v2.0+, v5.0+, v6.0+, and v7.0-v7.9+) will be removed in the next major release.
## Adding the data source
1. Open the side menu by clicking the Grafana icon in the top header.

View File

@ -5,6 +5,7 @@ import { Alert, DataSourceHttpSettings } from '@grafana/ui';
import { config } from 'app/core/config';
import { ElasticsearchOptions } from '../types';
import { isDeprecatedVersion } from '../utils';
import { DataLinks } from './DataLinks';
import { ElasticDetails } from './ElasticDetails';
@ -26,6 +27,8 @@ export const ConfigEditor = (props: Props) => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
const deprecatedVersion = isDeprecatedVersion(options.jsonData.esVersion);
return (
<>
{options.access === 'direct' && (
@ -33,6 +36,11 @@ export const ConfigEditor = (props: Props) => {
Browser access mode in the Elasticsearch datasource is deprecated and will be removed in a future release.
</Alert>
)}
{deprecatedVersion && (
<Alert title="Deprecation notice" severity="warning">
{`Support for Elasticsearch versions after their end-of-life (currently versions < 7.10) is deprecated and will be removed in a future release.`}
</Alert>
)}
<DataSourceHttpSettings
defaultUrl="http://localhost:9200"

View File

@ -1,4 +1,4 @@
import { valid } from 'semver';
import { valid, gte } from 'semver';
import {
isMetricAggregationWithField,
@ -118,3 +118,11 @@ export const coerceESVersion = (version: string | number): string => {
return '5.0.0';
}
};
export const isDeprecatedVersion = (version: string): boolean => {
if (gte(version, '7.10.0')) {
return false;
}
return true;
};