From 676265f39e48017872790ca7fb43209a86201a09 Mon Sep 17 00:00:00 2001 From: Sven Grossmann Date: Fri, 2 Feb 2024 10:19:46 +0100 Subject: [PATCH] remove frontend healthcheck --- .../elasticsearch/datasource.test.ts | 21 -------------- .../datasource/elasticsearch/datasource.ts | 28 ------------------- 2 files changed, 49 deletions(-) diff --git a/public/app/plugins/datasource/elasticsearch/datasource.test.ts b/public/app/plugins/datasource/elasticsearch/datasource.test.ts index 4dfeefc2fae..bf701b4ca2c 100644 --- a/public/app/plugins/datasource/elasticsearch/datasource.test.ts +++ b/public/app/plugins/datasource/elasticsearch/datasource.test.ts @@ -141,27 +141,6 @@ describe('ElasticDatasource', () => { }); }); - describe('When testing datasource with index pattern', () => { - it('should translate index pattern to current day', async () => { - const { ds, fetchMock } = getTestContext({ jsonData: { interval: 'Daily' } }); - - await ds.testDatasource(); - - const today = toUtc().format('YYYY.MM.DD'); - const lastCall = fetchMock.mock.calls[fetchMock.mock.calls.length - 1]; - expect(lastCall[0].url).toBe(`${ELASTICSEARCH_MOCK_URL}/test-${today}/_mapping`); - }); - - it('should call `/_mapping` with an empty index', async () => { - const { ds, fetchMock } = getTestContext({ jsonData: { index: '' } }); - - await ds.testDatasource(); - - const lastCall = fetchMock.mock.calls[fetchMock.mock.calls.length - 1]; - expect(lastCall[0].url).toBe(`${ELASTICSEARCH_MOCK_URL}/_mapping`); - }); - }); - describe('When issuing metric query with interval pattern', () => { async function runScenario() { const range = { from: toUtc([2015, 4, 30, 10]), to: toUtc([2015, 5, 1, 10]), raw: { from: '', to: '' } }; diff --git a/public/app/plugins/datasource/elasticsearch/datasource.ts b/public/app/plugins/datasource/elasticsearch/datasource.ts index 7aa1ece56a4..4b5dcd875c6 100644 --- a/public/app/plugins/datasource/elasticsearch/datasource.ts +++ b/public/app/plugins/datasource/elasticsearch/datasource.ts @@ -427,34 +427,6 @@ export class ElasticDatasource return queries.map((q) => this.applyTemplateVariables(q, scopedVars, filters)); } - async testDatasource() { - // we explicitly ask for uncached, "fresh" data here - const dbVersion = await this.getDatabaseVersion(false); - // if we are not able to determine the elastic-version, we assume it is a good version. - const isSupported = dbVersion != null ? isSupportedVersion(dbVersion) : true; - const versionMessage = isSupported ? '' : `WARNING: ${unsupportedVersionMessage} `; - // validate that the index exist and has date field - return lastValueFrom( - this.getFields(['date']).pipe( - mergeMap((dateFields) => { - const timeField = find(dateFields, { text: this.timeField }); - if (!timeField) { - return of({ - status: 'error', - message: 'No date field named ' + this.timeField + ' found', - }); - } - return of({ status: 'success', message: `${versionMessage}Data source successfully connected.` }); - }), - catchError((err) => { - const infoInParentheses = err.message ? ` (${err.message})` : ''; - const message = `Unable to connect with Elasticsearch${infoInParentheses}. Please check the server logs for more details.`; - return of({ status: 'error', message }); - }) - ) - ); - } - getQueryHeader(searchType: string, timeFrom?: DateTime, timeTo?: DateTime): string { const queryHeader = { search_type: searchType,