Skip to content

Commit

Permalink
Remove experimental alert annotations in APM views (#127658)
Browse files Browse the repository at this point in the history
* remove alerts annotations

* removing API

* fixing i18n
  • Loading branch information
cauemarcondes authored Mar 15, 2022
1 parent 5da3f50 commit c6bcab6
Show file tree
Hide file tree
Showing 16 changed files with 14 additions and 839 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,22 @@

import {
Axis,
Chart,
BarSeries,
Chart,
niceTimeFormatter,
Position,
ScaleType,
Settings,
} from '@elastic/charts';
import { EuiTitle } from '@elastic/eui';
import React, { Suspense, useState } from 'react';
import { ALERT_RULE_TYPE_ID } from '@kbn/rule-data-utils';
import { i18n } from '@kbn/i18n';
import { useApmServiceContext } from '../../../../context/apm_service/use_apm_service_context';
import { APIReturnType } from '../../../../services/rest/create_call_apm_api';
import { useTheme } from '../../../../hooks/use_theme';
import { FETCH_STATUS } from '../../../../hooks/use_fetcher';
import { AlertType } from '../../../../../common/alert_types';
import { getAlertAnnotations } from '../../../shared/charts/helper/get_alert_annotations';
import { ChartContainer } from '../../../shared/charts/chart_container';
import React from 'react';
import { useApmPluginContext } from '../../../../context/apm_plugin/use_apm_plugin_context';
import { LazyAlertsFlyout } from '../../../../../../observability/public';
import { useLegacyUrlParams } from '../../../../context/url_params_context/use_url_params';
import { FETCH_STATUS } from '../../../../hooks/use_fetcher';
import { useTheme } from '../../../../hooks/use_theme';
import { APIReturnType } from '../../../../services/rest/create_call_apm_api';
import { ChartContainer } from '../../../shared/charts/chart_container';
import { getTimeZone } from '../../../shared/charts/helper/timezone';

type ErrorDistributionAPIResponse =
Expand Down Expand Up @@ -74,12 +69,6 @@ export function ErrorDistribution({ distribution, title, fetchStatus }: Props) {
const max = Math.max(...xValues);

const xFormatter = niceTimeFormatter([min, max]);
const { observabilityRuleTypeRegistry } = useApmPluginContext();
const { alerts } = useApmServiceContext();
const { getFormatter } = observabilityRuleTypeRegistry;
const [selectedAlertId, setSelectedAlertId] = useState<string | undefined>(
undefined
);

const timeZone = getTimeZone(core.uiSettings);

Expand Down Expand Up @@ -131,27 +120,6 @@ export function ErrorDistribution({ distribution, title, fetchStatus }: Props) {
/>
);
})}
{getAlertAnnotations({
alerts: alerts?.filter(
(alert) => alert[ALERT_RULE_TYPE_ID]?.[0] === AlertType.ErrorCount
),
chartStartTime: xValues[0],
getFormatter,
selectedAlertId,
setSelectedAlertId,
theme,
})}
<Suspense fallback={null}>
<LazyAlertsFlyout
alerts={alerts}
isInApp={true}
observabilityRuleTypeRegistry={observabilityRuleTypeRegistry}
onClose={() => {
setSelectedAlertId(undefined);
}}
selectedAlertId={selectedAlertId}
/>
</Suspense>
</Chart>
</ChartContainer>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const stories: Meta<{}> = {
uiSettings: { get: () => 'Browser' },
} as unknown as CoreStart;
const serviceContextValue = {
alerts: [],
serviceName,
} as unknown as APMServiceContextValue;
const KibanaReactContext = createKibanaReactContext(mockCore);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export default {
<APMServiceContext.Provider
value={{
agentName,
alerts: [],
transactionTypes: [],
serviceName,
fallbackToTransactions: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import { EuiPanel, EuiTitle } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';
import { ALERT_RULE_TYPE_ID } from '../../../../../../rule_registry/common/technical_rule_data_field_names';
import { AlertType } from '../../../../../common/alert_types';
import { APIReturnType } from '../../../../services/rest/create_call_apm_api';
import { asPercent } from '../../../../../common/utils/formatters';
import { useFetcher } from '../../../../hooks/use_fetcher';
Expand Down Expand Up @@ -72,7 +70,7 @@ export function FailedTransactionRateChart({
ApmMlDetectorType.txFailureRate
);

const { serviceName, transactionType, alerts } = useApmServiceContext();
const { serviceName, transactionType } = useApmServiceContext();

const comparisonChartTheme = getComparisonChartTheme();
const { comparisonStart, comparisonEnd } = getTimeRangeComparison({
Expand Down Expand Up @@ -167,10 +165,6 @@ export function FailedTransactionRateChart({
yDomain={{ min: 0, max: 1 }}
customTheme={comparisonChartTheme}
anomalyTimeseries={preferredAnomalyTimeseries}
alerts={alerts.filter(
(alert) =>
alert[ALERT_RULE_TYPE_ID]?.[0] === AlertType.TransactionErrorRate
)}
/>
</EuiPanel>
);
Expand Down

This file was deleted.

Loading

0 comments on commit c6bcab6

Please sign in to comment.