Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Response Ops][Alerting] Handle unflattened ES query docs #167583

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,114 changes: 389 additions & 725 deletions x-pack/plugins/alerting/server/alerts_client/alerts_client.test.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { zip, get } from 'lodash';
// these fields are the one's we'll refresh from the fresh mget'd docs
const REFRESH_FIELDS_ALWAYS = [ALERT_WORKFLOW_STATUS, ALERT_WORKFLOW_TAGS, ALERT_CASE_IDS];
const REFRESH_FIELDS_CONDITIONAL = [ALERT_STATUS];
const REFRESH_FIELDS_ALL = [...REFRESH_FIELDS_ALWAYS, ...REFRESH_FIELDS_CONDITIONAL];
export const REFRESH_FIELDS_ALL = [...REFRESH_FIELDS_ALWAYS, ...REFRESH_FIELDS_CONDITIONAL];

export interface ResolveAlertConflictsParams {
esClient: ElasticsearchClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,8 @@
*/
import { Alert as LegacyAlert } from '../../alert/alert';
import { buildNewAlert } from './build_new_alert';
import type { AlertRule } from '../types';
import { Alert } from '@kbn/alerts-as-data-utils';
import {
ALERT_RULE_CATEGORY,
ALERT_RULE_CONSUMER,
ALERT_RULE_EXECUTION_UUID,
ALERT_RULE_NAME,
ALERT_RULE_PARAMETERS,
ALERT_RULE_PRODUCER,
ALERT_RULE_REVISION,
ALERT_RULE_TAGS,
ALERT_RULE_TYPE_ID,
ALERT_RULE_UUID,
SPACE_IDS,
ALERT_ACTION_GROUP,
ALERT_DURATION,
Expand All @@ -37,36 +26,7 @@ import {
VERSION,
ALERT_TIME_RANGE,
} from '@kbn/rule-data-utils';

const rule = {
category: 'My test rule',
consumer: 'bar',
execution: {
uuid: '5f6aa57d-3e22-484e-bae8-cbed868f4d28',
},
name: 'rule-name',
parameters: {
bar: true,
},
producer: 'alerts',
revision: 0,
rule_type_id: 'test.rule-type',
tags: ['rule-', '-tags'],
uuid: '1',
};
const alertRule: AlertRule = {
[ALERT_RULE_CATEGORY]: rule.category,
[ALERT_RULE_CONSUMER]: rule.consumer,
[ALERT_RULE_EXECUTION_UUID]: rule.execution.uuid,
[ALERT_RULE_NAME]: rule.name,
[ALERT_RULE_PARAMETERS]: rule.parameters,
[ALERT_RULE_PRODUCER]: rule.producer,
[ALERT_RULE_REVISION]: rule.revision,
[ALERT_RULE_TYPE_ID]: rule.rule_type_id,
[ALERT_RULE_TAGS]: rule.tags,
[ALERT_RULE_UUID]: rule.uuid,
[SPACE_IDS]: ['default'],
};
import { alertRule } from './test_fixtures';

describe('buildNewAlert', () => {
test('should build alert document with info from legacy alert', () => {
Expand Down
Loading