Skip to content

Commit 2316178

Browse files
authored
CloudWatch: Remove dynamic labels feature toggle (grafana#67371)
1 parent 3bfb50f commit 2316178

File tree

8 files changed

+0
-92
lines changed

8 files changed

+0
-92
lines changed

docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ Some stable features are enabled by default. You can disable a stable feature by
2323
| ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ |
2424
| `disableEnvelopeEncryption` | Disable envelope encryption (emergency only) | |
2525
| `featureHighlights` | Highlight Grafana Enterprise features | |
26-
| `cloudWatchDynamicLabels` | Use dynamic labels instead of alias patterns in CloudWatch datasource | Yes |
2726
| `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 |
2827
| `internationalization` | Enables internationalization | Yes |
2928
| `topnav` | Enables new top navigation and page layouts | Yes |

packages/grafana-data/src/types/featureToggles.gen.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export interface FeatureToggles {
3333
exploreMixedDatasource?: boolean;
3434
newTraceViewHeader?: boolean;
3535
correlations?: boolean;
36-
cloudWatchDynamicLabels?: boolean;
3736
datasourceQueryMultiStatus?: boolean;
3837
traceToMetrics?: boolean;
3938
newDBLibrary?: boolean;

pkg/services/featuremgmt/registry.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,6 @@ var (
104104
State: FeatureStateBeta,
105105
Owner: grafanaExploreSquad,
106106
},
107-
{
108-
Name: "cloudWatchDynamicLabels",
109-
Description: "Use dynamic labels instead of alias patterns in CloudWatch datasource",
110-
State: FeatureStateStable,
111-
Expression: "true", // enabled by default
112-
Owner: awsPluginsSquad,
113-
},
114107
{
115108
Name: "datasourceQueryMultiStatus",
116109
Description: "Introduce HTTP 207 Multi Status for api/ds/query",

pkg/services/featuremgmt/toggles_gen.csv

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ storage,alpha,@grafana/grafana-app-platform-squad,false,false,false,false
1414
exploreMixedDatasource,beta,@grafana/explore-squad,false,false,false,true
1515
newTraceViewHeader,alpha,@grafana/observability-traces-and-profiling,false,false,false,true
1616
correlations,beta,@grafana/explore-squad,false,false,false,false
17-
cloudWatchDynamicLabels,stable,@grafana/aws-plugins,false,false,false,false
1817
datasourceQueryMultiStatus,alpha,@grafana/plugins-platform-backend,false,false,false,false
1918
traceToMetrics,alpha,@grafana/observability-traces-and-profiling,false,false,false,true
2019
newDBLibrary,beta,@grafana/backend-platform,false,false,false,false

pkg/services/featuremgmt/toggles_gen.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ const (
6767
// Correlations page
6868
FlagCorrelations = "correlations"
6969

70-
// FlagCloudWatchDynamicLabels
71-
// Use dynamic labels instead of alias patterns in CloudWatch datasource
72-
FlagCloudWatchDynamicLabels = "cloudWatchDynamicLabels"
73-
7470
// FlagDatasourceQueryMultiStatus
7571
// Introduce HTTP 207 Multi Status for api/ds/query
7672
FlagDatasourceQueryMultiStatus = "datasourceQueryMultiStatus"

public/app/plugins/datasource/cloudwatch/components/MetricsQueryEditor/MetricsQueryEditor.test.tsx

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import React from 'react';
33
import selectEvent from 'react-select-event';
44

55
import { DataSourceInstanceSettings } from '@grafana/data';
6-
import { config } from '@grafana/runtime';
76
import * as ui from '@grafana/ui';
87
import { TimeSrv } from 'app/features/dashboard/services/TimeSrv';
98
import { TemplateSrv } from 'app/features/templating/template_srv';
@@ -125,22 +124,4 @@ describe('QueryEditor', () => {
125124
expect(screen.queryByText('Alias')).toBeNull();
126125
expect(screen.getByText("Period: ${PROP('Period')} InstanceId: ${PROP('Dim.InstanceId')}"));
127126
});
128-
129-
// TODO: delete this test when dynamic labels feature flag is removed
130-
describe('when dynamic labels feature toggle is disabled', () => {
131-
it('should render alias field', async () => {
132-
const props = setup();
133-
const originalValue = config.featureToggles.cloudWatchDynamicLabels;
134-
config.featureToggles.cloudWatchDynamicLabels = false;
135-
136-
const expected = 'Period: {{period}} InstanceId: {{InstanceId}}';
137-
render(<MetricsQueryEditor {...props} query={{ ...props.query, refId: 'A', alias: expected }} />);
138-
139-
expect(await screen.findByText('Label')).toBeInTheDocument();
140-
expect(screen.queryByText('Alias')).toBeNull();
141-
expect(screen.getByText("Period: ${PROP('Period')} InstanceId: ${PROP('Dim.InstanceId')}"));
142-
143-
config.featureToggles.cloudWatchDynamicLabels = originalValue;
144-
});
145-
});
146127
});

public/app/plugins/datasource/cloudwatch/migrations/metricQueryMigrations.test.ts

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { config } from '@grafana/runtime';
2-
31
import { CloudWatchMetricsQuery } from '../types';
42

53
import { migrateAliasPatterns } from './metricQueryMigrations';
@@ -74,47 +72,5 @@ describe('metricQueryMigrations', () => {
7472
expect(result.alias).toBe(alias);
7573
});
7674
});
77-
78-
// TODO: delete this test when dynamic labels feature flag is removed
79-
describe('when feature is disabled', () => {
80-
const cases: TestScenario[] = [
81-
{ alias: '{{period}}', label: "${PROP('MetricName')}" },
82-
{ alias: '{{metric}}', label: "${PROP('MetricName')}" },
83-
{ alias: '', label: "${PROP('MetricName')}" },
84-
{ alias: '', label: '' },
85-
{ description: 'Metric name', alias: '{{metric}}', label: "${PROP('MetricName')}" },
86-
{ description: 'Trim pattern', alias: '{{ metric }}', label: "${PROP('MetricName')}" },
87-
{ description: 'Namespace', alias: '{{namespace}}', label: "${PROP('Namespace')}" },
88-
{ description: 'Period', alias: '{{period}}', label: "${PROP('Period')}" },
89-
{ description: 'Region', alias: '{{region}}', label: "${PROP('Region')}" },
90-
{ description: 'Statistic', alias: '{{stat}}', label: "${PROP('Stat')}" },
91-
{ description: 'Label', alias: '{{label}}', label: '${LABEL}' },
92-
{
93-
description: 'Non-existing alias pattern',
94-
alias: '{{anything_else}}',
95-
label: "${PROP('Dim.anything_else')}",
96-
},
97-
{
98-
description: 'Combined patterns',
99-
alias: 'some {{combination}} of {{label}} and {{metric}}',
100-
label: "some ${PROP('Dim.combination')} of ${LABEL} and ${PROP('MetricName')}",
101-
},
102-
{
103-
description: 'Combined patterns not trimmed',
104-
alias: 'some {{combination }}{{ label}} and {{metric}}',
105-
label: "some ${PROP('Dim.combination')}${LABEL} and ${PROP('MetricName')}",
106-
},
107-
];
108-
test.each(cases)('should migrate alias anyway', ({ alias, label }) => {
109-
config.featureToggles.cloudWatchDynamicLabels = false;
110-
const testQuery = { ...baseQuery, alias: `${alias}` };
111-
if (label !== undefined) {
112-
testQuery.label = label;
113-
}
114-
const result = migrateAliasPatterns(testQuery);
115-
expect(result.label).toBe(label);
116-
expect(result.alias).toBe(alias);
117-
});
118-
});
11975
});
12076
});
Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { renderHook } from '@testing-library/react';
22

3-
import { config } from '@grafana/runtime';
4-
53
import { DEFAULT_METRICS_QUERY } from '../defaultQueries';
64
import { CloudWatchMetricsQuery } from '../types';
75

@@ -21,7 +19,6 @@ describe('usePrepareMetricsQuery', () => {
2119
});
2220
});
2321
describe('when query has a label', () => {
24-
config.featureToggles.cloudWatchDynamicLabels = true;
2522
const testQuery: CloudWatchMetricsQuery = { ...DEFAULT_TEST_QUERY, label: 'test' };
2623
it('should not replace label or trigger onChange', async () => {
2724
const onChangeQuery = jest.fn();
@@ -30,16 +27,4 @@ describe('usePrepareMetricsQuery', () => {
3027
expect(onChangeQuery).toHaveBeenCalledTimes(0);
3128
});
3229
});
33-
// TODO: delete this test when dynamic labels feature flag is removed
34-
describe('when dynamic labels feature flag is disabled', () => {
35-
const testQuery: CloudWatchMetricsQuery = { ...DEFAULT_TEST_QUERY };
36-
it('should replace label or trigger onChange', async () => {
37-
const expectedQuery: CloudWatchMetricsQuery = migrateAliasPatterns(testQuery);
38-
config.featureToggles.cloudWatchDynamicLabels = false;
39-
const onChangeQuery = jest.fn();
40-
const { result } = renderHook(() => useMigratedMetricsQuery(testQuery, onChangeQuery));
41-
expect(onChangeQuery).toHaveBeenLastCalledWith(result.current);
42-
expect(result.current).toEqual(expectedQuery);
43-
});
44-
});
4530
});

0 commit comments

Comments
 (0)