mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
CloudWatch: Remove dynamic labels feature toggle (#67371)
This commit is contained in:
parent
3bfb50f989
commit
2316178565
@ -23,7 +23,6 @@ Some stable features are enabled by default. You can disable a stable feature by
|
||||
| ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
|
||||
| `disableEnvelopeEncryption` | Disable envelope encryption (emergency only) | |
|
||||
| `featureHighlights` | Highlight Grafana Enterprise features | |
|
||||
| `cloudWatchDynamicLabels` | Use dynamic labels instead of alias patterns in CloudWatch datasource | Yes |
|
||||
| `dataConnectionsConsole` | Enables a new top-level page called Connections. This page is an experiment that provides a better experience when you install and configure data sources and other plugins. | Yes |
|
||||
| `internationalization` | Enables internationalization | Yes |
|
||||
| `topnav` | Enables new top navigation and page layouts | Yes |
|
||||
|
@ -33,7 +33,6 @@ export interface FeatureToggles {
|
||||
exploreMixedDatasource?: boolean;
|
||||
newTraceViewHeader?: boolean;
|
||||
correlations?: boolean;
|
||||
cloudWatchDynamicLabels?: boolean;
|
||||
datasourceQueryMultiStatus?: boolean;
|
||||
traceToMetrics?: boolean;
|
||||
newDBLibrary?: boolean;
|
||||
|
@ -104,13 +104,6 @@ var (
|
||||
State: FeatureStateBeta,
|
||||
Owner: grafanaExploreSquad,
|
||||
},
|
||||
{
|
||||
Name: "cloudWatchDynamicLabels",
|
||||
Description: "Use dynamic labels instead of alias patterns in CloudWatch datasource",
|
||||
State: FeatureStateStable,
|
||||
Expression: "true", // enabled by default
|
||||
Owner: awsPluginsSquad,
|
||||
},
|
||||
{
|
||||
Name: "datasourceQueryMultiStatus",
|
||||
Description: "Introduce HTTP 207 Multi Status for api/ds/query",
|
||||
|
@ -14,7 +14,6 @@ storage,alpha,@grafana/grafana-app-platform-squad,false,false,false,false
|
||||
exploreMixedDatasource,beta,@grafana/explore-squad,false,false,false,true
|
||||
newTraceViewHeader,alpha,@grafana/observability-traces-and-profiling,false,false,false,true
|
||||
correlations,beta,@grafana/explore-squad,false,false,false,false
|
||||
cloudWatchDynamicLabels,stable,@grafana/aws-plugins,false,false,false,false
|
||||
datasourceQueryMultiStatus,alpha,@grafana/plugins-platform-backend,false,false,false,false
|
||||
traceToMetrics,alpha,@grafana/observability-traces-and-profiling,false,false,false,true
|
||||
newDBLibrary,beta,@grafana/backend-platform,false,false,false,false
|
||||
|
|
@ -67,10 +67,6 @@ const (
|
||||
// Correlations page
|
||||
FlagCorrelations = "correlations"
|
||||
|
||||
// FlagCloudWatchDynamicLabels
|
||||
// Use dynamic labels instead of alias patterns in CloudWatch datasource
|
||||
FlagCloudWatchDynamicLabels = "cloudWatchDynamicLabels"
|
||||
|
||||
// FlagDatasourceQueryMultiStatus
|
||||
// Introduce HTTP 207 Multi Status for api/ds/query
|
||||
FlagDatasourceQueryMultiStatus = "datasourceQueryMultiStatus"
|
||||
|
@ -3,7 +3,6 @@ import React from 'react';
|
||||
import selectEvent from 'react-select-event';
|
||||
|
||||
import { DataSourceInstanceSettings } from '@grafana/data';
|
||||
import { config } from '@grafana/runtime';
|
||||
import * as ui from '@grafana/ui';
|
||||
import { TimeSrv } from 'app/features/dashboard/services/TimeSrv';
|
||||
import { TemplateSrv } from 'app/features/templating/template_srv';
|
||||
@ -125,22 +124,4 @@ describe('QueryEditor', () => {
|
||||
expect(screen.queryByText('Alias')).toBeNull();
|
||||
expect(screen.getByText("Period: ${PROP('Period')} InstanceId: ${PROP('Dim.InstanceId')}"));
|
||||
});
|
||||
|
||||
// TODO: delete this test when dynamic labels feature flag is removed
|
||||
describe('when dynamic labels feature toggle is disabled', () => {
|
||||
it('should render alias field', async () => {
|
||||
const props = setup();
|
||||
const originalValue = config.featureToggles.cloudWatchDynamicLabels;
|
||||
config.featureToggles.cloudWatchDynamicLabels = false;
|
||||
|
||||
const expected = 'Period: {{period}} InstanceId: {{InstanceId}}';
|
||||
render(<MetricsQueryEditor {...props} query={{ ...props.query, refId: 'A', alias: expected }} />);
|
||||
|
||||
expect(await screen.findByText('Label')).toBeInTheDocument();
|
||||
expect(screen.queryByText('Alias')).toBeNull();
|
||||
expect(screen.getByText("Period: ${PROP('Period')} InstanceId: ${PROP('Dim.InstanceId')}"));
|
||||
|
||||
config.featureToggles.cloudWatchDynamicLabels = originalValue;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,5 +1,3 @@
|
||||
import { config } from '@grafana/runtime';
|
||||
|
||||
import { CloudWatchMetricsQuery } from '../types';
|
||||
|
||||
import { migrateAliasPatterns } from './metricQueryMigrations';
|
||||
@ -74,47 +72,5 @@ describe('metricQueryMigrations', () => {
|
||||
expect(result.alias).toBe(alias);
|
||||
});
|
||||
});
|
||||
|
||||
// TODO: delete this test when dynamic labels feature flag is removed
|
||||
describe('when feature is disabled', () => {
|
||||
const cases: TestScenario[] = [
|
||||
{ alias: '{{period}}', label: "${PROP('MetricName')}" },
|
||||
{ alias: '{{metric}}', label: "${PROP('MetricName')}" },
|
||||
{ alias: '', label: "${PROP('MetricName')}" },
|
||||
{ alias: '', label: '' },
|
||||
{ description: 'Metric name', alias: '{{metric}}', label: "${PROP('MetricName')}" },
|
||||
{ description: 'Trim pattern', alias: '{{ metric }}', label: "${PROP('MetricName')}" },
|
||||
{ description: 'Namespace', alias: '{{namespace}}', label: "${PROP('Namespace')}" },
|
||||
{ description: 'Period', alias: '{{period}}', label: "${PROP('Period')}" },
|
||||
{ description: 'Region', alias: '{{region}}', label: "${PROP('Region')}" },
|
||||
{ description: 'Statistic', alias: '{{stat}}', label: "${PROP('Stat')}" },
|
||||
{ description: 'Label', alias: '{{label}}', label: '${LABEL}' },
|
||||
{
|
||||
description: 'Non-existing alias pattern',
|
||||
alias: '{{anything_else}}',
|
||||
label: "${PROP('Dim.anything_else')}",
|
||||
},
|
||||
{
|
||||
description: 'Combined patterns',
|
||||
alias: 'some {{combination}} of {{label}} and {{metric}}',
|
||||
label: "some ${PROP('Dim.combination')} of ${LABEL} and ${PROP('MetricName')}",
|
||||
},
|
||||
{
|
||||
description: 'Combined patterns not trimmed',
|
||||
alias: 'some {{combination }}{{ label}} and {{metric}}',
|
||||
label: "some ${PROP('Dim.combination')}${LABEL} and ${PROP('MetricName')}",
|
||||
},
|
||||
];
|
||||
test.each(cases)('should migrate alias anyway', ({ alias, label }) => {
|
||||
config.featureToggles.cloudWatchDynamicLabels = false;
|
||||
const testQuery = { ...baseQuery, alias: `${alias}` };
|
||||
if (label !== undefined) {
|
||||
testQuery.label = label;
|
||||
}
|
||||
const result = migrateAliasPatterns(testQuery);
|
||||
expect(result.label).toBe(label);
|
||||
expect(result.alias).toBe(alias);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,7 +1,5 @@
|
||||
import { renderHook } from '@testing-library/react';
|
||||
|
||||
import { config } from '@grafana/runtime';
|
||||
|
||||
import { DEFAULT_METRICS_QUERY } from '../defaultQueries';
|
||||
import { CloudWatchMetricsQuery } from '../types';
|
||||
|
||||
@ -21,7 +19,6 @@ describe('usePrepareMetricsQuery', () => {
|
||||
});
|
||||
});
|
||||
describe('when query has a label', () => {
|
||||
config.featureToggles.cloudWatchDynamicLabels = true;
|
||||
const testQuery: CloudWatchMetricsQuery = { ...DEFAULT_TEST_QUERY, label: 'test' };
|
||||
it('should not replace label or trigger onChange', async () => {
|
||||
const onChangeQuery = jest.fn();
|
||||
@ -30,16 +27,4 @@ describe('usePrepareMetricsQuery', () => {
|
||||
expect(onChangeQuery).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
});
|
||||
// TODO: delete this test when dynamic labels feature flag is removed
|
||||
describe('when dynamic labels feature flag is disabled', () => {
|
||||
const testQuery: CloudWatchMetricsQuery = { ...DEFAULT_TEST_QUERY };
|
||||
it('should replace label or trigger onChange', async () => {
|
||||
const expectedQuery: CloudWatchMetricsQuery = migrateAliasPatterns(testQuery);
|
||||
config.featureToggles.cloudWatchDynamicLabels = false;
|
||||
const onChangeQuery = jest.fn();
|
||||
const { result } = renderHook(() => useMigratedMetricsQuery(testQuery, onChangeQuery));
|
||||
expect(onChangeQuery).toHaveBeenLastCalledWith(result.current);
|
||||
expect(result.current).toEqual(expectedQuery);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user