mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[APM] Rename alert type to rule type (#143706)
This commit is contained in:
parent
758bb68651
commit
d108b48d6f
54 changed files with 348 additions and 367 deletions
|
@ -1,20 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
export const apmRuleFieldMap = {
|
||||
'service.environment': {
|
||||
type: 'keyword',
|
||||
},
|
||||
'transaction.type': {
|
||||
type: 'keyword',
|
||||
},
|
||||
'processor.event': {
|
||||
type: 'keyword',
|
||||
},
|
||||
} as const;
|
||||
|
||||
export type APMRuleFieldMap = typeof apmRuleFieldMap;
|
|
@ -1,10 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
export const apmRuleRegistrySettings = {
|
||||
name: 'apm',
|
||||
};
|
|
@ -14,11 +14,11 @@ import type {
|
|||
} from '@kbn/observability-plugin/common';
|
||||
import type { ActionGroup } from '@kbn/alerting-plugin/common';
|
||||
import { formatDurationFromTimeUnitChar } from '@kbn/observability-plugin/common';
|
||||
import { ANOMALY_SEVERITY, ANOMALY_THRESHOLD } from './ml_constants';
|
||||
import { ANOMALY_SEVERITY, ANOMALY_THRESHOLD } from '../ml_constants';
|
||||
|
||||
export const APM_SERVER_FEATURE_ID = 'apm';
|
||||
|
||||
export enum AlertType {
|
||||
export enum ApmRuleType {
|
||||
ErrorCount = 'apm.error_rate', // ErrorRate was renamed to ErrorCount but the key is kept as `error_rate` for backwards-compat.
|
||||
TransactionErrorRate = 'apm.transaction_error_rate',
|
||||
TransactionDuration = 'apm.transaction_duration',
|
||||
|
@ -163,8 +163,8 @@ export function formatAnomalyReason({
|
|||
);
|
||||
}
|
||||
|
||||
export const ALERT_TYPES_CONFIG: Record<
|
||||
AlertType,
|
||||
export const RULE_TYPES_CONFIG: Record<
|
||||
ApmRuleType,
|
||||
{
|
||||
name: string;
|
||||
actionGroups: Array<ActionGroup<ThresholdMetActionGroupId>>;
|
||||
|
@ -174,7 +174,7 @@ export const ALERT_TYPES_CONFIG: Record<
|
|||
producer: string;
|
||||
}
|
||||
> = {
|
||||
[AlertType.ErrorCount]: {
|
||||
[ApmRuleType.ErrorCount]: {
|
||||
name: i18n.translate('xpack.apm.errorCountAlert.name', {
|
||||
defaultMessage: 'Error count threshold',
|
||||
}),
|
||||
|
@ -184,7 +184,7 @@ export const ALERT_TYPES_CONFIG: Record<
|
|||
producer: APM_SERVER_FEATURE_ID,
|
||||
isExportable: true,
|
||||
},
|
||||
[AlertType.TransactionDuration]: {
|
||||
[ApmRuleType.TransactionDuration]: {
|
||||
name: i18n.translate('xpack.apm.transactionDurationAlert.name', {
|
||||
defaultMessage: 'Latency threshold',
|
||||
}),
|
||||
|
@ -194,7 +194,7 @@ export const ALERT_TYPES_CONFIG: Record<
|
|||
producer: APM_SERVER_FEATURE_ID,
|
||||
isExportable: true,
|
||||
},
|
||||
[AlertType.Anomaly]: {
|
||||
[ApmRuleType.Anomaly]: {
|
||||
name: i18n.translate('xpack.apm.anomalyAlert.name', {
|
||||
defaultMessage: 'Anomaly',
|
||||
}),
|
||||
|
@ -204,7 +204,7 @@ export const ALERT_TYPES_CONFIG: Record<
|
|||
producer: APM_SERVER_FEATURE_ID,
|
||||
isExportable: true,
|
||||
},
|
||||
[AlertType.TransactionErrorRate]: {
|
||||
[ApmRuleType.TransactionErrorRate]: {
|
||||
name: i18n.translate('xpack.apm.transactionErrorRateAlert.name', {
|
||||
defaultMessage: 'Failed transaction rate threshold',
|
||||
}),
|
|
@ -9,11 +9,10 @@ import { Meta, Story } from '@storybook/react';
|
|||
import React, { useState } from 'react';
|
||||
import { CoreStart } from '@kbn/core/public';
|
||||
import { createKibanaReactContext } from '@kbn/kibana-react-plugin/public';
|
||||
import { RuleParams, ErrorCountAlertTrigger } from '.';
|
||||
import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values';
|
||||
import { createCallApmApi } from '../../../services/rest/create_call_apm_api';
|
||||
|
||||
import { AlertMetadata } from '../helper';
|
||||
import { RuleParams, ErrorCountRuleType } from '.';
|
||||
import { ENVIRONMENT_ALL } from '../../../../../common/environment_filter_values';
|
||||
import { createCallApmApi } from '../../../../services/rest/create_call_apm_api';
|
||||
import { AlertMetadata } from '../../utils/helper';
|
||||
|
||||
const coreMock = {
|
||||
http: { get: async () => ({}) },
|
||||
|
@ -29,8 +28,8 @@ interface Args {
|
|||
}
|
||||
|
||||
const stories: Meta<{}> = {
|
||||
title: 'alerting/ErrorCountAlertTrigger',
|
||||
component: ErrorCountAlertTrigger,
|
||||
title: 'alerting/ErrorCountRuleType',
|
||||
component: ErrorCountRuleType,
|
||||
decorators: [
|
||||
(StoryComponent) => {
|
||||
createCallApmApi(coreMock);
|
||||
|
@ -58,7 +57,7 @@ export const CreatingInApmFromInventory: Story<Args> = ({
|
|||
}
|
||||
|
||||
return (
|
||||
<ErrorCountAlertTrigger
|
||||
<ErrorCountRuleType
|
||||
ruleParams={params}
|
||||
metadata={metadata}
|
||||
setRuleParams={setRuleParams}
|
||||
|
@ -87,7 +86,7 @@ export const CreatingInApmFromService: Story<Args> = ({
|
|||
}
|
||||
|
||||
return (
|
||||
<ErrorCountAlertTrigger
|
||||
<ErrorCountRuleType
|
||||
ruleParams={params}
|
||||
metadata={metadata}
|
||||
setRuleParams={setRuleParams}
|
||||
|
@ -116,7 +115,7 @@ export const EditingInStackManagement: Story<Args> = ({
|
|||
}
|
||||
|
||||
return (
|
||||
<ErrorCountAlertTrigger
|
||||
<ErrorCountRuleType
|
||||
ruleParams={params}
|
||||
metadata={metadata}
|
||||
setRuleParams={setRuleParams}
|
||||
|
@ -146,7 +145,7 @@ export const CreatingInStackManagement: Story<Args> = ({
|
|||
}
|
||||
|
||||
return (
|
||||
<ErrorCountAlertTrigger
|
||||
<ErrorCountRuleType
|
||||
ruleParams={params}
|
||||
metadata={metadata}
|
||||
setRuleParams={setRuleParams}
|
|
@ -7,12 +7,12 @@
|
|||
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import * as stories from './error_count_alert_trigger.stories';
|
||||
import * as stories from './index.stories';
|
||||
import { composeStories } from '@storybook/testing-react';
|
||||
|
||||
const { CreatingInApmFromService } = composeStories(stories);
|
||||
|
||||
describe('ErrorCountAlertTrigger', () => {
|
||||
describe('ErrorCountRuleType', () => {
|
||||
it('renders', async () => {
|
||||
render(<CreatingInApmFromService />);
|
||||
|
|
@ -11,14 +11,22 @@ import React, { useEffect } from 'react';
|
|||
import { CoreStart } from '@kbn/core/public';
|
||||
import { useKibana } from '@kbn/kibana-react-plugin/public';
|
||||
import { ForLastExpression } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values';
|
||||
import { asInteger } from '../../../../common/utils/formatters';
|
||||
import { useFetcher } from '../../../hooks/use_fetcher';
|
||||
import { createCallApmApi } from '../../../services/rest/create_call_apm_api';
|
||||
import { ChartPreview } from '../chart_preview';
|
||||
import { EnvironmentField, IsAboveField, ServiceField } from '../fields';
|
||||
import { AlertMetadata, getIntervalAndTimeRange, TimeUnit } from '../helper';
|
||||
import { ServiceAlertTrigger } from '../service_alert_trigger';
|
||||
import { ENVIRONMENT_ALL } from '../../../../../common/environment_filter_values';
|
||||
import { asInteger } from '../../../../../common/utils/formatters';
|
||||
import { useFetcher } from '../../../../hooks/use_fetcher';
|
||||
import { createCallApmApi } from '../../../../services/rest/create_call_apm_api';
|
||||
import { ChartPreview } from '../../ui_components/chart_preview';
|
||||
import {
|
||||
EnvironmentField,
|
||||
IsAboveField,
|
||||
ServiceField,
|
||||
} from '../../utils/fields';
|
||||
import {
|
||||
AlertMetadata,
|
||||
getIntervalAndTimeRange,
|
||||
TimeUnit,
|
||||
} from '../../utils/helper';
|
||||
import { ApmRuleParamsContainer } from '../../ui_components/apm_rule_params_container';
|
||||
|
||||
export interface RuleParams {
|
||||
windowSize?: number;
|
||||
|
@ -35,7 +43,7 @@ interface Props {
|
|||
setRuleProperty: (key: string, value: any) => void;
|
||||
}
|
||||
|
||||
export function ErrorCountAlertTrigger(props: Props) {
|
||||
export function ErrorCountRuleType(props: Props) {
|
||||
const { services } = useKibana();
|
||||
const { ruleParams, metadata, setRuleParams, setRuleProperty } = props;
|
||||
|
||||
|
@ -61,7 +69,7 @@ export function ErrorCountAlertTrigger(props: Props) {
|
|||
});
|
||||
if (interval && start && end) {
|
||||
return callApmApi(
|
||||
'GET /internal/apm/alerts/chart_preview/transaction_error_count',
|
||||
'GET /internal/apm/rule_types/error_count/chart_preview',
|
||||
{
|
||||
params: {
|
||||
query: {
|
||||
|
@ -95,7 +103,7 @@ export function ErrorCountAlertTrigger(props: Props) {
|
|||
/>,
|
||||
<IsAboveField
|
||||
value={params.threshold}
|
||||
unit={i18n.translate('xpack.apm.errorCountAlertTrigger.errors', {
|
||||
unit={i18n.translate('xpack.apm.errorCountRuleType.errors', {
|
||||
defaultMessage: ' errors',
|
||||
})}
|
||||
onChange={(value) => setRuleParams('threshold', value || 0)}
|
||||
|
@ -126,7 +134,7 @@ export function ErrorCountAlertTrigger(props: Props) {
|
|||
);
|
||||
|
||||
return (
|
||||
<ServiceAlertTrigger
|
||||
<ApmRuleParamsContainer
|
||||
defaults={params}
|
||||
fields={fields}
|
||||
setRuleParams={setRuleParams}
|
||||
|
@ -139,4 +147,4 @@ export function ErrorCountAlertTrigger(props: Props) {
|
|||
// Default export is required for React.lazy loading
|
||||
//
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default ErrorCountAlertTrigger;
|
||||
export default ErrorCountRuleType;
|
|
@ -12,19 +12,19 @@ import type { ObservabilityRuleTypeRegistry } from '@kbn/observability-plugin/pu
|
|||
import {
|
||||
getAlertUrlErrorCount,
|
||||
getAlertUrlTransaction,
|
||||
} from '../../../common/utils/formatters';
|
||||
import { AlertType } from '../../../common/alert_types';
|
||||
} from '../../../../common/utils/formatters';
|
||||
import { ApmRuleType } from '../../../../common/rules/apm_rule_types';
|
||||
|
||||
// copied from elasticsearch_fieldnames.ts to limit page load bundle size
|
||||
const SERVICE_ENVIRONMENT = 'service.environment';
|
||||
const SERVICE_NAME = 'service.name';
|
||||
const TRANSACTION_TYPE = 'transaction.type';
|
||||
|
||||
export function registerApmAlerts(
|
||||
export function registerApmRuleTypes(
|
||||
observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry
|
||||
) {
|
||||
observabilityRuleTypeRegistry.register({
|
||||
id: AlertType.ErrorCount,
|
||||
id: ApmRuleType.ErrorCount,
|
||||
description: i18n.translate('xpack.apm.alertTypes.errorCount.description', {
|
||||
defaultMessage:
|
||||
'Alert when the number of errors in a service exceeds a defined threshold.',
|
||||
|
@ -42,7 +42,7 @@ export function registerApmAlerts(
|
|||
documentationUrl(docLinks) {
|
||||
return `${docLinks.links.alerting.apmRules}`;
|
||||
},
|
||||
ruleParamsExpression: lazy(() => import('./error_count_alert_trigger')),
|
||||
ruleParamsExpression: lazy(() => import('./error_count_rule_type')),
|
||||
validate: () => ({
|
||||
errors: [],
|
||||
}),
|
||||
|
@ -61,7 +61,7 @@ export function registerApmAlerts(
|
|||
});
|
||||
|
||||
observabilityRuleTypeRegistry.register({
|
||||
id: AlertType.TransactionDuration,
|
||||
id: ApmRuleType.TransactionDuration,
|
||||
description: i18n.translate(
|
||||
'xpack.apm.alertTypes.transactionDuration.description',
|
||||
{
|
||||
|
@ -84,7 +84,7 @@ export function registerApmAlerts(
|
|||
return `${docLinks.links.alerting.apmRules}`;
|
||||
},
|
||||
ruleParamsExpression: lazy(
|
||||
() => import('./transaction_duration_alert_trigger')
|
||||
() => import('./transaction_duration_rule_type')
|
||||
),
|
||||
validate: () => ({
|
||||
errors: [],
|
||||
|
@ -105,7 +105,7 @@ export function registerApmAlerts(
|
|||
});
|
||||
|
||||
observabilityRuleTypeRegistry.register({
|
||||
id: AlertType.TransactionErrorRate,
|
||||
id: ApmRuleType.TransactionErrorRate,
|
||||
description: i18n.translate(
|
||||
'xpack.apm.alertTypes.transactionErrorRate.description',
|
||||
{
|
||||
|
@ -126,7 +126,7 @@ export function registerApmAlerts(
|
|||
return `${docLinks.links.alerting.apmRules}`;
|
||||
},
|
||||
ruleParamsExpression: lazy(
|
||||
() => import('./transaction_error_rate_alert_trigger')
|
||||
() => import('./transaction_error_rate_rule_type')
|
||||
),
|
||||
validate: () => ({
|
||||
errors: [],
|
||||
|
@ -147,7 +147,7 @@ export function registerApmAlerts(
|
|||
});
|
||||
|
||||
observabilityRuleTypeRegistry.register({
|
||||
id: AlertType.Anomaly,
|
||||
id: ApmRuleType.Anomaly,
|
||||
description: i18n.translate('xpack.apm.alertTypes.anomaly.description', {
|
||||
defaultMessage:
|
||||
'Alert when either the latency, throughput, or failed transaction rate of a service is anomalous.',
|
||||
|
@ -165,7 +165,7 @@ export function registerApmAlerts(
|
|||
return `${docLinks.links.alerting.apmRules}`;
|
||||
},
|
||||
ruleParamsExpression: lazy(
|
||||
() => import('./transaction_duration_anomaly_alert_trigger')
|
||||
() => import('./transaction_duration_anomaly_rule_type')
|
||||
),
|
||||
validate: () => ({
|
||||
errors: [],
|
|
@ -10,17 +10,17 @@ import { defaults, omit } from 'lodash';
|
|||
import React, { useEffect } from 'react';
|
||||
import { CoreStart } from '@kbn/core/public';
|
||||
import { useKibana } from '@kbn/kibana-react-plugin/public';
|
||||
import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values';
|
||||
import { ANOMALY_SEVERITY } from '../../../../common/ml_constants';
|
||||
import { createCallApmApi } from '../../../services/rest/create_call_apm_api';
|
||||
import { ENVIRONMENT_ALL } from '../../../../../common/environment_filter_values';
|
||||
import { ANOMALY_SEVERITY } from '../../../../../common/ml_constants';
|
||||
import { createCallApmApi } from '../../../../services/rest/create_call_apm_api';
|
||||
import {
|
||||
EnvironmentField,
|
||||
ServiceField,
|
||||
TransactionTypeField,
|
||||
} from '../fields';
|
||||
import { AlertMetadata } from '../helper';
|
||||
import { ServiceAlertTrigger } from '../service_alert_trigger';
|
||||
import { PopoverExpression } from '../service_alert_trigger/popover_expression';
|
||||
} from '../../utils/fields';
|
||||
import { AlertMetadata } from '../../utils/helper';
|
||||
import { ApmRuleParamsContainer } from '../../ui_components/apm_rule_params_container';
|
||||
import { PopoverExpression } from '../../ui_components/popover_expression';
|
||||
import {
|
||||
AnomalySeverity,
|
||||
SelectAnomalySeverity,
|
||||
|
@ -46,7 +46,7 @@ interface Props {
|
|||
setRuleProperty: (key: string, value: any) => void;
|
||||
}
|
||||
|
||||
export function TransactionDurationAnomalyAlertTrigger(props: Props) {
|
||||
export function TransactionDurationAnomalyRuleType(props: Props) {
|
||||
const { services } = useKibana();
|
||||
const { ruleParams, metadata, setRuleParams, setRuleProperty } = props;
|
||||
|
||||
|
@ -83,7 +83,7 @@ export function TransactionDurationAnomalyAlertTrigger(props: Props) {
|
|||
<PopoverExpression
|
||||
value={<AnomalySeverity type={params.anomalySeverityType} />}
|
||||
title={i18n.translate(
|
||||
'xpack.apm.transactionDurationAnomalyAlertTrigger.anomalySeverity',
|
||||
'xpack.apm.transactionDurationAnomalyRuleType.anomalySeverity',
|
||||
{
|
||||
defaultMessage: 'Has anomaly with severity',
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ export function TransactionDurationAnomalyAlertTrigger(props: Props) {
|
|||
];
|
||||
|
||||
return (
|
||||
<ServiceAlertTrigger
|
||||
<ApmRuleParamsContainer
|
||||
fields={fields}
|
||||
defaults={params}
|
||||
setRuleParams={setRuleParams}
|
||||
|
@ -111,4 +111,4 @@ export function TransactionDurationAnomalyAlertTrigger(props: Props) {
|
|||
// Default export is required for React.lazy loading
|
||||
//
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default TransactionDurationAnomalyAlertTrigger;
|
||||
export default TransactionDurationAnomalyRuleType;
|
|
@ -8,7 +8,7 @@
|
|||
import { render } from '@testing-library/react';
|
||||
import React, { ReactNode } from 'react';
|
||||
import { __IntlProvider as IntlProvider } from '@kbn/i18n-react';
|
||||
import { ANOMALY_SEVERITY } from '../../../../common/ml_constants';
|
||||
import { ANOMALY_SEVERITY } from '../../../../../common/ml_constants';
|
||||
import { SelectAnomalySeverity } from './select_anomaly_severity';
|
||||
|
||||
function Wrapper({ children }: { children?: ReactNode }) {
|
|
@ -8,11 +8,11 @@
|
|||
import React from 'react';
|
||||
import { FormattedMessage } from '@kbn/i18n-react';
|
||||
import { EuiHealth, EuiSpacer, EuiSuperSelect, EuiText } from '@elastic/eui';
|
||||
import { getSeverityColor } from '../../../../common/anomaly_detection';
|
||||
import { getSeverityColor } from '../../../../../common/anomaly_detection';
|
||||
import {
|
||||
AnomalyAlertSeverityType,
|
||||
ANOMALY_ALERT_SEVERITY_TYPES,
|
||||
} from '../../../../common/alert_types';
|
||||
} from '../../../../../common/rules/apm_rule_types';
|
||||
|
||||
export function AnomalySeverity({ type }: { type: AnomalyAlertSeverityType }) {
|
||||
const selectedOption = ANOMALY_ALERT_SEVERITY_TYPES.find(
|
|
@ -9,16 +9,16 @@ import { Story } from '@storybook/react';
|
|||
import React, { ComponentType, useState } from 'react';
|
||||
import { CoreStart } from '@kbn/core/public';
|
||||
import { createKibanaReactContext } from '@kbn/kibana-react-plugin/public';
|
||||
import { RuleParams, TransactionDurationAlertTrigger } from '.';
|
||||
import { AggregationType } from '../../../../common/alert_types';
|
||||
import { RuleParams, TransactionDurationRuleType } from '.';
|
||||
import { AggregationType } from '../../../../../common/rules/apm_rule_types';
|
||||
|
||||
const KibanaReactContext = createKibanaReactContext({
|
||||
notifications: { toasts: { add: () => {} } },
|
||||
} as unknown as Partial<CoreStart>);
|
||||
|
||||
export default {
|
||||
title: 'alerting/TransactionDurationAlertTrigger',
|
||||
component: TransactionDurationAlertTrigger,
|
||||
title: 'alerting/TransactionDurationRuleType',
|
||||
component: TransactionDurationRuleType,
|
||||
decorators: [
|
||||
(StoryComponent: ComponentType) => {
|
||||
return (
|
||||
|
@ -48,7 +48,7 @@ export const Example: Story = () => {
|
|||
}
|
||||
|
||||
return (
|
||||
<TransactionDurationAlertTrigger
|
||||
<TransactionDurationRuleType
|
||||
ruleParams={params}
|
||||
setRuleParams={setRuleParams}
|
||||
setRuleProperty={() => {}}
|
|
@ -12,25 +12,29 @@ import React, { useEffect } from 'react';
|
|||
import { CoreStart } from '@kbn/core/public';
|
||||
import { useKibana } from '@kbn/kibana-react-plugin/public';
|
||||
import { ForLastExpression } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { AggregationType } from '../../../../common/alert_types';
|
||||
import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values';
|
||||
import { getDurationFormatter } from '../../../../common/utils/formatters';
|
||||
import { useFetcher } from '../../../hooks/use_fetcher';
|
||||
import { createCallApmApi } from '../../../services/rest/create_call_apm_api';
|
||||
import { AggregationType } from '../../../../../common/rules/apm_rule_types';
|
||||
import { ENVIRONMENT_ALL } from '../../../../../common/environment_filter_values';
|
||||
import { getDurationFormatter } from '../../../../../common/utils/formatters';
|
||||
import { useFetcher } from '../../../../hooks/use_fetcher';
|
||||
import { createCallApmApi } from '../../../../services/rest/create_call_apm_api';
|
||||
import {
|
||||
getMaxY,
|
||||
getResponseTimeTickFormatter,
|
||||
} from '../../shared/charts/transaction_charts/helper';
|
||||
import { ChartPreview } from '../chart_preview';
|
||||
} from '../../../shared/charts/transaction_charts/helper';
|
||||
import { ChartPreview } from '../../ui_components/chart_preview';
|
||||
import {
|
||||
EnvironmentField,
|
||||
IsAboveField,
|
||||
ServiceField,
|
||||
TransactionTypeField,
|
||||
} from '../fields';
|
||||
import { AlertMetadata, getIntervalAndTimeRange, TimeUnit } from '../helper';
|
||||
import { ServiceAlertTrigger } from '../service_alert_trigger';
|
||||
import { PopoverExpression } from '../service_alert_trigger/popover_expression';
|
||||
} from '../../utils/fields';
|
||||
import {
|
||||
AlertMetadata,
|
||||
getIntervalAndTimeRange,
|
||||
TimeUnit,
|
||||
} from '../../utils/helper';
|
||||
import { ApmRuleParamsContainer } from '../../ui_components/apm_rule_params_container';
|
||||
import { PopoverExpression } from '../../ui_components/popover_expression';
|
||||
|
||||
export interface RuleParams {
|
||||
aggregationType: AggregationType;
|
||||
|
@ -64,7 +68,7 @@ interface Props {
|
|||
setRuleProperty: (key: string, value: any) => void;
|
||||
}
|
||||
|
||||
export function TransactionDurationAlertTrigger(props: Props) {
|
||||
export function TransactionDurationRuleType(props: Props) {
|
||||
const { services } = useKibana();
|
||||
const { ruleParams, metadata, setRuleParams, setRuleProperty } = props;
|
||||
|
||||
|
@ -94,7 +98,7 @@ export function TransactionDurationAlertTrigger(props: Props) {
|
|||
});
|
||||
if (interval && start && end) {
|
||||
return callApmApi(
|
||||
'GET /internal/apm/alerts/chart_preview/transaction_duration',
|
||||
'GET /internal/apm/rule_types/transaction_duration/chart_preview',
|
||||
{
|
||||
params: {
|
||||
query: {
|
||||
|
@ -155,7 +159,7 @@ export function TransactionDurationAlertTrigger(props: Props) {
|
|||
/>,
|
||||
<PopoverExpression
|
||||
value={params.aggregationType}
|
||||
title={i18n.translate('xpack.apm.transactionDurationAlertTrigger.when', {
|
||||
title={i18n.translate('xpack.apm.transactionDurationRuleType.when', {
|
||||
defaultMessage: 'When',
|
||||
})}
|
||||
>
|
||||
|
@ -173,7 +177,7 @@ export function TransactionDurationAlertTrigger(props: Props) {
|
|||
</PopoverExpression>,
|
||||
<IsAboveField
|
||||
value={params.threshold}
|
||||
unit={i18n.translate('xpack.apm.transactionDurationAlertTrigger.ms', {
|
||||
unit={i18n.translate('xpack.apm.transactionDurationRuleType.ms', {
|
||||
defaultMessage: 'ms',
|
||||
})}
|
||||
onChange={(value) => setRuleParams('threshold', value || 0)}
|
||||
|
@ -195,7 +199,7 @@ export function TransactionDurationAlertTrigger(props: Props) {
|
|||
];
|
||||
|
||||
return (
|
||||
<ServiceAlertTrigger
|
||||
<ApmRuleParamsContainer
|
||||
chartPreview={chartPreview}
|
||||
defaults={params}
|
||||
fields={fields}
|
||||
|
@ -208,4 +212,4 @@ export function TransactionDurationAlertTrigger(props: Props) {
|
|||
// Default export is required for React.lazy loading
|
||||
//
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default TransactionDurationAlertTrigger;
|
||||
export default TransactionDurationRuleType;
|
|
@ -10,19 +10,23 @@ import React, { useEffect } from 'react';
|
|||
import { CoreStart } from '@kbn/core/public';
|
||||
import { useKibana } from '@kbn/kibana-react-plugin/public';
|
||||
import { ForLastExpression } from '@kbn/triggers-actions-ui-plugin/public';
|
||||
import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values';
|
||||
import { asPercent } from '../../../../common/utils/formatters';
|
||||
import { useFetcher } from '../../../hooks/use_fetcher';
|
||||
import { createCallApmApi } from '../../../services/rest/create_call_apm_api';
|
||||
import { ChartPreview } from '../chart_preview';
|
||||
import { ENVIRONMENT_ALL } from '../../../../../common/environment_filter_values';
|
||||
import { asPercent } from '../../../../../common/utils/formatters';
|
||||
import { useFetcher } from '../../../../hooks/use_fetcher';
|
||||
import { createCallApmApi } from '../../../../services/rest/create_call_apm_api';
|
||||
import { ChartPreview } from '../../ui_components/chart_preview';
|
||||
import {
|
||||
EnvironmentField,
|
||||
IsAboveField,
|
||||
ServiceField,
|
||||
TransactionTypeField,
|
||||
} from '../fields';
|
||||
import { AlertMetadata, getIntervalAndTimeRange, TimeUnit } from '../helper';
|
||||
import { ServiceAlertTrigger } from '../service_alert_trigger';
|
||||
} from '../../utils/fields';
|
||||
import {
|
||||
AlertMetadata,
|
||||
getIntervalAndTimeRange,
|
||||
TimeUnit,
|
||||
} from '../../utils/helper';
|
||||
import { ApmRuleParamsContainer } from '../../ui_components/apm_rule_params_container';
|
||||
|
||||
interface RuleParams {
|
||||
windowSize?: number;
|
||||
|
@ -40,7 +44,7 @@ interface Props {
|
|||
setRuleProperty: (key: string, value: any) => void;
|
||||
}
|
||||
|
||||
export function TransactionErrorRateAlertTrigger(props: Props) {
|
||||
export function TransactionErrorRateRuleType(props: Props) {
|
||||
const { services } = useKibana();
|
||||
const { ruleParams, metadata, setRuleParams, setRuleProperty } = props;
|
||||
|
||||
|
@ -68,7 +72,7 @@ export function TransactionErrorRateAlertTrigger(props: Props) {
|
|||
});
|
||||
if (interval && start && end) {
|
||||
return callApmApi(
|
||||
'GET /internal/apm/alerts/chart_preview/transaction_error_rate',
|
||||
'GET /internal/apm/rule_types/transaction_error_rate/chart_preview',
|
||||
{
|
||||
params: {
|
||||
query: {
|
||||
|
@ -137,7 +141,7 @@ export function TransactionErrorRateAlertTrigger(props: Props) {
|
|||
);
|
||||
|
||||
return (
|
||||
<ServiceAlertTrigger
|
||||
<ApmRuleParamsContainer
|
||||
fields={fields}
|
||||
defaults={params}
|
||||
setRuleParams={setRuleParams}
|
||||
|
@ -150,4 +154,4 @@ export function TransactionErrorRateAlertTrigger(props: Props) {
|
|||
// Default export is required for React.lazy loading
|
||||
//
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default TransactionErrorRateAlertTrigger;
|
||||
export default TransactionErrorRateRuleType;
|
|
@ -8,25 +8,25 @@
|
|||
import React, { useCallback, useMemo } from 'react';
|
||||
import { useKibana } from '@kbn/kibana-react-plugin/public';
|
||||
import {
|
||||
AlertType,
|
||||
ApmRuleType,
|
||||
APM_SERVER_FEATURE_ID,
|
||||
} from '../../../../common/alert_types';
|
||||
import { getInitialAlertValues } from '../get_initial_alert_values';
|
||||
import { ApmPluginStartDeps } from '../../../plugin';
|
||||
import { useServiceName } from '../../../hooks/use_service_name';
|
||||
import { useApmParams } from '../../../hooks/use_apm_params';
|
||||
import { AlertMetadata } from '../helper';
|
||||
import { ENVIRONMENT_ALL } from '../../../../common/environment_filter_values';
|
||||
import { useTimeRange } from '../../../hooks/use_time_range';
|
||||
} from '../../../../../common/rules/apm_rule_types';
|
||||
import { getInitialAlertValues } from '../../utils/get_initial_alert_values';
|
||||
import { ApmPluginStartDeps } from '../../../../plugin';
|
||||
import { useServiceName } from '../../../../hooks/use_service_name';
|
||||
import { useApmParams } from '../../../../hooks/use_apm_params';
|
||||
import { AlertMetadata } from '../../utils/helper';
|
||||
import { ENVIRONMENT_ALL } from '../../../../../common/environment_filter_values';
|
||||
import { useTimeRange } from '../../../../hooks/use_time_range';
|
||||
|
||||
interface Props {
|
||||
addFlyoutVisible: boolean;
|
||||
setAddFlyoutVisibility: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
alertType: AlertType | null;
|
||||
ruleType: ApmRuleType | null;
|
||||
}
|
||||
|
||||
export function AlertingFlyout(props: Props) {
|
||||
const { addFlyoutVisible, setAddFlyoutVisibility, alertType } = props;
|
||||
const { addFlyoutVisible, setAddFlyoutVisibility, ruleType } = props;
|
||||
|
||||
const serviceName = useServiceName();
|
||||
const { query } = useApmParams('/*');
|
||||
|
@ -42,7 +42,7 @@ export function AlertingFlyout(props: Props) {
|
|||
'transactionType' in query ? query.transactionType : undefined;
|
||||
|
||||
const { services } = useKibana<ApmPluginStartDeps>();
|
||||
const initialValues = getInitialAlertValues(alertType, serviceName);
|
||||
const initialValues = getInitialAlertValues(ruleType, serviceName);
|
||||
|
||||
const onCloseAddFlyout = useCallback(
|
||||
() => setAddFlyoutVisibility(false),
|
||||
|
@ -51,24 +51,24 @@ export function AlertingFlyout(props: Props) {
|
|||
|
||||
const addAlertFlyout = useMemo(
|
||||
() =>
|
||||
alertType &&
|
||||
ruleType &&
|
||||
services.triggersActionsUi.getAddAlertFlyout({
|
||||
consumer: APM_SERVER_FEATURE_ID,
|
||||
onClose: onCloseAddFlyout,
|
||||
ruleTypeId: alertType,
|
||||
ruleTypeId: ruleType,
|
||||
canChangeTrigger: false,
|
||||
initialValues,
|
||||
metadata: {
|
||||
environment,
|
||||
serviceName,
|
||||
...(alertType === AlertType.ErrorCount ? {} : { transactionType }),
|
||||
...(ruleType === ApmRuleType.ErrorCount ? {} : { transactionType }),
|
||||
start,
|
||||
end,
|
||||
} as AlertMetadata,
|
||||
}),
|
||||
/* eslint-disable-next-line react-hooks/exhaustive-deps */
|
||||
[
|
||||
alertType,
|
||||
ruleType,
|
||||
environment,
|
||||
onCloseAddFlyout,
|
||||
services.triggersActionsUi,
|
|
@ -8,17 +8,17 @@
|
|||
import { render } from '@testing-library/react';
|
||||
import React, { ReactNode } from 'react';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { ServiceAlertTrigger } from '.';
|
||||
import { ApmRuleParamsContainer } from '.';
|
||||
|
||||
function Wrapper({ children }: { children?: ReactNode }) {
|
||||
return <MemoryRouter>{children}</MemoryRouter>;
|
||||
}
|
||||
|
||||
describe('ServiceAlertTrigger', () => {
|
||||
describe('ApmRuleParamsContainer', () => {
|
||||
it('renders', () => {
|
||||
expect(() =>
|
||||
render(
|
||||
<ServiceAlertTrigger
|
||||
<ApmRuleParamsContainer
|
||||
defaults={{}}
|
||||
fields={[null]}
|
||||
setRuleParams={() => {}}
|
|
@ -16,7 +16,7 @@ interface Props {
|
|||
chartPreview?: React.ReactNode;
|
||||
}
|
||||
|
||||
export function ServiceAlertTrigger(props: Props) {
|
||||
export function ApmRuleParamsContainer(props: Props) {
|
||||
const { fields, setRuleParams, defaults, chartPreview } = props;
|
||||
|
||||
const params: Record<string, any> = {
|
|
@ -22,9 +22,9 @@ import {
|
|||
import { EuiSpacer } from '@elastic/eui';
|
||||
import React from 'react';
|
||||
import { IUiSettingsClient } from '@kbn/core/public';
|
||||
import { Coordinate } from '../../../../typings/timeseries';
|
||||
import { useTheme } from '../../../hooks/use_theme';
|
||||
import { getTimeZone } from '../../shared/charts/helper/timezone';
|
||||
import { Coordinate } from '../../../../../typings/timeseries';
|
||||
import { useTheme } from '../../../../hooks/use_theme';
|
||||
import { getTimeZone } from '../../../shared/charts/helper/timezone';
|
||||
|
||||
interface ChartPreviewProps {
|
||||
yTickFormat?: TickFormatter;
|
|
@ -8,7 +8,7 @@
|
|||
import React from 'react';
|
||||
import { ServiceField, TransactionTypeField } from './fields';
|
||||
import { render } from '@testing-library/react';
|
||||
import { expectTextsInDocument } from '../../utils/test_helpers';
|
||||
import { expectTextsInDocument } from '../../../utils/test_helpers';
|
||||
|
||||
describe('alerting fields', () => {
|
||||
describe('Service Field', () => {
|
|
@ -12,14 +12,14 @@ import {
|
|||
SERVICE_ENVIRONMENT,
|
||||
SERVICE_NAME,
|
||||
TRANSACTION_TYPE,
|
||||
} from '../../../common/elasticsearch_fieldnames';
|
||||
} from '../../../../common/elasticsearch_fieldnames';
|
||||
import {
|
||||
ENVIRONMENT_ALL,
|
||||
getEnvironmentLabel,
|
||||
allOptionText,
|
||||
} from '../../../common/environment_filter_values';
|
||||
import { SuggestionsSelect } from '../shared/suggestions_select';
|
||||
import { PopoverExpression } from './service_alert_trigger/popover_expression';
|
||||
} from '../../../../common/environment_filter_values';
|
||||
import { SuggestionsSelect } from '../../shared/suggestions_select';
|
||||
import { PopoverExpression } from '../ui_components/popover_expression';
|
||||
|
||||
export function ServiceField({
|
||||
allowAll = true,
|
||||
|
@ -143,10 +143,9 @@ export function IsAboveField({
|
|||
return (
|
||||
<PopoverExpression
|
||||
value={`${value}${unit}`}
|
||||
title={i18n.translate(
|
||||
'xpack.apm.transactionErrorRateAlertTrigger.isAbove',
|
||||
{ defaultMessage: 'is above' }
|
||||
)}
|
||||
title={i18n.translate('xpack.apm.transactionErrorRateRuleType.isAbove', {
|
||||
defaultMessage: 'is above',
|
||||
})}
|
||||
>
|
||||
<EuiFieldNumber
|
||||
min={0}
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { Capabilities } from '@kbn/core/public';
|
||||
import { ApmPluginSetupDeps } from '../../plugin';
|
||||
import { ApmPluginSetupDeps } from '../../../plugin';
|
||||
import { getAlertingCapabilities } from './get_alerting_capabilities';
|
||||
|
||||
describe('getAlertingCapabilities', () => {
|
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
import { Capabilities } from '@kbn/core/public';
|
||||
import { ApmPluginSetupDeps } from '../../plugin';
|
||||
import { ApmPluginSetupDeps } from '../../../plugin';
|
||||
|
||||
export const getAlertingCapabilities = (
|
||||
plugins: ApmPluginSetupDeps,
|
|
@ -6,21 +6,24 @@
|
|||
*/
|
||||
|
||||
import { getInitialAlertValues } from './get_initial_alert_values';
|
||||
import { AlertType, ALERT_TYPES_CONFIG } from '../../../common/alert_types';
|
||||
import {
|
||||
ApmRuleType,
|
||||
RULE_TYPES_CONFIG,
|
||||
} from '../../../../common/rules/apm_rule_types';
|
||||
|
||||
test('handles null alert type and undefined service name', () => {
|
||||
test('handles null rule type and undefined service name', () => {
|
||||
expect(getInitialAlertValues(null, undefined)).toEqual({ tags: ['apm'] });
|
||||
});
|
||||
|
||||
test('handles valid alert type', () => {
|
||||
const alertType = AlertType.ErrorCount;
|
||||
expect(getInitialAlertValues(alertType, undefined)).toEqual({
|
||||
name: ALERT_TYPES_CONFIG[alertType].name,
|
||||
test('handles valid rule type', () => {
|
||||
const ruleType = ApmRuleType.ErrorCount;
|
||||
expect(getInitialAlertValues(ruleType, undefined)).toEqual({
|
||||
name: RULE_TYPES_CONFIG[ruleType].name,
|
||||
tags: ['apm'],
|
||||
});
|
||||
|
||||
expect(getInitialAlertValues(alertType, 'Service Name')).toEqual({
|
||||
name: `${ALERT_TYPES_CONFIG[alertType].name} | Service Name`,
|
||||
expect(getInitialAlertValues(ruleType, 'Service Name')).toEqual({
|
||||
name: `${RULE_TYPES_CONFIG[ruleType].name} | Service Name`,
|
||||
tags: ['apm', `service.name:service name`],
|
||||
});
|
||||
});
|
|
@ -5,19 +5,20 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { AlertType, ALERT_TYPES_CONFIG } from '../../../common/alert_types';
|
||||
import {
|
||||
ApmRuleType,
|
||||
RULE_TYPES_CONFIG,
|
||||
} from '../../../../common/rules/apm_rule_types';
|
||||
|
||||
export function getInitialAlertValues(
|
||||
alertType: AlertType | null,
|
||||
ruleType: ApmRuleType | null,
|
||||
serviceName: string | undefined
|
||||
) {
|
||||
const alertTypeName = alertType
|
||||
? ALERT_TYPES_CONFIG[alertType].name
|
||||
: undefined;
|
||||
const alertName = alertTypeName
|
||||
const ruleTypeName = ruleType ? RULE_TYPES_CONFIG[ruleType].name : undefined;
|
||||
const alertName = ruleTypeName
|
||||
? serviceName
|
||||
? `${alertTypeName} | ${serviceName}`
|
||||
: alertTypeName
|
||||
? `${ruleTypeName} | ${serviceName}`
|
||||
: ruleTypeName
|
||||
: undefined;
|
||||
const tags = ['apm'];
|
||||
if (serviceName) {
|
|
@ -18,7 +18,7 @@ import {
|
|||
AlertsTableStatusFilter,
|
||||
ALL_ALERTS_FILTER,
|
||||
AlertStatusFilterButton,
|
||||
} from '../../alerting/service_overview_alerts/alerts_table_status_filter';
|
||||
} from './alerts_table_status_filter';
|
||||
|
||||
export function AlertsOverview() {
|
||||
const {
|
||||
|
|
|
@ -28,7 +28,7 @@ import { ServiceAnomalyTimeseriesContextProvider } from '../../../../context/ser
|
|||
import { useApmParams } from '../../../../hooks/use_apm_params';
|
||||
import { useApmRouter } from '../../../../hooks/use_apm_router';
|
||||
import { useTimeRange } from '../../../../hooks/use_time_range';
|
||||
import { getAlertingCapabilities } from '../../../alerting/get_alerting_capabilities';
|
||||
import { getAlertingCapabilities } from '../../../alerting/utils/get_alerting_capabilities';
|
||||
import { SearchBar } from '../../../shared/search_bar';
|
||||
import { ServiceIcons } from '../../../shared/service_icons';
|
||||
import { BetaBadge } from '../../../shared/beta_badge';
|
||||
|
|
|
@ -14,8 +14,8 @@ import {
|
|||
import { i18n } from '@kbn/i18n';
|
||||
import React, { useState } from 'react';
|
||||
import { IBasePath } from '@kbn/core/public';
|
||||
import { AlertType } from '../../../../common/alert_types';
|
||||
import { AlertingFlyout } from '../../alerting/alerting_flyout';
|
||||
import { ApmRuleType } from '../../../../common/rules/apm_rule_types';
|
||||
import { AlertingFlyout } from '../../alerting/ui_components/alerting_flyout';
|
||||
import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
|
||||
|
||||
const alertLabel = i18n.translate('xpack.apm.home.alertsMenu.alerts', {
|
||||
|
@ -59,7 +59,7 @@ export function AlertingPopoverAndFlyout({
|
|||
includeTransactionDuration,
|
||||
}: Props) {
|
||||
const [popoverOpen, setPopoverOpen] = useState(false);
|
||||
const [alertType, setAlertType] = useState<AlertType | null>(null);
|
||||
const [ruleType, setRuleType] = useState<ApmRuleType | null>(null);
|
||||
const {
|
||||
plugins: { observability },
|
||||
} = useApmPluginContext();
|
||||
|
@ -92,7 +92,7 @@ export function AlertingPopoverAndFlyout({
|
|||
{
|
||||
name: createAnomalyAlertAlertLabel,
|
||||
onClick: () => {
|
||||
setAlertType(AlertType.Anomaly);
|
||||
setRuleType(ApmRuleType.Anomaly);
|
||||
setPopoverOpen(false);
|
||||
},
|
||||
'data-test-subj': 'apmAlertsMenuItemCreateAnomaly',
|
||||
|
@ -102,7 +102,7 @@ export function AlertingPopoverAndFlyout({
|
|||
{
|
||||
name: errorCountLabel,
|
||||
onClick: () => {
|
||||
setAlertType(AlertType.ErrorCount);
|
||||
setRuleType(ApmRuleType.ErrorCount);
|
||||
setPopoverOpen(false);
|
||||
},
|
||||
'data-test-subj': 'apmAlertsMenuItemErrorCount',
|
||||
|
@ -136,7 +136,7 @@ export function AlertingPopoverAndFlyout({
|
|||
{
|
||||
name: transactionDurationLabel,
|
||||
onClick: () => {
|
||||
setAlertType(AlertType.TransactionDuration);
|
||||
setRuleType(ApmRuleType.TransactionDuration);
|
||||
setPopoverOpen(false);
|
||||
},
|
||||
},
|
||||
|
@ -147,7 +147,7 @@ export function AlertingPopoverAndFlyout({
|
|||
{
|
||||
name: transactionErrorRateLabel,
|
||||
onClick: () => {
|
||||
setAlertType(AlertType.TransactionErrorRate);
|
||||
setRuleType(ApmRuleType.TransactionErrorRate);
|
||||
setPopoverOpen(false);
|
||||
},
|
||||
},
|
||||
|
@ -168,11 +168,11 @@ export function AlertingPopoverAndFlyout({
|
|||
<EuiContextMenu initialPanelId={0} panels={panels} />
|
||||
</EuiPopover>
|
||||
<AlertingFlyout
|
||||
alertType={alertType}
|
||||
addFlyoutVisible={!!alertType}
|
||||
ruleType={ruleType}
|
||||
addFlyoutVisible={!!ruleType}
|
||||
setAddFlyoutVisibility={(visible) => {
|
||||
if (!visible) {
|
||||
setAlertType(null);
|
||||
setRuleType(null);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
import { apmLabsButton } from '@kbn/observability-plugin/common';
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import React from 'react';
|
||||
import { getAlertingCapabilities } from '../../alerting/get_alerting_capabilities';
|
||||
import { getAlertingCapabilities } from '../../alerting/utils/get_alerting_capabilities';
|
||||
import { getLegacyApmHref } from '../links/apm/apm_link';
|
||||
import { useApmPluginContext } from '../../../context/apm_plugin/use_apm_plugin_context';
|
||||
import { AlertingPopoverAndFlyout } from './alerting_popover_flyout';
|
||||
|
|
|
@ -51,7 +51,7 @@ import { SpacesPluginStart } from '@kbn/spaces-plugin/public';
|
|||
import { enableServiceGroups } from '@kbn/observability-plugin/public';
|
||||
import { InfraClientStartExports } from '@kbn/infra-plugin/public';
|
||||
import { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
|
||||
import { registerApmAlerts } from './components/alerting/register_apm_alerts';
|
||||
import { registerApmRuleTypes } from './components/alerting/rule_types/register_apm_rule_types';
|
||||
import {
|
||||
getApmEnrollmentFlyoutData,
|
||||
LazyApmCustomAssetsExtension,
|
||||
|
@ -345,7 +345,7 @@ export class ApmPlugin implements Plugin<ApmPluginSetup, ApmPluginStart> {
|
|||
},
|
||||
});
|
||||
|
||||
registerApmAlerts(observabilityRuleTypeRegistry);
|
||||
registerApmRuleTypes(observabilityRuleTypeRegistry);
|
||||
|
||||
const locator = plugins.share.url.locators.create(
|
||||
new APMServiceDetailLocator(core.uiSettings)
|
||||
|
|
|
@ -12,7 +12,10 @@ import {
|
|||
LicensingPluginSetup,
|
||||
LicensingApiRequestHandlerContext,
|
||||
} from '@kbn/licensing-plugin/server';
|
||||
import { AlertType, APM_SERVER_FEATURE_ID } from '../common/alert_types';
|
||||
import {
|
||||
ApmRuleType,
|
||||
APM_SERVER_FEATURE_ID,
|
||||
} from '../common/rules/apm_rule_types';
|
||||
|
||||
export const APM_FEATURE = {
|
||||
id: APM_SERVER_FEATURE_ID,
|
||||
|
@ -26,7 +29,7 @@ export const APM_FEATURE = {
|
|||
management: {
|
||||
insightsAndAlerting: ['triggersActions'],
|
||||
},
|
||||
alerting: Object.values(AlertType),
|
||||
alerting: Object.values(ApmRuleType),
|
||||
// see x-pack/plugins/features/common/feature_kibana_privileges.ts
|
||||
privileges: {
|
||||
all: {
|
||||
|
@ -39,10 +42,10 @@ export const APM_FEATURE = {
|
|||
},
|
||||
alerting: {
|
||||
alert: {
|
||||
all: Object.values(AlertType),
|
||||
all: Object.values(ApmRuleType),
|
||||
},
|
||||
rule: {
|
||||
all: Object.values(AlertType),
|
||||
all: Object.values(ApmRuleType),
|
||||
},
|
||||
},
|
||||
management: {
|
||||
|
@ -60,10 +63,10 @@ export const APM_FEATURE = {
|
|||
},
|
||||
alerting: {
|
||||
alert: {
|
||||
read: Object.values(AlertType),
|
||||
read: Object.values(ApmRuleType),
|
||||
},
|
||||
rule: {
|
||||
read: Object.values(AlertType),
|
||||
read: Object.values(ApmRuleType),
|
||||
},
|
||||
},
|
||||
management: {
|
||||
|
|
|
@ -116,7 +116,7 @@ export type ApmIndicesConfigName = keyof APMConfig['indices'];
|
|||
export const plugin = (initContext: PluginInitializerContext) =>
|
||||
new APMPlugin(initContext);
|
||||
|
||||
export { APM_SERVER_FEATURE_ID } from '../common/alert_types';
|
||||
export { APM_SERVER_FEATURE_ID } from '../common/rules/apm_rule_types';
|
||||
export { APMPlugin } from './plugin';
|
||||
export type { APMPluginSetup } from './types';
|
||||
export type {
|
||||
|
|
|
@ -21,7 +21,7 @@ import { Dataset } from '@kbn/rule-registry-plugin/server';
|
|||
import { UI_SETTINGS } from '@kbn/data-plugin/common';
|
||||
import { APMConfig, APM_SERVER_FEATURE_ID } from '.';
|
||||
import { APM_FEATURE, registerFeaturesUsage } from './feature';
|
||||
import { registerApmAlerts } from './routes/alerts/register_apm_alerts';
|
||||
import { registerApmRuleTypes } from './routes/alerts/register_apm_rule_types';
|
||||
import { registerFleetPolicyCallbacks } from './routes/fleet/register_fleet_policy_callbacks';
|
||||
import { createApmTelemetry } from './lib/apm_telemetry';
|
||||
import { APMEventClient } from './lib/helpers/create_es_client/create_apm_event_client';
|
||||
|
@ -189,7 +189,7 @@ export class APMPlugin
|
|||
});
|
||||
|
||||
if (plugins.alerting) {
|
||||
registerApmAlerts({
|
||||
registerApmRuleTypes({
|
||||
ruleDataClient,
|
||||
alerting: plugins.alerting,
|
||||
ml: plugins.ml,
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import { AggregationType } from '../../../common/alert_types';
|
||||
import { AggregationType } from '../../../common/rules/apm_rule_types';
|
||||
import { getDurationFieldForTransactions } from '../../lib/helpers/transactions';
|
||||
|
||||
type TransactionDurationField = ReturnType<
|
||||
|
|
|
@ -10,11 +10,11 @@ import { IBasePath, Logger } from '@kbn/core/server';
|
|||
import { PluginSetupContract as AlertingPluginSetupContract } from '@kbn/alerting-plugin/server';
|
||||
import { IRuleDataClient } from '@kbn/rule-registry-plugin/server';
|
||||
import { MlPluginSetup } from '@kbn/ml-plugin/server';
|
||||
import { registerTransactionDurationAlertType } from './register_transaction_duration_alert_type';
|
||||
import { registerAnomalyAlertType } from './register_anomaly_alert_type';
|
||||
import { registerErrorCountAlertType } from './register_error_count_alert_type';
|
||||
import { registerTransactionDurationRuleType } from './rule_types/transaction_duration/register_transaction_duration_rule_type';
|
||||
import { registerAnomalyRuleType } from './rule_types/anomaly/register_anomaly_rule_type';
|
||||
import { registerErrorCountRuleType } from './rule_types/error_count/register_error_count_rule_type';
|
||||
import { APMConfig } from '../..';
|
||||
import { registerTransactionErrorRateAlertType } from './register_transaction_error_rate_alert_type';
|
||||
import { registerTransactionErrorRateRuleType } from './rule_types/transaction_error_rate/register_transaction_error_rate_rule_type';
|
||||
|
||||
export interface RegisterRuleDependencies {
|
||||
ruleDataClient: IRuleDataClient;
|
||||
|
@ -25,9 +25,9 @@ export interface RegisterRuleDependencies {
|
|||
basePath: IBasePath;
|
||||
}
|
||||
|
||||
export function registerApmAlerts(dependencies: RegisterRuleDependencies) {
|
||||
registerTransactionDurationAlertType(dependencies);
|
||||
registerAnomalyAlertType(dependencies);
|
||||
registerErrorCountAlertType(dependencies);
|
||||
registerTransactionErrorRateAlertType(dependencies);
|
||||
export function registerApmRuleTypes(dependencies: RegisterRuleDependencies) {
|
||||
registerTransactionDurationRuleType(dependencies);
|
||||
registerAnomalyRuleType(dependencies);
|
||||
registerErrorCountRuleType(dependencies);
|
||||
registerTransactionErrorRateRuleType(dependencies);
|
||||
}
|
|
@ -6,13 +6,13 @@
|
|||
*/
|
||||
|
||||
import * as t from 'io-ts';
|
||||
import { getTransactionDurationChartPreview } from './chart_preview/get_transaction_duration';
|
||||
import { getTransactionErrorCountChartPreview } from './chart_preview/get_transaction_error_count';
|
||||
import { getTransactionErrorRateChartPreview } from './chart_preview/get_transaction_error_rate';
|
||||
import { getTransactionDurationChartPreview } from './rule_types/transaction_duration/get_transaction_duration_chart_preview';
|
||||
import { getTransactionErrorCountChartPreview } from './rule_types/error_count/get_error_count_chart_preview';
|
||||
import { getTransactionErrorRateChartPreview } from './rule_types/transaction_error_rate/get_transaction_error_rate_chart_preview';
|
||||
import { setupRequest } from '../../lib/helpers/setup_request';
|
||||
import { createApmServerRoute } from '../apm_routes/create_apm_server_route';
|
||||
import { environmentRt, rangeRt } from '../default_api_types';
|
||||
import { AggregationType } from '../../../common/alert_types';
|
||||
import { AggregationType } from '../../../common/rules/apm_rule_types';
|
||||
|
||||
const alertParamsRt = t.intersection([
|
||||
t.partial({
|
||||
|
@ -34,7 +34,7 @@ const alertParamsRt = t.intersection([
|
|||
export type AlertParams = t.TypeOf<typeof alertParamsRt>;
|
||||
|
||||
const transactionErrorRateChartPreview = createApmServerRoute({
|
||||
endpoint: 'GET /internal/apm/alerts/chart_preview/transaction_error_rate',
|
||||
endpoint: 'GET /internal/apm/rule_types/transaction_error_rate/chart_preview',
|
||||
params: t.type({ query: alertParamsRt }),
|
||||
options: { tags: ['access:apm'] },
|
||||
handler: async (
|
||||
|
@ -54,7 +54,7 @@ const transactionErrorRateChartPreview = createApmServerRoute({
|
|||
});
|
||||
|
||||
const transactionErrorCountChartPreview = createApmServerRoute({
|
||||
endpoint: 'GET /internal/apm/alerts/chart_preview/transaction_error_count',
|
||||
endpoint: 'GET /internal/apm/rule_types/error_count/chart_preview',
|
||||
params: t.type({ query: alertParamsRt }),
|
||||
options: { tags: ['access:apm'] },
|
||||
handler: async (
|
||||
|
@ -75,7 +75,7 @@ const transactionErrorCountChartPreview = createApmServerRoute({
|
|||
});
|
||||
|
||||
const transactionDurationChartPreview = createApmServerRoute({
|
||||
endpoint: 'GET /internal/apm/alerts/chart_preview/transaction_duration',
|
||||
endpoint: 'GET /internal/apm/rule_types/transaction_duration/chart_preview',
|
||||
params: t.type({ query: alertParamsRt }),
|
||||
options: { tags: ['access:apm'] },
|
||||
handler: async (
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
import { registerAnomalyAlertType } from './register_anomaly_alert_type';
|
||||
import { ANOMALY_SEVERITY } from '../../../common/ml_constants';
|
||||
import { registerAnomalyRuleType } from './register_anomaly_rule_type';
|
||||
import { ANOMALY_SEVERITY } from '../../../../../common/ml_constants';
|
||||
import { MlPluginSetup } from '@kbn/ml-plugin/server';
|
||||
import * as GetServiceAnomalies from '../service_map/get_service_anomalies';
|
||||
import { createRuleTypeMocks } from './test_utils';
|
||||
import { ApmMlJob } from '../../../common/anomaly_detection/apm_ml_job';
|
||||
import * as GetServiceAnomalies from '../../../service_map/get_service_anomalies';
|
||||
import { createRuleTypeMocks } from '../../test_utils';
|
||||
import { ApmMlJob } from '../../../../../common/anomaly_detection/apm_ml_job';
|
||||
|
||||
describe('Transaction duration anomaly alert', () => {
|
||||
afterEach(() => {
|
||||
|
@ -19,7 +19,7 @@ describe('Transaction duration anomaly alert', () => {
|
|||
it('ml is not defined', async () => {
|
||||
const { services, dependencies, executor } = createRuleTypeMocks();
|
||||
|
||||
registerAnomalyAlertType({
|
||||
registerAnomalyRuleType({
|
||||
...dependencies,
|
||||
ml: undefined,
|
||||
});
|
||||
|
@ -47,7 +47,7 @@ describe('Transaction duration anomaly alert', () => {
|
|||
anomalyDetectorsProvider: jest.fn(),
|
||||
} as unknown as MlPluginSetup;
|
||||
|
||||
registerAnomalyAlertType({
|
||||
registerAnomalyRuleType({
|
||||
...dependencies,
|
||||
ml,
|
||||
});
|
||||
|
@ -98,7 +98,7 @@ describe('Transaction duration anomaly alert', () => {
|
|||
anomalyDetectorsProvider: jest.fn(),
|
||||
} as unknown as MlPluginSetup;
|
||||
|
||||
registerAnomalyAlertType({
|
||||
registerAnomalyRuleType({
|
||||
...dependencies,
|
||||
ml,
|
||||
});
|
||||
|
@ -174,7 +174,7 @@ describe('Transaction duration anomaly alert', () => {
|
|||
anomalyDetectorsProvider: jest.fn(),
|
||||
} as unknown as MlPluginSetup;
|
||||
|
||||
registerAnomalyAlertType({
|
||||
registerAnomalyRuleType({
|
||||
...dependencies,
|
||||
ml,
|
||||
});
|
|
@ -20,32 +20,32 @@ import { termQuery } from '@kbn/observability-plugin/server';
|
|||
import { createLifecycleRuleTypeFactory } from '@kbn/rule-registry-plugin/server';
|
||||
import { ProcessorEvent } from '@kbn/observability-plugin/common';
|
||||
import {
|
||||
AlertType,
|
||||
ALERT_TYPES_CONFIG,
|
||||
ApmRuleType,
|
||||
RULE_TYPES_CONFIG,
|
||||
ANOMALY_ALERT_SEVERITY_TYPES,
|
||||
formatAnomalyReason,
|
||||
} from '../../../common/alert_types';
|
||||
import { getSeverity } from '../../../common/anomaly_detection';
|
||||
} from '../../../../../common/rules/apm_rule_types';
|
||||
import { getSeverity } from '../../../../../common/anomaly_detection';
|
||||
import {
|
||||
ApmMlDetectorType,
|
||||
getApmMlDetectorIndex,
|
||||
} from '../../../common/anomaly_detection/apm_ml_detectors';
|
||||
} from '../../../../../common/anomaly_detection/apm_ml_detectors';
|
||||
import {
|
||||
PROCESSOR_EVENT,
|
||||
SERVICE_ENVIRONMENT,
|
||||
SERVICE_NAME,
|
||||
TRANSACTION_TYPE,
|
||||
} from '../../../common/elasticsearch_fieldnames';
|
||||
} from '../../../../../common/elasticsearch_fieldnames';
|
||||
import {
|
||||
getEnvironmentEsField,
|
||||
getEnvironmentLabel,
|
||||
} from '../../../common/environment_filter_values';
|
||||
import { ANOMALY_SEVERITY } from '../../../common/ml_constants';
|
||||
import { asMutableArray } from '../../../common/utils/as_mutable_array';
|
||||
import { getAlertUrlTransaction } from '../../../common/utils/formatters';
|
||||
import { getMLJobs } from '../service_map/get_service_anomalies';
|
||||
import { apmActionVariables } from './action_variables';
|
||||
import { RegisterRuleDependencies } from './register_apm_alerts';
|
||||
} from '../../../../../common/environment_filter_values';
|
||||
import { ANOMALY_SEVERITY } from '../../../../../common/ml_constants';
|
||||
import { asMutableArray } from '../../../../../common/utils/as_mutable_array';
|
||||
import { getAlertUrlTransaction } from '../../../../../common/utils/formatters';
|
||||
import { getMLJobs } from '../../../service_map/get_service_anomalies';
|
||||
import { apmActionVariables } from '../../action_variables';
|
||||
import { RegisterRuleDependencies } from '../../register_apm_rule_types';
|
||||
|
||||
const paramsSchema = schema.object({
|
||||
serviceName: schema.maybe(schema.string()),
|
||||
|
@ -61,9 +61,9 @@ const paramsSchema = schema.object({
|
|||
]),
|
||||
});
|
||||
|
||||
const alertTypeConfig = ALERT_TYPES_CONFIG[AlertType.Anomaly];
|
||||
const ruleTypeConfig = RULE_TYPES_CONFIG[ApmRuleType.Anomaly];
|
||||
|
||||
export function registerAnomalyAlertType({
|
||||
export function registerAnomalyRuleType({
|
||||
logger,
|
||||
ruleDataClient,
|
||||
alerting,
|
||||
|
@ -77,10 +77,10 @@ export function registerAnomalyAlertType({
|
|||
|
||||
alerting.registerType(
|
||||
createLifecycleRuleType({
|
||||
id: AlertType.Anomaly,
|
||||
name: alertTypeConfig.name,
|
||||
actionGroups: alertTypeConfig.actionGroups,
|
||||
defaultActionGroupId: alertTypeConfig.defaultActionGroupId,
|
||||
id: ApmRuleType.Anomaly,
|
||||
name: ruleTypeConfig.name,
|
||||
actionGroups: ruleTypeConfig.actionGroups,
|
||||
defaultActionGroupId: ruleTypeConfig.defaultActionGroupId,
|
||||
validate: {
|
||||
params: paramsSchema,
|
||||
},
|
||||
|
@ -252,7 +252,12 @@ export function registerAnomalyAlertType({
|
|||
: relativeViewInAppUrl;
|
||||
services
|
||||
.alertWithLifecycle({
|
||||
id: [AlertType.Anomaly, serviceName, environment, transactionType]
|
||||
id: [
|
||||
ApmRuleType.Anomaly,
|
||||
serviceName,
|
||||
environment,
|
||||
transactionType,
|
||||
]
|
||||
.filter((name) => name)
|
||||
.join('_'),
|
||||
fields: {
|
||||
|
@ -266,7 +271,7 @@ export function registerAnomalyAlertType({
|
|||
[ALERT_REASON]: reasonMessage,
|
||||
},
|
||||
})
|
||||
.scheduleActions(alertTypeConfig.defaultActionGroupId, {
|
||||
.scheduleActions(ruleTypeConfig.defaultActionGroupId, {
|
||||
serviceName,
|
||||
transactionType,
|
||||
environment: getEnvironmentLabel(environment),
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
import { rangeQuery, termQuery } from '@kbn/observability-plugin/server';
|
||||
import { ProcessorEvent } from '@kbn/observability-plugin/common';
|
||||
import { SERVICE_NAME } from '../../../../common/elasticsearch_fieldnames';
|
||||
import { AlertParams } from '../route';
|
||||
import { environmentQuery } from '../../../../common/utils/environment_query';
|
||||
import { Setup } from '../../../lib/helpers/setup_request';
|
||||
import { SERVICE_NAME } from '../../../../../common/elasticsearch_fieldnames';
|
||||
import { AlertParams } from '../../route';
|
||||
import { environmentQuery } from '../../../../../common/utils/environment_query';
|
||||
import { Setup } from '../../../../lib/helpers/setup_request';
|
||||
|
||||
export async function getTransactionErrorCountChartPreview({
|
||||
setup,
|
||||
|
@ -51,7 +51,7 @@ export async function getTransactionErrorCountChartPreview({
|
|||
};
|
||||
|
||||
const resp = await apmEventClient.search(
|
||||
'get_transaction_error_count_chart_preview',
|
||||
'get_error_count_chart_preview',
|
||||
params
|
||||
);
|
||||
|
|
@ -5,14 +5,14 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { registerErrorCountAlertType } from './register_error_count_alert_type';
|
||||
import { createRuleTypeMocks } from './test_utils';
|
||||
import { registerErrorCountRuleType } from './register_error_count_rule_type';
|
||||
import { createRuleTypeMocks } from '../../test_utils';
|
||||
|
||||
describe('Error count alert', () => {
|
||||
it("doesn't send an alert when error count is less than threshold", async () => {
|
||||
const { services, dependencies, executor } = createRuleTypeMocks();
|
||||
|
||||
registerErrorCountAlertType(dependencies);
|
||||
registerErrorCountRuleType(dependencies);
|
||||
|
||||
const params = { threshold: 1 };
|
||||
|
||||
|
@ -42,7 +42,7 @@ describe('Error count alert', () => {
|
|||
const { services, dependencies, executor, scheduleActions } =
|
||||
createRuleTypeMocks();
|
||||
|
||||
registerErrorCountAlertType(dependencies);
|
||||
registerErrorCountRuleType(dependencies);
|
||||
|
||||
const params = { threshold: 2, windowSize: 5, windowUnit: 'm' };
|
||||
|
|
@ -19,24 +19,24 @@ import {
|
|||
ENVIRONMENT_NOT_DEFINED,
|
||||
getEnvironmentEsField,
|
||||
getEnvironmentLabel,
|
||||
} from '../../../common/environment_filter_values';
|
||||
import { getAlertUrlErrorCount } from '../../../common/utils/formatters';
|
||||
} from '../../../../../common/environment_filter_values';
|
||||
import { getAlertUrlErrorCount } from '../../../../../common/utils/formatters';
|
||||
import {
|
||||
AlertType,
|
||||
ApmRuleType,
|
||||
APM_SERVER_FEATURE_ID,
|
||||
ALERT_TYPES_CONFIG,
|
||||
RULE_TYPES_CONFIG,
|
||||
formatErrorCountReason,
|
||||
} from '../../../common/alert_types';
|
||||
} from '../../../../../common/rules/apm_rule_types';
|
||||
import {
|
||||
PROCESSOR_EVENT,
|
||||
SERVICE_ENVIRONMENT,
|
||||
SERVICE_NAME,
|
||||
} from '../../../common/elasticsearch_fieldnames';
|
||||
import { environmentQuery } from '../../../common/utils/environment_query';
|
||||
import { getApmIndices } from '../settings/apm_indices/get_apm_indices';
|
||||
import { apmActionVariables } from './action_variables';
|
||||
import { alertingEsClient } from './alerting_es_client';
|
||||
import { RegisterRuleDependencies } from './register_apm_alerts';
|
||||
} from '../../../../../common/elasticsearch_fieldnames';
|
||||
import { environmentQuery } from '../../../../../common/utils/environment_query';
|
||||
import { getApmIndices } from '../../../settings/apm_indices/get_apm_indices';
|
||||
import { apmActionVariables } from '../../action_variables';
|
||||
import { alertingEsClient } from '../../alerting_es_client';
|
||||
import { RegisterRuleDependencies } from '../../register_apm_rule_types';
|
||||
|
||||
const paramsSchema = schema.object({
|
||||
windowSize: schema.number(),
|
||||
|
@ -46,9 +46,9 @@ const paramsSchema = schema.object({
|
|||
environment: schema.string(),
|
||||
});
|
||||
|
||||
const alertTypeConfig = ALERT_TYPES_CONFIG[AlertType.ErrorCount];
|
||||
const ruleTypeConfig = RULE_TYPES_CONFIG[ApmRuleType.ErrorCount];
|
||||
|
||||
export function registerErrorCountAlertType({
|
||||
export function registerErrorCountRuleType({
|
||||
alerting,
|
||||
logger,
|
||||
ruleDataClient,
|
||||
|
@ -62,10 +62,10 @@ export function registerErrorCountAlertType({
|
|||
|
||||
alerting.registerType(
|
||||
createLifecycleRuleType({
|
||||
id: AlertType.ErrorCount,
|
||||
name: alertTypeConfig.name,
|
||||
actionGroups: alertTypeConfig.actionGroups,
|
||||
defaultActionGroupId: alertTypeConfig.defaultActionGroupId,
|
||||
id: ApmRuleType.ErrorCount,
|
||||
name: ruleTypeConfig.name,
|
||||
actionGroups: ruleTypeConfig.actionGroups,
|
||||
defaultActionGroupId: ruleTypeConfig.defaultActionGroupId,
|
||||
validate: {
|
||||
params: paramsSchema,
|
||||
},
|
||||
|
@ -165,7 +165,7 @@ export function registerErrorCountAlertType({
|
|||
|
||||
services
|
||||
.alertWithLifecycle({
|
||||
id: [AlertType.ErrorCount, serviceName, environment]
|
||||
id: [ApmRuleType.ErrorCount, serviceName, environment]
|
||||
.filter((name) => name)
|
||||
.join('_'),
|
||||
fields: {
|
||||
|
@ -177,7 +177,7 @@ export function registerErrorCountAlertType({
|
|||
[ALERT_REASON]: alertReason,
|
||||
},
|
||||
})
|
||||
.scheduleActions(alertTypeConfig.defaultActionGroupId, {
|
||||
.scheduleActions(ruleTypeConfig.defaultActionGroupId, {
|
||||
serviceName,
|
||||
environment: getEnvironmentLabel(environment),
|
||||
threshold: ruleParams.threshold,
|
|
@ -7,26 +7,26 @@
|
|||
|
||||
import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import { rangeQuery, termQuery } from '@kbn/observability-plugin/server';
|
||||
import { AggregationType } from '../../../../common/alert_types';
|
||||
import { AggregationType } from '../../../../../common/rules/apm_rule_types';
|
||||
import {
|
||||
SERVICE_NAME,
|
||||
SERVICE_ENVIRONMENT,
|
||||
TRANSACTION_TYPE,
|
||||
} from '../../../../common/elasticsearch_fieldnames';
|
||||
import { environmentQuery } from '../../../../common/utils/environment_query';
|
||||
import { AlertParams } from '../route';
|
||||
} from '../../../../../common/elasticsearch_fieldnames';
|
||||
import { environmentQuery } from '../../../../../common/utils/environment_query';
|
||||
import { AlertParams } from '../../route';
|
||||
import {
|
||||
getSearchTransactionsEvents,
|
||||
getDocumentTypeFilterForTransactions,
|
||||
getDurationFieldForTransactions,
|
||||
getProcessorEventForTransactions,
|
||||
} from '../../../lib/helpers/transactions';
|
||||
import { Setup } from '../../../lib/helpers/setup_request';
|
||||
} from '../../../../lib/helpers/transactions';
|
||||
import { Setup } from '../../../../lib/helpers/setup_request';
|
||||
import {
|
||||
ENVIRONMENT_NOT_DEFINED,
|
||||
getEnvironmentLabel,
|
||||
} from '../../../../common/environment_filter_values';
|
||||
import { averageOrPercentileAgg } from '../average_or_percentile_agg';
|
||||
} from '../../../../../common/environment_filter_values';
|
||||
import { averageOrPercentileAgg } from '../../average_or_percentile_agg';
|
||||
|
||||
export async function getTransactionDurationChartPreview({
|
||||
alertParams,
|
|
@ -5,15 +5,15 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { registerTransactionDurationAlertType } from './register_transaction_duration_alert_type';
|
||||
import { createRuleTypeMocks } from './test_utils';
|
||||
import { registerTransactionDurationRuleType } from './register_transaction_duration_rule_type';
|
||||
import { createRuleTypeMocks } from '../../test_utils';
|
||||
|
||||
describe('registerTransactionDurationAlertType', () => {
|
||||
describe('registerTransactionDurationRuleType', () => {
|
||||
it('sends alert when value is greater than threashold', async () => {
|
||||
const { services, dependencies, executor, scheduleActions } =
|
||||
createRuleTypeMocks();
|
||||
|
||||
registerTransactionDurationAlertType(dependencies);
|
||||
registerTransactionDurationRuleType(dependencies);
|
||||
|
||||
services.scopedClusterClient.asCurrentUser.search.mockResponse({
|
||||
hits: {
|
|
@ -16,37 +16,37 @@ import { firstValueFrom } from 'rxjs';
|
|||
import { asDuration } from '@kbn/observability-plugin/common/utils/formatters';
|
||||
import { createLifecycleRuleTypeFactory } from '@kbn/rule-registry-plugin/server';
|
||||
import { ProcessorEvent } from '@kbn/observability-plugin/common';
|
||||
import { getAlertUrlTransaction } from '../../../common/utils/formatters';
|
||||
import { SearchAggregatedTransactionSetting } from '../../../common/aggregated_transactions';
|
||||
import { getAlertUrlTransaction } from '../../../../../common/utils/formatters';
|
||||
import { SearchAggregatedTransactionSetting } from '../../../../../common/aggregated_transactions';
|
||||
import {
|
||||
AlertType,
|
||||
ApmRuleType,
|
||||
AggregationType,
|
||||
ALERT_TYPES_CONFIG,
|
||||
RULE_TYPES_CONFIG,
|
||||
APM_SERVER_FEATURE_ID,
|
||||
formatTransactionDurationReason,
|
||||
} from '../../../common/alert_types';
|
||||
} from '../../../../../common/rules/apm_rule_types';
|
||||
import {
|
||||
PROCESSOR_EVENT,
|
||||
SERVICE_NAME,
|
||||
TRANSACTION_TYPE,
|
||||
SERVICE_ENVIRONMENT,
|
||||
} from '../../../common/elasticsearch_fieldnames';
|
||||
} from '../../../../../common/elasticsearch_fieldnames';
|
||||
import {
|
||||
ENVIRONMENT_NOT_DEFINED,
|
||||
getEnvironmentEsField,
|
||||
getEnvironmentLabel,
|
||||
} from '../../../common/environment_filter_values';
|
||||
import { environmentQuery } from '../../../common/utils/environment_query';
|
||||
import { getDurationFormatter } from '../../../common/utils/formatters';
|
||||
} from '../../../../../common/environment_filter_values';
|
||||
import { environmentQuery } from '../../../../../common/utils/environment_query';
|
||||
import { getDurationFormatter } from '../../../../../common/utils/formatters';
|
||||
import {
|
||||
getDocumentTypeFilterForTransactions,
|
||||
getDurationFieldForTransactions,
|
||||
} from '../../lib/helpers/transactions';
|
||||
import { getApmIndices } from '../settings/apm_indices/get_apm_indices';
|
||||
import { apmActionVariables } from './action_variables';
|
||||
import { alertingEsClient } from './alerting_es_client';
|
||||
import { RegisterRuleDependencies } from './register_apm_alerts';
|
||||
import { averageOrPercentileAgg } from './average_or_percentile_agg';
|
||||
} from '../../../../lib/helpers/transactions';
|
||||
import { getApmIndices } from '../../../settings/apm_indices/get_apm_indices';
|
||||
import { apmActionVariables } from '../../action_variables';
|
||||
import { alertingEsClient } from '../../alerting_es_client';
|
||||
import { RegisterRuleDependencies } from '../../register_apm_rule_types';
|
||||
import { averageOrPercentileAgg } from '../../average_or_percentile_agg';
|
||||
|
||||
const paramsSchema = schema.object({
|
||||
serviceName: schema.string(),
|
||||
|
@ -62,9 +62,9 @@ const paramsSchema = schema.object({
|
|||
environment: schema.string(),
|
||||
});
|
||||
|
||||
const alertTypeConfig = ALERT_TYPES_CONFIG[AlertType.TransactionDuration];
|
||||
const ruleTypeConfig = RULE_TYPES_CONFIG[ApmRuleType.TransactionDuration];
|
||||
|
||||
export function registerTransactionDurationAlertType({
|
||||
export function registerTransactionDurationRuleType({
|
||||
alerting,
|
||||
ruleDataClient,
|
||||
config$,
|
||||
|
@ -76,11 +76,11 @@ export function registerTransactionDurationAlertType({
|
|||
logger,
|
||||
});
|
||||
|
||||
const type = createLifecycleRuleType({
|
||||
id: AlertType.TransactionDuration,
|
||||
name: alertTypeConfig.name,
|
||||
actionGroups: alertTypeConfig.actionGroups,
|
||||
defaultActionGroupId: alertTypeConfig.defaultActionGroupId,
|
||||
const ruleType = createLifecycleRuleType({
|
||||
id: ApmRuleType.TransactionDuration,
|
||||
name: ruleTypeConfig.name,
|
||||
actionGroups: ruleTypeConfig.actionGroups,
|
||||
defaultActionGroupId: ruleTypeConfig.defaultActionGroupId,
|
||||
validate: {
|
||||
params: paramsSchema,
|
||||
},
|
||||
|
@ -223,7 +223,7 @@ export function registerTransactionDurationAlertType({
|
|||
: relativeViewInAppUrl;
|
||||
services
|
||||
.alertWithLifecycle({
|
||||
id: `${AlertType.TransactionDuration}_${getEnvironmentLabel(
|
||||
id: `${ApmRuleType.TransactionDuration}_${getEnvironmentLabel(
|
||||
environment
|
||||
)}`,
|
||||
fields: {
|
||||
|
@ -236,7 +236,7 @@ export function registerTransactionDurationAlertType({
|
|||
[ALERT_REASON]: reasonMessage,
|
||||
},
|
||||
})
|
||||
.scheduleActions(alertTypeConfig.defaultActionGroupId, {
|
||||
.scheduleActions(ruleTypeConfig.defaultActionGroupId, {
|
||||
transactionType: ruleParams.transactionType,
|
||||
serviceName: ruleParams.serviceName,
|
||||
environment: getEnvironmentLabel(environment),
|
||||
|
@ -252,5 +252,5 @@ export function registerTransactionDurationAlertType({
|
|||
},
|
||||
});
|
||||
|
||||
alerting.registerType(type);
|
||||
alerting.registerType(ruleType);
|
||||
}
|
|
@ -9,19 +9,19 @@ import { rangeQuery, termQuery } from '@kbn/observability-plugin/server';
|
|||
import {
|
||||
SERVICE_NAME,
|
||||
TRANSACTION_TYPE,
|
||||
} from '../../../../common/elasticsearch_fieldnames';
|
||||
import { environmentQuery } from '../../../../common/utils/environment_query';
|
||||
import { AlertParams } from '../route';
|
||||
} from '../../../../../common/elasticsearch_fieldnames';
|
||||
import { environmentQuery } from '../../../../../common/utils/environment_query';
|
||||
import { AlertParams } from '../../route';
|
||||
import {
|
||||
getSearchTransactionsEvents,
|
||||
getDocumentTypeFilterForTransactions,
|
||||
getProcessorEventForTransactions,
|
||||
} from '../../../lib/helpers/transactions';
|
||||
import { Setup } from '../../../lib/helpers/setup_request';
|
||||
} from '../../../../lib/helpers/transactions';
|
||||
import { Setup } from '../../../../lib/helpers/setup_request';
|
||||
import {
|
||||
calculateFailedTransactionRate,
|
||||
getOutcomeAggregation,
|
||||
} from '../../../lib/helpers/transaction_error_rate';
|
||||
} from '../../../../lib/helpers/transaction_error_rate';
|
||||
|
||||
export async function getTransactionErrorRateChartPreview({
|
||||
setup,
|
|
@ -5,14 +5,14 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { registerTransactionErrorRateAlertType } from './register_transaction_error_rate_alert_type';
|
||||
import { createRuleTypeMocks } from './test_utils';
|
||||
import { registerTransactionErrorRateRuleType } from './register_transaction_error_rate_rule_type';
|
||||
import { createRuleTypeMocks } from '../../test_utils';
|
||||
|
||||
describe('Transaction error rate alert', () => {
|
||||
it("doesn't send an alert when rate is less than threshold", async () => {
|
||||
const { services, dependencies, executor } = createRuleTypeMocks();
|
||||
|
||||
registerTransactionErrorRateAlertType({
|
||||
registerTransactionErrorRateRuleType({
|
||||
...dependencies,
|
||||
});
|
||||
|
||||
|
@ -49,7 +49,7 @@ describe('Transaction error rate alert', () => {
|
|||
const { services, dependencies, executor, scheduleActions } =
|
||||
createRuleTypeMocks();
|
||||
|
||||
registerTransactionErrorRateAlertType({
|
||||
registerTransactionErrorRateRuleType({
|
||||
...dependencies,
|
||||
});
|
||||
|
|
@ -20,30 +20,30 @@ import {
|
|||
ENVIRONMENT_NOT_DEFINED,
|
||||
getEnvironmentEsField,
|
||||
getEnvironmentLabel,
|
||||
} from '../../../common/environment_filter_values';
|
||||
import { getAlertUrlTransaction } from '../../../common/utils/formatters';
|
||||
} from '../../../../../common/environment_filter_values';
|
||||
import { getAlertUrlTransaction } from '../../../../../common/utils/formatters';
|
||||
import {
|
||||
AlertType,
|
||||
ALERT_TYPES_CONFIG,
|
||||
ApmRuleType,
|
||||
RULE_TYPES_CONFIG,
|
||||
APM_SERVER_FEATURE_ID,
|
||||
formatTransactionErrorRateReason,
|
||||
} from '../../../common/alert_types';
|
||||
} from '../../../../../common/rules/apm_rule_types';
|
||||
import {
|
||||
EVENT_OUTCOME,
|
||||
PROCESSOR_EVENT,
|
||||
SERVICE_ENVIRONMENT,
|
||||
SERVICE_NAME,
|
||||
TRANSACTION_TYPE,
|
||||
} from '../../../common/elasticsearch_fieldnames';
|
||||
import { EventOutcome } from '../../../common/event_outcome';
|
||||
import { asDecimalOrInteger } from '../../../common/utils/formatters';
|
||||
import { environmentQuery } from '../../../common/utils/environment_query';
|
||||
import { getApmIndices } from '../settings/apm_indices/get_apm_indices';
|
||||
import { apmActionVariables } from './action_variables';
|
||||
import { alertingEsClient } from './alerting_es_client';
|
||||
import { RegisterRuleDependencies } from './register_apm_alerts';
|
||||
import { SearchAggregatedTransactionSetting } from '../../../common/aggregated_transactions';
|
||||
import { getDocumentTypeFilterForTransactions } from '../../lib/helpers/transactions';
|
||||
} from '../../../../../common/elasticsearch_fieldnames';
|
||||
import { EventOutcome } from '../../../../../common/event_outcome';
|
||||
import { asDecimalOrInteger } from '../../../../../common/utils/formatters';
|
||||
import { environmentQuery } from '../../../../../common/utils/environment_query';
|
||||
import { getApmIndices } from '../../../settings/apm_indices/get_apm_indices';
|
||||
import { apmActionVariables } from '../../action_variables';
|
||||
import { alertingEsClient } from '../../alerting_es_client';
|
||||
import { RegisterRuleDependencies } from '../../register_apm_rule_types';
|
||||
import { SearchAggregatedTransactionSetting } from '../../../../../common/aggregated_transactions';
|
||||
import { getDocumentTypeFilterForTransactions } from '../../../../lib/helpers/transactions';
|
||||
|
||||
const paramsSchema = schema.object({
|
||||
windowSize: schema.number(),
|
||||
|
@ -54,9 +54,9 @@ const paramsSchema = schema.object({
|
|||
environment: schema.string(),
|
||||
});
|
||||
|
||||
const alertTypeConfig = ALERT_TYPES_CONFIG[AlertType.TransactionErrorRate];
|
||||
const ruleTypeConfig = RULE_TYPES_CONFIG[ApmRuleType.TransactionErrorRate];
|
||||
|
||||
export function registerTransactionErrorRateAlertType({
|
||||
export function registerTransactionErrorRateRuleType({
|
||||
alerting,
|
||||
ruleDataClient,
|
||||
logger,
|
||||
|
@ -70,10 +70,10 @@ export function registerTransactionErrorRateAlertType({
|
|||
|
||||
alerting.registerType(
|
||||
createLifecycleRuleType({
|
||||
id: AlertType.TransactionErrorRate,
|
||||
name: alertTypeConfig.name,
|
||||
actionGroups: alertTypeConfig.actionGroups,
|
||||
defaultActionGroupId: alertTypeConfig.defaultActionGroupId,
|
||||
id: ApmRuleType.TransactionErrorRate,
|
||||
name: ruleTypeConfig.name,
|
||||
actionGroups: ruleTypeConfig.actionGroups,
|
||||
defaultActionGroupId: ruleTypeConfig.defaultActionGroupId,
|
||||
validate: {
|
||||
params: paramsSchema,
|
||||
},
|
||||
|
@ -225,7 +225,7 @@ export function registerTransactionErrorRateAlertType({
|
|||
services
|
||||
.alertWithLifecycle({
|
||||
id: [
|
||||
AlertType.TransactionErrorRate,
|
||||
ApmRuleType.TransactionErrorRate,
|
||||
serviceName,
|
||||
transactionType,
|
||||
environment,
|
||||
|
@ -242,7 +242,7 @@ export function registerTransactionErrorRateAlertType({
|
|||
[ALERT_REASON]: reasonMessage,
|
||||
},
|
||||
})
|
||||
.scheduleActions(alertTypeConfig.defaultActionGroupId, {
|
||||
.scheduleActions(ruleTypeConfig.defaultActionGroupId, {
|
||||
serviceName,
|
||||
transactionType,
|
||||
environment: getEnvironmentLabel(environment),
|
|
@ -7191,7 +7191,6 @@
|
|||
"xpack.apm.error.prompt.body": "Veuillez consulter la console de développeur de votre navigateur pour plus de détails.",
|
||||
"xpack.apm.error.prompt.title": "Désolé, une erreur s'est produite :(",
|
||||
"xpack.apm.errorCountAlert.name": "Seuil de nombre d'erreurs",
|
||||
"xpack.apm.errorCountAlertTrigger.errors": " erreurs",
|
||||
"xpack.apm.errorGroup.chart.ocurrences": "Occurrences",
|
||||
"xpack.apm.errorGroupDetails.culpritLabel": "Coupable",
|
||||
"xpack.apm.errorGroupDetails.errorOccurrenceTitle": "Occurrence d'erreur",
|
||||
|
@ -7888,12 +7887,8 @@
|
|||
"xpack.apm.transactionDurationAlert.aggregationType.99th": "99e centile",
|
||||
"xpack.apm.transactionDurationAlert.aggregationType.avg": "Moyenne",
|
||||
"xpack.apm.transactionDurationAlert.name": "Seuil de latence",
|
||||
"xpack.apm.transactionDurationAlertTrigger.ms": "ms",
|
||||
"xpack.apm.transactionDurationAlertTrigger.when": "Quand",
|
||||
"xpack.apm.transactionDurationAnomalyAlertTrigger.anomalySeverity": "Comporte une anomalie avec sévérité",
|
||||
"xpack.apm.transactionDurationLabel": "Durée",
|
||||
"xpack.apm.transactionErrorRateAlert.name": "Seuil du taux de transactions ayant échoué",
|
||||
"xpack.apm.transactionErrorRateAlertTrigger.isAbove": "est supérieur à",
|
||||
"xpack.apm.transactions.latency.chart.95thPercentileLabel": "95e centile",
|
||||
"xpack.apm.transactions.latency.chart.99thPercentileLabel": "99e centile",
|
||||
"xpack.apm.transactions.latency.chart.averageLabel": "Moyenne",
|
||||
|
|
|
@ -7179,7 +7179,6 @@
|
|||
"xpack.apm.error.prompt.body": "詳細はブラウザの開発者コンソールをご確認ください。",
|
||||
"xpack.apm.error.prompt.title": "申し訳ございませんが、エラーが発生しました :(",
|
||||
"xpack.apm.errorCountAlert.name": "エラー数しきい値",
|
||||
"xpack.apm.errorCountAlertTrigger.errors": " エラー",
|
||||
"xpack.apm.errorGroup.chart.ocurrences": "オカレンス",
|
||||
"xpack.apm.errorGroupDetails.culpritLabel": "原因",
|
||||
"xpack.apm.errorGroupDetails.errorOccurrenceTitle": "エラーのオカレンス",
|
||||
|
@ -7875,12 +7874,8 @@
|
|||
"xpack.apm.transactionDurationAlert.aggregationType.99th": "99 パーセンタイル",
|
||||
"xpack.apm.transactionDurationAlert.aggregationType.avg": "平均",
|
||||
"xpack.apm.transactionDurationAlert.name": "レイテンシしきい値",
|
||||
"xpack.apm.transactionDurationAlertTrigger.ms": "ms",
|
||||
"xpack.apm.transactionDurationAlertTrigger.when": "タイミング",
|
||||
"xpack.apm.transactionDurationAnomalyAlertTrigger.anomalySeverity": "異常と重要度があります",
|
||||
"xpack.apm.transactionDurationLabel": "期間",
|
||||
"xpack.apm.transactionErrorRateAlert.name": "失敗したトランザクション率しきい値",
|
||||
"xpack.apm.transactionErrorRateAlertTrigger.isAbove": "より大きい",
|
||||
"xpack.apm.transactions.latency.chart.95thPercentileLabel": "95 パーセンタイル",
|
||||
"xpack.apm.transactions.latency.chart.99thPercentileLabel": "99 パーセンタイル",
|
||||
"xpack.apm.transactions.latency.chart.averageLabel": "平均",
|
||||
|
|
|
@ -7195,7 +7195,6 @@
|
|||
"xpack.apm.error.prompt.body": "有关详情,请查看您的浏览器开发者控制台。",
|
||||
"xpack.apm.error.prompt.title": "抱歉,发生错误 :(",
|
||||
"xpack.apm.errorCountAlert.name": "错误计数阈值",
|
||||
"xpack.apm.errorCountAlertTrigger.errors": " 错误",
|
||||
"xpack.apm.errorGroup.chart.ocurrences": "发生次数",
|
||||
"xpack.apm.errorGroupDetails.culpritLabel": "原因",
|
||||
"xpack.apm.errorGroupDetails.errorOccurrenceTitle": "错误发生",
|
||||
|
@ -7892,12 +7891,8 @@
|
|||
"xpack.apm.transactionDurationAlert.aggregationType.99th": "第 99 个百分位",
|
||||
"xpack.apm.transactionDurationAlert.aggregationType.avg": "平均值",
|
||||
"xpack.apm.transactionDurationAlert.name": "延迟阈值",
|
||||
"xpack.apm.transactionDurationAlertTrigger.ms": "ms",
|
||||
"xpack.apm.transactionDurationAlertTrigger.when": "当",
|
||||
"xpack.apm.transactionDurationAnomalyAlertTrigger.anomalySeverity": "有异常,严重性为",
|
||||
"xpack.apm.transactionDurationLabel": "持续时间",
|
||||
"xpack.apm.transactionErrorRateAlert.name": "失败事务率阈值",
|
||||
"xpack.apm.transactionErrorRateAlertTrigger.isAbove": "高于",
|
||||
"xpack.apm.transactions.latency.chart.95thPercentileLabel": "第 95 个百分位",
|
||||
"xpack.apm.transactions.latency.chart.99thPercentileLabel": "第 99 个百分位",
|
||||
"xpack.apm.transactions.latency.chart.averageLabel": "平均值",
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import { apm, timerange } from '@kbn/apm-synthtrace';
|
||||
import expect from '@kbn/expect';
|
||||
import { range } from 'lodash';
|
||||
import { AlertType } from '@kbn/apm-plugin/common/alert_types';
|
||||
import { ApmRuleType } from '@kbn/apm-plugin/common/rules/apm_rule_types';
|
||||
import { FtrProviderContext } from '../../common/ftr_provider_context';
|
||||
import { createAndRunApmMlJob } from '../../common/utils/create_and_run_apm_ml_job';
|
||||
import { waitForRuleStatus } from './wait_for_rule_status';
|
||||
|
@ -96,7 +96,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
},
|
||||
tags: ['apm', 'service.name:service-a'],
|
||||
name: 'Latency anomaly | service-a',
|
||||
rule_type_id: AlertType.Anomaly,
|
||||
rule_type_id: ApmRuleType.Anomaly,
|
||||
notify_when: 'onActiveAlert',
|
||||
actions: [],
|
||||
});
|
||||
|
|
|
@ -33,7 +33,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
it('transaction_error_rate (without data)', async () => {
|
||||
const options = getOptions();
|
||||
const response = await apmApiClient.readUser({
|
||||
endpoint: 'GET /internal/apm/alerts/chart_preview/transaction_error_rate',
|
||||
endpoint: 'GET /internal/apm/rule_types/transaction_error_rate/chart_preview',
|
||||
...options,
|
||||
});
|
||||
|
||||
|
@ -41,12 +41,12 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
expect(response.body.errorRateChartPreview).to.eql([]);
|
||||
});
|
||||
|
||||
it('transaction_error_count (without data)', async () => {
|
||||
it('error_count (without data)', async () => {
|
||||
const options = getOptions();
|
||||
options.params.query.transactionType = undefined;
|
||||
|
||||
const response = await apmApiClient.readUser({
|
||||
endpoint: 'GET /internal/apm/alerts/chart_preview/transaction_error_count',
|
||||
endpoint: 'GET /internal/apm/rule_types/error_count/chart_preview',
|
||||
...options,
|
||||
});
|
||||
|
||||
|
@ -58,7 +58,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
const options = getOptions();
|
||||
|
||||
const response = await apmApiClient.readUser({
|
||||
endpoint: 'GET /internal/apm/alerts/chart_preview/transaction_duration',
|
||||
endpoint: 'GET /internal/apm/rule_types/transaction_duration/chart_preview',
|
||||
...options,
|
||||
});
|
||||
|
||||
|
@ -71,7 +71,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
it('transaction_error_rate (with data)', async () => {
|
||||
const options = getOptions();
|
||||
const response = await apmApiClient.readUser({
|
||||
endpoint: 'GET /internal/apm/alerts/chart_preview/transaction_error_rate',
|
||||
endpoint: 'GET /internal/apm/rule_types/transaction_error_rate/chart_preview',
|
||||
...options,
|
||||
});
|
||||
|
||||
|
@ -83,12 +83,12 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
).to.equal(true);
|
||||
});
|
||||
|
||||
it('transaction_error_count (with data)', async () => {
|
||||
it('error_count (with data)', async () => {
|
||||
const options = getOptions();
|
||||
options.params.query.transactionType = undefined;
|
||||
|
||||
const response = await apmApiClient.readUser({
|
||||
endpoint: 'GET /internal/apm/alerts/chart_preview/transaction_error_count',
|
||||
endpoint: 'GET /internal/apm/rule_types/error_count/chart_preview',
|
||||
...options,
|
||||
});
|
||||
|
||||
|
@ -104,7 +104,7 @@ export default function ApiTest({ getService }: FtrProviderContext) {
|
|||
const options = getOptions();
|
||||
const response = await apmApiClient.readUser({
|
||||
...options,
|
||||
endpoint: 'GET /internal/apm/alerts/chart_preview/transaction_duration',
|
||||
endpoint: 'GET /internal/apm/rule_types/transaction_duration/chart_preview',
|
||||
});
|
||||
|
||||
expect(response.status).to.be(200);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue