-
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
[Response Ops][Alerting] Migrate installation of context-specific component templates, index templates and concrete write index to framework for alerts-as-data #151792
Merged
+1,690
−883
Merged
Changes from 4 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
cc24f4d
Registering all rule types with alerting and conditionally having fra…
ymao1 47e3cbf
Cleanup
ymao1 004ada0
Fixing race condition between existing rule running and framework setup
ymao1 e04ee96
Merge branch 'main' of github.com:elastic/kibana into alerting/faad-r…
ymao1 788c990
Rule registry should continue installing preview stuff
ymao1 1c6dc24
Merging in main
ymao1 41522c1
Merging in main
ymao1 9bd797d
Refactoring resource installation helper
ymao1 662a40d
Renaming isContextInitialized fn
ymao1 d3dcbab
PR feedback
ymao1 f18446a
Returning error messages with init result
ymao1 87cecce
Merging in main
ymao1 05db78c
Fixing types
ymao1 7f3149e
Merge branch 'main' into alerting/faad-resources-component
kibanamachine c071f5d
Merge branch 'main' into alerting/faad-resources-component
kibanamachine 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
20 changes: 20 additions & 0 deletions
20
packages/kbn-alerts-as-data-utils/src/field_maps/legacy_experimental_field_map.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,20 @@ | ||
/* | ||
* 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 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { ALERT_EVALUATION_THRESHOLD, ALERT_EVALUATION_VALUE } from '@kbn/rule-data-utils'; | ||
|
||
export const legacyExperimentalFieldMap = { | ||
[ALERT_EVALUATION_THRESHOLD]: { | ||
type: 'scaled_float', | ||
scaling_factor: 100, | ||
required: false, | ||
}, | ||
[ALERT_EVALUATION_VALUE]: { type: 'scaled_float', scaling_factor: 100, required: false }, | ||
} as const; | ||
|
||
export type ExperimentalRuleFieldMap = typeof legacyExperimentalFieldMap; |
79 changes: 79 additions & 0 deletions
79
...plugins/alerting/common/alert_schema/field_maps/component_template_from_field_map.test.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,79 @@ | ||
/* | ||
* 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 { getComponentTemplateFromFieldMap } from './component_template_from_field_map'; | ||
import { testFieldMap, expectedTestMapping } from './mapping_from_field_map.test'; | ||
|
||
describe('getComponentTemplateFromFieldMap', () => { | ||
it('correctly creates component template from field map', () => { | ||
expect( | ||
getComponentTemplateFromFieldMap({ name: 'test-mappings', fieldMap: testFieldMap }) | ||
).toEqual({ | ||
name: 'test-mappings', | ||
_meta: { | ||
managed: true, | ||
}, | ||
template: { | ||
settings: {}, | ||
mappings: { | ||
dynamic: 'strict', | ||
...expectedTestMapping, | ||
}, | ||
}, | ||
}); | ||
}); | ||
|
||
it('correctly creates component template with settings when includeSettings = true', () => { | ||
expect( | ||
getComponentTemplateFromFieldMap({ | ||
name: 'test-mappings', | ||
fieldMap: testFieldMap, | ||
includeSettings: true, | ||
}) | ||
).toEqual({ | ||
name: 'test-mappings', | ||
_meta: { | ||
managed: true, | ||
}, | ||
template: { | ||
settings: { | ||
number_of_shards: 1, | ||
'index.mapping.total_fields.limit': 1500, | ||
}, | ||
mappings: { | ||
dynamic: 'strict', | ||
...expectedTestMapping, | ||
}, | ||
}, | ||
}); | ||
}); | ||
|
||
it('correctly creates component template with dynamic setting when defined', () => { | ||
expect( | ||
getComponentTemplateFromFieldMap({ | ||
name: 'test-mappings', | ||
fieldMap: testFieldMap, | ||
includeSettings: true, | ||
dynamic: false, | ||
}) | ||
).toEqual({ | ||
name: 'test-mappings', | ||
_meta: { | ||
managed: true, | ||
}, | ||
template: { | ||
settings: { | ||
number_of_shards: 1, | ||
'index.mapping.total_fields.limit': 1500, | ||
}, | ||
mappings: { | ||
dynamic: false, | ||
...expectedTestMapping, | ||
}, | ||
}, | ||
}); | ||
}); | ||
}); |
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
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.
Moved from
x-pack/plugins/rule_registry/common/assets/field_maps/experimental_rule_field_map.ts