mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Features: Remove cloudwatchMetricInsightsCrossAccount feature toggle (#98826)
This commit is contained in:
@@ -274,7 +274,6 @@ To enable cross-account observability, complete the following steps:
|
||||
|
||||
Cross-account querying is available in the plugin through the **Logs**, **Metric search**, and **Metric Insights** modes.
|
||||
After you have it configured, you'll see a **Monitoring account** badge in the query editor header.
|
||||
To support cross-account query building in the **Metric Insight** builder mode, the `cloudwatchMetricInsightsCrossAccount` feature toggle should be enabled.
|
||||
|
||||
{{< figure src="/static/img/docs/cloudwatch/cloudwatch-monitoring-badge-9.3.0.png" max-width="1200px" caption="Monitoring account badge" >}}
|
||||
|
||||
|
||||
@@ -75,7 +75,6 @@ Most [generally available](https://grafana.com/docs/release-life-cycle/#general-
|
||||
| `openSearchBackendFlowEnabled` | Enables the backend query flow for Open Search datasource plugin | Yes |
|
||||
| `alertingApiServer` | Register Alerting APIs with the K8s API server | Yes |
|
||||
| `cloudWatchRoundUpEndTime` | Round up end time for metric queries to the next minute to avoid missing data | Yes |
|
||||
| `cloudwatchMetricInsightsCrossAccount` | Enables cross account observability for Cloudwatch Metric Insights query builder | Yes |
|
||||
| `newFiltersUI` | Enables new combobox style UI for the Ad hoc filters variable in scenes architecture | Yes |
|
||||
| `useSessionStorageForRedirection` | Use session storage for handling the redirection after login | Yes |
|
||||
| `userStorageAPI` | Enables the user storage API | Yes |
|
||||
|
||||
@@ -199,7 +199,6 @@ export interface FeatureToggles {
|
||||
enableScopesInMetricsExplore?: boolean;
|
||||
alertingApiServer?: boolean;
|
||||
cloudWatchRoundUpEndTime?: boolean;
|
||||
cloudwatchMetricInsightsCrossAccount?: boolean;
|
||||
prometheusAzureOverrideAudience?: boolean;
|
||||
alertingFilterV2?: boolean;
|
||||
dataplaneAggregator?: boolean;
|
||||
|
||||
@@ -1375,14 +1375,6 @@ var (
|
||||
Owner: awsDatasourcesSquad,
|
||||
Expression: "true",
|
||||
},
|
||||
{
|
||||
Name: "cloudwatchMetricInsightsCrossAccount",
|
||||
Description: "Enables cross account observability for Cloudwatch Metric Insights query builder",
|
||||
Stage: FeatureStageGeneralAvailability,
|
||||
Owner: awsDatasourcesSquad,
|
||||
FrontendOnly: true,
|
||||
Expression: "true",
|
||||
},
|
||||
{
|
||||
Name: "prometheusAzureOverrideAudience",
|
||||
Description: "Deprecated. Allow override default AAD audience for Azure Prometheus endpoint. Enabled by default. This feature should no longer be used and will be removed in the future.",
|
||||
|
||||
@@ -180,7 +180,6 @@ reloadDashboardsOnParamsChange,experimental,@grafana/dashboards-squad,false,fals
|
||||
enableScopesInMetricsExplore,experimental,@grafana/dashboards-squad,false,false,false
|
||||
alertingApiServer,GA,@grafana/alerting-squad,false,true,false
|
||||
cloudWatchRoundUpEndTime,GA,@grafana/aws-datasources,false,false,false
|
||||
cloudwatchMetricInsightsCrossAccount,GA,@grafana/aws-datasources,false,false,true
|
||||
prometheusAzureOverrideAudience,deprecated,@grafana/partner-datasources,false,false,false
|
||||
alertingFilterV2,experimental,@grafana/alerting-squad,false,false,false
|
||||
dataplaneAggregator,experimental,@grafana/grafana-app-platform-squad,false,true,false
|
||||
|
||||
|
@@ -731,10 +731,6 @@ const (
|
||||
// Round up end time for metric queries to the next minute to avoid missing data
|
||||
FlagCloudWatchRoundUpEndTime = "cloudWatchRoundUpEndTime"
|
||||
|
||||
// FlagCloudwatchMetricInsightsCrossAccount
|
||||
// Enables cross account observability for Cloudwatch Metric Insights query builder
|
||||
FlagCloudwatchMetricInsightsCrossAccount = "cloudwatchMetricInsightsCrossAccount"
|
||||
|
||||
// FlagPrometheusAzureOverrideAudience
|
||||
// Deprecated. Allow override default AAD audience for Azure Prometheus endpoint. Enabled by default. This feature should no longer be used and will be removed in the future.
|
||||
FlagPrometheusAzureOverrideAudience = "prometheusAzureOverrideAudience"
|
||||
|
||||
@@ -869,6 +869,7 @@
|
||||
"name": "cloudwatchMetricInsightsCrossAccount",
|
||||
"resourceVersion": "1729265619643",
|
||||
"creationTimestamp": "2024-07-02T10:34:12Z",
|
||||
"deletionTimestamp": "2025-01-10T15:06:19Z",
|
||||
"annotations": {
|
||||
"grafana.app/updatedTimestamp": "2024-10-18 15:33:39.643165 +0000 UTC"
|
||||
}
|
||||
|
||||
@@ -53,10 +53,7 @@ const SQLBuilderSelectRow = ({ datasource, query, onQueryChange }: SQLBuilderSel
|
||||
const metricOptions = useMetrics(datasource, {
|
||||
region: query.region,
|
||||
namespace,
|
||||
...(config.featureToggles.cloudWatchCrossAccountQuerying &&
|
||||
config.featureToggles.cloudwatchMetricInsightsCrossAccount
|
||||
? { accountId: query.accountId }
|
||||
: {}),
|
||||
...(config.featureToggles.cloudWatchCrossAccountQuerying && { accountId: query.accountId }),
|
||||
});
|
||||
const existingFilters = useMemo(() => stringArrayToDimensions(schemaLabels ?? []), [schemaLabels]);
|
||||
const unusedDimensionKeys = useDimensionKeys(datasource, {
|
||||
@@ -64,10 +61,7 @@ const SQLBuilderSelectRow = ({ datasource, query, onQueryChange }: SQLBuilderSel
|
||||
namespace,
|
||||
metricName,
|
||||
dimensionFilters: existingFilters,
|
||||
...(config.featureToggles.cloudWatchCrossAccountQuerying &&
|
||||
config.featureToggles.cloudwatchMetricInsightsCrossAccount
|
||||
? { accountId: query.accountId }
|
||||
: {}),
|
||||
...(config.featureToggles.cloudWatchCrossAccountQuerying && { accountId: query.accountId }),
|
||||
});
|
||||
const dimensionKeys = useMemo(
|
||||
() => (schemaLabels?.length ? [...unusedDimensionKeys, ...schemaLabels.map(toOption)] : unusedDimensionKeys),
|
||||
@@ -93,19 +87,18 @@ const SQLBuilderSelectRow = ({ datasource, query, onQueryChange }: SQLBuilderSel
|
||||
return (
|
||||
<>
|
||||
<EditorFieldGroup>
|
||||
{config.featureToggles.cloudWatchCrossAccountQuerying &&
|
||||
config.featureToggles.cloudwatchMetricInsightsCrossAccount && (
|
||||
<Account
|
||||
accountId={query.accountId}
|
||||
accountOptions={accountState.value || []}
|
||||
onChange={(accountId) => {
|
||||
onQueryChange({
|
||||
...query,
|
||||
accountId,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{config.featureToggles.cloudWatchCrossAccountQuerying && (
|
||||
<Account
|
||||
accountId={query.accountId}
|
||||
accountOptions={accountState.value || []}
|
||||
onChange={(accountId) => {
|
||||
onQueryChange({
|
||||
...query,
|
||||
accountId,
|
||||
});
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<EditorField label="Namespace" width={16}>
|
||||
<Select
|
||||
aria-label="Namespace"
|
||||
|
||||
@@ -113,10 +113,7 @@ const FilterItem = (props: FilterItemProps) => {
|
||||
region: query.region,
|
||||
namespace,
|
||||
metricName,
|
||||
...(config.featureToggles.cloudWatchCrossAccountQuerying &&
|
||||
config.featureToggles.cloudwatchMetricInsightsCrossAccount
|
||||
? { accountId: query.accountId }
|
||||
: {}),
|
||||
...(config.featureToggles.cloudWatchCrossAccountQuerying && { accountId: query.accountId }),
|
||||
});
|
||||
|
||||
const loadDimensionValues = async () => {
|
||||
@@ -130,10 +127,7 @@ const FilterItem = (props: FilterItemProps) => {
|
||||
namespace,
|
||||
metricName,
|
||||
dimensionKey: filter.property.name,
|
||||
...(config.featureToggles.cloudWatchCrossAccountQuerying &&
|
||||
config.featureToggles.cloudwatchMetricInsightsCrossAccount
|
||||
? { accountId: query.accountId }
|
||||
: {}),
|
||||
...(config.featureToggles.cloudWatchCrossAccountQuerying && { accountId: query.accountId }),
|
||||
})
|
||||
.then((result: Array<SelectableValue<string>>) => {
|
||||
return appendTemplateVariables(datasource, result);
|
||||
|
||||
@@ -61,9 +61,8 @@ describe('Cloudwatch SQLGroupBy', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should show Account ID in groupBy options if feature flag is enabled', async () => {
|
||||
it('should show Account ID in groupBy options if cloudWatchCrossAccountQuerying feature flag is enabled', async () => {
|
||||
config.featureToggles.cloudWatchCrossAccountQuerying = true;
|
||||
config.featureToggles.cloudwatchMetricInsightsCrossAccount = true;
|
||||
baseProps.datasource.resources.isMonitoringAccount = jest.fn().mockResolvedValue(true);
|
||||
const query = makeSQLQuery();
|
||||
|
||||
@@ -76,7 +75,6 @@ describe('Cloudwatch SQLGroupBy', () => {
|
||||
|
||||
it('should not show Account ID in groupBy options if not using a monitoring account', async () => {
|
||||
config.featureToggles.cloudWatchCrossAccountQuerying = true;
|
||||
config.featureToggles.cloudwatchMetricInsightsCrossAccount = true;
|
||||
baseProps.datasource.resources.isMonitoringAccount = jest.fn().mockResolvedValue(false);
|
||||
|
||||
const query = makeSQLQuery();
|
||||
@@ -88,17 +86,6 @@ describe('Cloudwatch SQLGroupBy', () => {
|
||||
expect(screen.queryByText('Account ID')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should not show Account ID in groupBy options if feature flag is disabled', async () => {
|
||||
config.featureToggles.cloudwatchMetricInsightsCrossAccount = false;
|
||||
const query = makeSQLQuery();
|
||||
|
||||
render(<SQLGroupBy {...baseProps} query={query} />);
|
||||
const addButton = screen.getByRole('button', { name: 'Add' });
|
||||
await userEvent.click(addButton);
|
||||
selectEvent.openMenu(screen.getByLabelText(/Group by/));
|
||||
expect(screen.queryByText('Account ID')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should allow adding a new dimension filter', async () => {
|
||||
const query = makeSQLQuery({
|
||||
groupBy: undefined,
|
||||
|
||||
@@ -41,9 +41,7 @@ const SQLGroupBy = ({ query, datasource, onQueryChange }: SQLGroupByProps) => {
|
||||
const options = useMemo(
|
||||
// Exclude options we've already selected
|
||||
() => {
|
||||
const isCrossAccountEnabled =
|
||||
config.featureToggles.cloudWatchCrossAccountQuerying &&
|
||||
config.featureToggles.cloudwatchMetricInsightsCrossAccount;
|
||||
const isCrossAccountEnabled = config.featureToggles.cloudWatchCrossAccountQuerying;
|
||||
|
||||
const baseOptionsWithAccountId =
|
||||
isCrossAccountEnabled && isMonitoringAccount
|
||||
|
||||
@@ -209,11 +209,6 @@ describe('QueryEditor should render right editor', () => {
|
||||
|
||||
describe('should not be displayed when a monitoring account is returned and', () => {
|
||||
const cases: MonitoringBadgeScenario[] = [
|
||||
{
|
||||
name: 'it is metric insights builder query and toggle is enabled',
|
||||
query: validMetricQueryBuilderQuery,
|
||||
toggle: true,
|
||||
},
|
||||
{
|
||||
name: 'it is metric insights code query and toggle is not enabled',
|
||||
query: validMetricQueryCodeQuery,
|
||||
@@ -342,18 +337,14 @@ describe('QueryEditor should render right editor', () => {
|
||||
|
||||
describe('metric insights in builder mode', () => {
|
||||
let originalValueCloudWatchCrossAccountQuerying: boolean | undefined;
|
||||
let originalValueCloudwatchMetricInsightsCrossAccount: boolean | undefined;
|
||||
beforeEach(() => {
|
||||
originalValueCloudWatchCrossAccountQuerying = config.featureToggles.cloudWatchCrossAccountQuerying;
|
||||
originalValueCloudwatchMetricInsightsCrossAccount = config.featureToggles.cloudwatchMetricInsightsCrossAccount;
|
||||
});
|
||||
afterEach(() => {
|
||||
config.featureToggles.cloudWatchCrossAccountQuerying = originalValueCloudWatchCrossAccountQuerying;
|
||||
config.featureToggles.cloudwatchMetricInsightsCrossAccount = originalValueCloudwatchMetricInsightsCrossAccount;
|
||||
});
|
||||
it('should have an account selector when the feature is enabled', async () => {
|
||||
config.featureToggles.cloudWatchCrossAccountQuerying = true;
|
||||
config.featureToggles.cloudwatchMetricInsightsCrossAccount = true;
|
||||
props.datasource.resources.getAccounts = jest.fn().mockResolvedValue(['account123']);
|
||||
render(<QueryEditor {...props} query={validMetricQueryBuilderQuery} />);
|
||||
await screen.findByText('Metric Insights');
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Badge, Button } from '@grafana/ui';
|
||||
import { CloudWatchDatasource } from '../../datasource';
|
||||
import { isCloudWatchLogsQuery, isCloudWatchMetricsQuery } from '../../guards';
|
||||
import { useIsMonitoringAccount, useRegions } from '../../hooks';
|
||||
import { CloudWatchJsonData, CloudWatchQuery, CloudWatchQueryMode, MetricQueryType } from '../../types';
|
||||
import { CloudWatchJsonData, CloudWatchQuery, CloudWatchQueryMode } from '../../types';
|
||||
|
||||
export interface Props extends QueryEditorProps<CloudWatchDatasource, CloudWatchQuery, CloudWatchJsonData> {
|
||||
extraHeaderElementLeft?: JSX.Element;
|
||||
@@ -52,16 +52,8 @@ const QueryHeader = ({
|
||||
onChange({ ...query, region });
|
||||
}
|
||||
};
|
||||
const metricInsightsCrossAccountEnabled = config.featureToggles.cloudwatchMetricInsightsCrossAccount;
|
||||
|
||||
const shouldDisplayMonitoringBadge =
|
||||
config.featureToggles.cloudWatchCrossAccountQuerying &&
|
||||
isMonitoringAccount &&
|
||||
(query.queryMode === 'Logs' ||
|
||||
(isCloudWatchMetricsQuery(query) && query.metricQueryType === MetricQueryType.Search) ||
|
||||
(metricInsightsCrossAccountEnabled &&
|
||||
isCloudWatchMetricsQuery(query) &&
|
||||
query.metricQueryType === MetricQueryType.Insights));
|
||||
const shouldDisplayMonitoringBadge = config.featureToggles.cloudWatchCrossAccountQuerying && isMonitoringAccount;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user