diff --git a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md index bf553aa61a2..ee00de1835e 100644 --- a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md +++ b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md @@ -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 | diff --git a/packages/grafana-data/src/types/featureToggles.gen.ts b/packages/grafana-data/src/types/featureToggles.gen.ts index 9f04ea6972c..7875ba2d63a 100644 --- a/packages/grafana-data/src/types/featureToggles.gen.ts +++ b/packages/grafana-data/src/types/featureToggles.gen.ts @@ -33,7 +33,6 @@ export interface FeatureToggles { exploreMixedDatasource?: boolean; newTraceViewHeader?: boolean; correlations?: boolean; - cloudWatchDynamicLabels?: boolean; datasourceQueryMultiStatus?: boolean; traceToMetrics?: boolean; newDBLibrary?: boolean; diff --git a/pkg/services/featuremgmt/registry.go b/pkg/services/featuremgmt/registry.go index 6ad62a643ed..b142ca014f7 100644 --- a/pkg/services/featuremgmt/registry.go +++ b/pkg/services/featuremgmt/registry.go @@ -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", diff --git a/pkg/services/featuremgmt/toggles_gen.csv b/pkg/services/featuremgmt/toggles_gen.csv index e3d7ba39bbd..612ff973b0c 100644 --- a/pkg/services/featuremgmt/toggles_gen.csv +++ b/pkg/services/featuremgmt/toggles_gen.csv @@ -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 diff --git a/pkg/services/featuremgmt/toggles_gen.go b/pkg/services/featuremgmt/toggles_gen.go index da33d9d06e3..b1c017b10b1 100644 --- a/pkg/services/featuremgmt/toggles_gen.go +++ b/pkg/services/featuremgmt/toggles_gen.go @@ -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" diff --git a/public/app/plugins/datasource/cloudwatch/components/MetricsQueryEditor/MetricsQueryEditor.test.tsx b/public/app/plugins/datasource/cloudwatch/components/MetricsQueryEditor/MetricsQueryEditor.test.tsx index 5b284abb0c4..907e91d574c 100644 --- a/public/app/plugins/datasource/cloudwatch/components/MetricsQueryEditor/MetricsQueryEditor.test.tsx +++ b/public/app/plugins/datasource/cloudwatch/components/MetricsQueryEditor/MetricsQueryEditor.test.tsx @@ -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(); - - 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; - }); - }); }); diff --git a/public/app/plugins/datasource/cloudwatch/migrations/metricQueryMigrations.test.ts b/public/app/plugins/datasource/cloudwatch/migrations/metricQueryMigrations.test.ts index db9911fe679..55a62c6644d 100644 --- a/public/app/plugins/datasource/cloudwatch/migrations/metricQueryMigrations.test.ts +++ b/public/app/plugins/datasource/cloudwatch/migrations/metricQueryMigrations.test.ts @@ -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); - }); - }); }); }); diff --git a/public/app/plugins/datasource/cloudwatch/migrations/useMigratedMetricsQuery.test.ts b/public/app/plugins/datasource/cloudwatch/migrations/useMigratedMetricsQuery.test.ts index 8459f146342..5ac0dde4410 100644 --- a/public/app/plugins/datasource/cloudwatch/migrations/useMigratedMetricsQuery.test.ts +++ b/public/app/plugins/datasource/cloudwatch/migrations/useMigratedMetricsQuery.test.ts @@ -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); - }); - }); });