mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
CloudWatch: Make sure adoption tracking is done on valid, migrated queries (#56872)
* make sure adoption tracking is done on valid, migrated queries * ignore hidden queries * fix test * remove obsolete test
This commit is contained in:
@@ -726,10 +726,6 @@ describe('CloudWatchMetricsQueryRunner', () => {
|
||||
};
|
||||
});
|
||||
|
||||
it('should error if invalid mode', async () => {
|
||||
expect(() => runner.filterMetricQuery(baseQuery)).toThrowError('invalid metric editor mode');
|
||||
});
|
||||
|
||||
describe('metric search queries', () => {
|
||||
beforeEach(() => {
|
||||
baseQuery = {
|
||||
|
||||
@@ -28,11 +28,10 @@ import {
|
||||
CloudWatchMetricsQuery,
|
||||
CloudWatchQuery,
|
||||
DataQueryError,
|
||||
MetricEditorMode,
|
||||
MetricQuery,
|
||||
MetricQueryType,
|
||||
MetricRequest,
|
||||
} from '../types';
|
||||
import { filterMetricsQuery } from '../utils/utils';
|
||||
|
||||
import { CloudWatchRequest } from './CloudWatchRequest';
|
||||
|
||||
@@ -172,21 +171,7 @@ export class CloudWatchMetricsQueryRunner extends CloudWatchRequest {
|
||||
}
|
||||
|
||||
filterMetricQuery(query: CloudWatchMetricsQuery): boolean {
|
||||
const { region, metricQueryType, metricEditorMode, expression, metricName, namespace, sqlExpression, statistic } =
|
||||
query;
|
||||
if (!region) {
|
||||
return false;
|
||||
}
|
||||
if (metricQueryType === MetricQueryType.Search && metricEditorMode === MetricEditorMode.Builder) {
|
||||
return !!namespace && !!metricName && !!statistic;
|
||||
} else if (metricQueryType === MetricQueryType.Search && metricEditorMode === MetricEditorMode.Code) {
|
||||
return !!expression;
|
||||
} else if (metricQueryType === MetricQueryType.Query) {
|
||||
// still TBD how to validate the visual query builder for SQL
|
||||
return !!sqlExpression;
|
||||
}
|
||||
|
||||
throw new Error('invalid metric editor mode');
|
||||
return filterMetricsQuery(query);
|
||||
}
|
||||
|
||||
replaceMetricQueryVars(
|
||||
|
||||
Reference in New Issue
Block a user