-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Transform] Transforms health alerting rule type #112277
Merged
darnautov
merged 34 commits into
elastic:master
from
darnautov:transform-111945-health-alerting-rule
Oct 6, 2021
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
b7a5e78
[ML] init public code
darnautov 22764b1
[ML] init transform rule type from the monitoring plugin
darnautov 5528e11
[ML] add UI form
darnautov 4e893cd
[ML] only suggest continuous transforms
darnautov 01d4681
[ML] executor code for transform state check
darnautov ae1f4b4
[ML] update type
darnautov 90b0057
[ML] add description
darnautov 804e98c
[ML] rename state prop
darnautov fea3b9f
[ML] rename state prop
darnautov 4d38af1
[ML] update test assertion
darnautov e99df63
[ML] fix import
darnautov 6c27a24
[ML] fix i18 ids
darnautov 25e205d
[ML] update description
darnautov 9b45e6b
[ML] validation for Included transforms
darnautov 4a66cd5
[ML] fix exclude condtition
darnautov 7143506
[ML] remove transform rule from the monitoring rules
darnautov b7c5e39
[ML] add line break
darnautov 8777531
Merge remote-tracking branch 'upstream/master' into transform-111945-…
darnautov bbad483
[ML] disable control
darnautov 2d3db4d
[ML] update context description
darnautov fe295c2
[ML] update test assertion
darnautov e8ba26e
Update text
darnautov 2f78ca0
Merge branch 'master' into transform-111945-health-alerting-rule
kibanamachine 5f15ad1
Merge remote-tracking branch 'upstream/master' into transform-111945-…
darnautov 422777a
Merge remote-tracking branch 'upstream/master' into transform-111945-…
darnautov 76ef141
[ML] fix eslint
darnautov a4f2e28
[ML] fix eslint
darnautov af04cc9
[ML] api integration tests for transform alerting rule
darnautov 621f45a
Merge branch 'master' into transform-111945-health-alerting-rule
kibanamachine a6d8fe6
[ML] move transform alert setup, set Stack Rules as a producer
darnautov c363b2c
[ML] remove stack_alerts project ref
darnautov de0a7d9
[ML] update mappings
darnautov 0d5253c
[ML] update mappings
darnautov 4cbd7d2
[ML] update unit tests
darnautov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* 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 { TRANSFORM_RULE_TYPE } from './constants'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import type { AlertTypeParams } from '../../../alerting/common'; | ||
|
||
export type TransformHealthRuleParams = { | ||
includeTransforms?: string[]; | ||
excludeTransforms?: string[] | null; | ||
testsConfig?: { | ||
notStarted?: { | ||
enabled: boolean; | ||
} | null; | ||
} | null; | ||
} & AlertTypeParams; | ||
|
||
export type TransformHealthRuleTestsConfig = TransformHealthRuleParams['testsConfig']; | ||
|
||
export type TransformHealthTests = keyof Exclude<TransformHealthRuleTestsConfig, null | undefined>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import type { TransformHealthRuleTestsConfig } from '../types/alerting'; | ||
|
||
export function getResultTestConfig(config: TransformHealthRuleTestsConfig) { | ||
return { | ||
notStarted: { | ||
enabled: config?.notStarted?.enabled ?? true, | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* 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 { getTransformHealthRuleType } from './transform_health_rule_type'; |
8 changes: 8 additions & 0 deletions
8
x-pack/plugins/transform/public/alerting/transform_health_rule_type/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* 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 { getTransformHealthRuleType } from './register_transform_health_rule'; |
66 changes: 66 additions & 0 deletions
66
...ns/transform/public/alerting/transform_health_rule_type/register_transform_health_rule.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import { lazy } from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { TRANSFORM_RULE_TYPE } from '../../../common'; | ||
import type { TransformHealthRuleParams } from '../../../common/types/alerting'; | ||
import type { AlertTypeModel } from '../../../../triggers_actions_ui/public'; | ||
|
||
export function getTransformHealthRuleType(): AlertTypeModel<TransformHealthRuleParams> { | ||
return { | ||
id: TRANSFORM_RULE_TYPE.TRANSFORM_HEALTH, | ||
description: i18n.translate('xpack.transform.alertingRuleTypes.transformHealth.description', { | ||
defaultMessage: 'Alert when transforms experience operational issues.', | ||
}), | ||
iconClass: 'bell', | ||
documentationUrl(docLinks) { | ||
return docLinks.links.transforms.alertingRules; | ||
}, | ||
alertParamsExpression: lazy(() => import('./transform_health_rule_trigger')), | ||
validate: (alertParams: TransformHealthRuleParams) => { | ||
const validationResult = { | ||
errors: { | ||
includeTransforms: new Array<string>(), | ||
} as Record<keyof TransformHealthRuleParams, string[]>, | ||
}; | ||
|
||
if (!alertParams.includeTransforms?.length) { | ||
validationResult.errors.includeTransforms?.push( | ||
i18n.translate( | ||
'xpack.transform.alertTypes.transformHealth.includeTransforms.errorMessage', | ||
{ | ||
defaultMessage: 'At least one transform has to be selected', | ||
} | ||
) | ||
); | ||
} | ||
|
||
return validationResult; | ||
}, | ||
requiresAppContext: false, | ||
defaultActionMessage: i18n.translate( | ||
'xpack.transform.alertTypes.transformHealth.defaultActionMessage', | ||
{ | ||
defaultMessage: `[\\{\\{rule.name\\}\\}] Transform health check result: | ||
\\{\\{context.message\\}\\} | ||
\\{\\{#context.results\\}\\} | ||
Transform ID: \\{\\{transform_id\\}\\} | ||
peteharverson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
\\{\\{#description\\}\\}Transform description: \\{\\{description\\}\\} | ||
\\{\\{/description\\}\\}\\{\\{#transform_state\\}\\}Transform state: \\{\\{transform_state\\}\\} | ||
\\{\\{/transform_state\\}\\}\\{\\{#failure_reason\\}\\}Failure reason: \\{\\{failure_reason\\}\\} | ||
\\{\\{/failure_reason\\}\\}\\{\\{#notification_message\\}\\}Notification message: \\{\\{notification_message\\}\\} | ||
\\{\\{/notification_message\\}\\}\\{\\{#node_name\\}\\}Node name: \\{\\{node_name\\}\\} | ||
\\{\\{/node_name\\}\\}\\{\\{#timestamp\\}\\}Timestamp: \\{\\{timestamp\\}\\} | ||
\\{\\{/timestamp\\}\\} | ||
|
||
\\{\\{/context.results\\}\\} | ||
`, | ||
} | ||
), | ||
}; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you planning to address this TODO is the current PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no docs page for it yet, so I'm going to add it in the follow-up PR probably as soon as it's ready
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@darnautov This is the correct link. Docs are available at https://www.elastic.co/guide/en/elasticsearch/reference/master/transform-alerts.html