Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
benakansara committed Jun 15, 2023
1 parent aaa7e04 commit d23a7f4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
2 changes: 0 additions & 2 deletions x-pack/plugins/apm/common/rules/apm_rule_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ export interface PreviewChartResponseItem {
data: Array<{ x: number; y: number | null }>;
}

export type PreviewChartResponse = PreviewChartResponseItem[];

export const THRESHOLD_MET_GROUP_ID = 'threshold_met';
export type ThresholdMetActionGroupId = typeof THRESHOLD_MET_GROUP_ID;
const THRESHOLD_MET_GROUP: ActionGroup<ThresholdMetActionGroupId> = {
Expand Down
3 changes: 2 additions & 1 deletion x-pack/plugins/apm/server/routes/alerts/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { createApmServerRoute } from '../apm_routes/create_apm_server_route';
import { environmentRt, rangeRt } from '../default_api_types';
import {
AggregationType,
PreviewChartResponse,
PreviewChartResponseItem,
} from '../../../common/rules/apm_rule_types';
import { getApmEventClient } from '../../lib/helpers/get_apm_event_client';

Expand All @@ -42,6 +42,7 @@ const alertParamsRt = t.intersection([
}),
]);

export type PreviewChartResponse = PreviewChartResponseItem[];
export type AlertParams = t.TypeOf<typeof alertParamsRt>;

const transactionErrorRateChartPreview = createApmServerRoute({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,12 @@ import {
PROCESSOR_EVENT,
SERVICE_NAME,
} from '../../../../../common/es_fields/apm';
import { AlertParams } from '../../route';
import { AlertParams, PreviewChartResponse } from '../../route';
import { environmentQuery } from '../../../../../common/utils/environment_query';
import { APMEventClient } from '../../../../lib/helpers/create_es_client/create_apm_event_client';
import { getGroupByTerms } from '../utils/get_groupby_terms';
import { getAllGroupByFields } from '../../../../../common/rules/get_all_groupby_fields';
import {
ApmRuleType,
PreviewChartResponse,
} from '../../../../../common/rules/apm_rule_types';
import { ApmRuleType } from '../../../../../common/rules/apm_rule_types';

export async function getTransactionErrorCountChartPreview({
apmEventClient,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@
*/

import { rangeQuery, termQuery } from '@kbn/observability-plugin/server';
import {
ApmRuleType,
PreviewChartResponse,
} from '../../../../../common/rules/apm_rule_types';
import { ApmRuleType } from '../../../../../common/rules/apm_rule_types';
import {
SERVICE_NAME,
TRANSACTION_TYPE,
TRANSACTION_NAME,
EVENT_OUTCOME,
} from '../../../../../common/es_fields/apm';
import { environmentQuery } from '../../../../../common/utils/environment_query';
import { AlertParams } from '../../route';
import { AlertParams, PreviewChartResponse } from '../../route';
import {
getSearchTransactionsEvents,
getDocumentTypeFilterForTransactions,
Expand Down

0 comments on commit d23a7f4

Please sign in to comment.