-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[ResponseOps][Alerting] Decouple feature IDs from consumers #183756
Draft
cnasikas
wants to merge
151
commits into
elastic:main
Choose a base branch
from
cnasikas:poc_decouple_consumers_feature_ids
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+26,765
−7,605
Draft
Changes from 148 commits
Commits
Show all changes
151 commits
Select commit
Hold shift + click to select a range
ed3015e
Change the schema of the alerting feature privilege
cnasikas 82a1a65
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas c8ec120
Change augmentRuleTypesWithAuthorization to use consumers instead of …
cnasikas 1a02609
Support legacy consumers
cnasikas 55f91fd
Fixes in rule filtering
cnasikas b3cea58
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas 5184d21
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas 3b7c89f
Change new schema
cnasikas b1a0a63
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas 8b5fd17
Filter out rule types with no registered consumers
cnasikas ac46730
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas c88e147
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas b69bff1
Refactor the way the AlertingAuthorization object is created
cnasikas e7363b1
Add the alerts consumers to all rule types
cnasikas e1b9845
Fix async type errors
cnasikas 41e5491
Add test for alerting authorization object creation
cnasikas a2b73f9
Add tests and support filtering
cnasikas 0bb255b
Add more tests
cnasikas 4c0c828
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas 736a63e
Finalize alerting auth unit tests and functionality
cnasikas 0a6261e
Fix types
cnasikas c4094d0
Fix tests
cnasikas 516ac6c
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas 83a8d41
Fix ML alerting registration
cnasikas c3b93c8
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas 05f858e
Fix stack alerts tests
cnasikas 7578b2b
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine 835315f
Merge branch 'poc_decouple_consumers_feature_ids' of github.com:cnasi…
cnasikas c28823b
Fix more types
cnasikas 9915f67
Show rule types with alerts consumer in o11y
cnasikas 7a66de3
Fix session_view tests
cnasikas 87e0ef2
Fix types and linting errors
cnasikas 0251d48
Fix rule_registry tests
cnasikas 9f84b35
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas 4ff4c02
Fix stack_alerts tests
cnasikas 1bd6287
Fix functional tests alerting registration
cnasikas 5d8065f
Fix triggers_actions_ui unit tests
cnasikas df5ed40
Improve error handling when constructing the AlertingAuthorization class
cnasikas 291b016
Fix types with rule client
cnasikas 14cd879
Fix more integration tests and types
cnasikas 9a4ddc0
Fix alerting integration tests
cnasikas 9c6d2cc
Fix infra e2e tests
cnasikas 85ccea0
Fix triggers_actions_ui tests
cnasikas 6f65625
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas 0c50971
Fix types
cnasikas 49570ae
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas 44cc854
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas 5140a06
Switch authorization and search strategy to rule type ids
cnasikas c2371d0
Fix usage of alerting authorization methods
cnasikas 3d89a36
Delete _feature_ids route
cnasikas cca6966
Switch rule registry routes to use ruleTypeIds instead of featureIds
cnasikas 52b472b
Change UI to use rule type IDs
cnasikas 8ac5324
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas 42c734a
Move rule types to a package
cnasikas a5335df
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas e19424d
Fix types after merge
cnasikas cc944b0
Use the new isSiemRuleType util
cnasikas c8fcf38
Use fetchAlertsFields to use rule type IDs
cnasikas 50c2812
Fix stack management types
cnasikas fb38a4c
Revert uptime file
cnasikas e40682c
Fix types to start
cnasikas 90a225a
Fix cases
cnasikas af70fd4
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas 4efcced
Fix types and tests
cnasikas 11d50be
Fix rule registry integration tests
cnasikas 824c3b1
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas 22cbb1e
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine d37760b
Improve search strategy alert handling
cnasikas 885d158
Fix search strategy integration tests
cnasikas f155d55
Merge branch 'poc_decouple_consumers_feature_ids' of github.com:cnasi…
cnasikas 2f8c646
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas c68f141
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas 01fa579
Fix tests and types
cnasikas f69402e
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas 9389991
Fix types and unit tests
cnasikas 218eb3e
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine b47ab8d
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas cb84ab4
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas fcc6a48
Fix arguments of getAuthorizedAlertsIndices
cnasikas f18ed29
Fix alerting integration tests
cnasikas e353051
Merge branch 'poc_decouple_consumers_feature_ids' of github.com:cnasi…
cnasikas 3f1fc68
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine 1c19bed
Remove alerts consumer for security rule types
cnasikas d2bb1d0
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas fdefdb6
Add o11y schema
cnasikas c9a347e
Fix getAlertsIndexRoute query schema
cnasikas fcb0cb7
Fix issues when detecting siem rule types
cnasikas cc2da8f
Merge branch 'poc_decouple_consumers_feature_ids' of github.com:cnasi…
cnasikas b7a68a2
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine 8f4f1e0
Fix test imports
cnasikas fa0439f
Change _aggregate API to use ruleTypeIds
cnasikas 4532eff
Add support of rule_type_ids in the Find API
cnasikas 4129b93
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas fdd178a
[CI] Auto-commit changed files from 'node scripts/capture_oas_snapsho…
kibanamachine 1d5f50f
Fix find API integration tests
cnasikas e09a12c
Remove unecessary ruleTypeIds props
cnasikas c27937f
Use the ruleTypeIds filter in the search strategy
cnasikas 29b3b8d
Use the ruleTypeIds filter in the alerts client
cnasikas c1be282
Make rule type ID optional again
cnasikas 46097ff
Fix find URLs
cnasikas 6005315
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas 00db4c3
Merge branch 'poc_decouple_consumers_feature_ids' of github.com:cnasi…
cnasikas e0a9061
[CI] Auto-commit changed files from 'make api-docs && make api-docs-s…
kibanamachine bd2827f
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas 45fd8e4
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas bdc95c5
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas ddefd3b
Support filtering by consumers in the aggregate API
cnasikas 8589fb5
Support filtering by consumers while aggregating in the UI
cnasikas b342221
Support filtering by consumers in the find API
cnasikas 60fa3aa
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas 34bbac8
Merge branch 'poc_decouple_consumers_feature_ids' of github.com:cnasi…
cnasikas d2d9c27
Support filtering by consumers while finding rules in the UI
cnasikas a0b9b02
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas b284fda
Add type filters back
cnasikas 301559e
Add stack rules to o11y
cnasikas ed02cad
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas b59577d
Support filtering by consumers in the search strategy
cnasikas 60292a6
Add discover consumer to stack feature for es query rule type
cnasikas e55e4e7
Fix issues with find rules filtering
cnasikas 0430634
Pass the consumers to the alerts table
cnasikas de75f29
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas eaf3376
Update alert as data client to support filtering by consumers
cnasikas 3d9038d
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas d2e83a0
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas bb93726
Update to UI to use consumers for RAC APIs
cnasikas 4a03696
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine f5adf3e
Fix aggregation filtering bug
cnasikas e0aff95
Fix search strategy empty response
cnasikas 5ca68f4
Make the stack alerts table work with the new changes
cnasikas 06b3f74
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas cd61a88
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas cfdb8a9
Fix merging conflicts
cnasikas ef72303
Initialize auth class without auth for 404 space errors
cnasikas ffbf250
Fix tests
cnasikas 31af86c
Filiter also by the alerts consumer in o11y apps
cnasikas 9870997
Fix integration tests
cnasikas 21201f1
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas c0a3b79
Fix security solution cypress tests
cnasikas 8e33dcc
Fix cypress rule snoozing test
cnasikas 8fe6190
Use rule type IDs instead of a single rule type ID in the alerts sear…
cnasikas 963f4e9
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas 005375d
Fix privileges unit test
cnasikas a200984
fix: update deprecated privileges API integration tests to account fo…
azasypkin 24ec594
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas c33aaad
Merge branch 'poc_decouple_consumers_feature_ids' of github.com:cnasi…
cnasikas 1f1ce53
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas 9618c26
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas 16cdf79
Fix i18n
cnasikas 0ad199b
Merge branch 'main' into poc_decouple_consumers_feature_ids
cnasikas b0892c6
Nits, fixes, and tests
cnasikas ba9bba3
[CI] Auto-commit changed files from 'node scripts/notice'
kibanamachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
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
90 changes: 90 additions & 0 deletions
90
packages/kbn-alerts-as-data-utils/src/schemas/generated/observability_threshold_schema.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,90 @@ | ||
/* | ||
* 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", the "GNU Affero General Public License v3.0 only", 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", the "GNU Affero General Public | ||
* License v3.0 only", or the "Server Side Public License, v 1". | ||
*/ | ||
// ---------------------------------- WARNING ---------------------------------- | ||
// this file was generated, and should not be edited by hand | ||
// ---------------------------------- WARNING ---------------------------------- | ||
import * as rt from 'io-ts'; | ||
import { Either } from 'fp-ts/lib/Either'; | ||
import { AlertSchema } from './alert_schema'; | ||
import { EcsSchema } from './ecs_schema'; | ||
const ISO_DATE_PATTERN = /^d{4}-d{2}-d{2}Td{2}:d{2}:d{2}.d{3}Z$/; | ||
export const IsoDateString = new rt.Type<string, string, unknown>( | ||
'IsoDateString', | ||
rt.string.is, | ||
(input, context): Either<rt.Errors, string> => { | ||
if (typeof input === 'string' && ISO_DATE_PATTERN.test(input)) { | ||
return rt.success(input); | ||
} else { | ||
return rt.failure(input, context); | ||
} | ||
}, | ||
rt.identity | ||
); | ||
export type IsoDateStringC = typeof IsoDateString; | ||
export const schemaUnknown = rt.unknown; | ||
export const schemaUnknownArray = rt.array(rt.unknown); | ||
export const schemaString = rt.string; | ||
export const schemaStringArray = rt.array(schemaString); | ||
export const schemaNumber = rt.number; | ||
export const schemaNumberArray = rt.array(schemaNumber); | ||
export const schemaDate = rt.union([IsoDateString, schemaNumber]); | ||
export const schemaDateArray = rt.array(schemaDate); | ||
export const schemaDateRange = rt.partial({ | ||
gte: schemaDate, | ||
lte: schemaDate, | ||
}); | ||
export const schemaDateRangeArray = rt.array(schemaDateRange); | ||
export const schemaStringOrNumber = rt.union([schemaString, schemaNumber]); | ||
export const schemaStringOrNumberArray = rt.array(schemaStringOrNumber); | ||
export const schemaBoolean = rt.boolean; | ||
export const schemaBooleanArray = rt.array(schemaBoolean); | ||
const schemaGeoPointCoords = rt.type({ | ||
type: schemaString, | ||
coordinates: schemaNumberArray, | ||
}); | ||
const schemaGeoPointString = schemaString; | ||
const schemaGeoPointLatLon = rt.type({ | ||
lat: schemaNumber, | ||
lon: schemaNumber, | ||
}); | ||
const schemaGeoPointLocation = rt.type({ | ||
location: schemaNumberArray, | ||
}); | ||
const schemaGeoPointLocationString = rt.type({ | ||
location: schemaString, | ||
}); | ||
export const schemaGeoPoint = rt.union([ | ||
schemaGeoPointCoords, | ||
schemaGeoPointString, | ||
schemaGeoPointLatLon, | ||
schemaGeoPointLocation, | ||
schemaGeoPointLocationString, | ||
]); | ||
export const schemaGeoPointArray = rt.array(schemaGeoPoint); | ||
// prettier-ignore | ||
const ObservabilityThresholdAlertRequired = rt.type({ | ||
}); | ||
// prettier-ignore | ||
const ObservabilityThresholdAlertOptional = rt.partial({ | ||
'kibana.alert.context': schemaUnknown, | ||
'kibana.alert.evaluation.threshold': schemaStringOrNumber, | ||
'kibana.alert.evaluation.value': schemaStringOrNumber, | ||
'kibana.alert.evaluation.values': schemaStringOrNumberArray, | ||
'kibana.alert.group': rt.array( | ||
rt.partial({ | ||
field: schemaStringArray, | ||
value: schemaStringArray, | ||
}) | ||
), | ||
}); | ||
|
||
// prettier-ignore | ||
export const ObservabilityThresholdAlertSchema = rt.intersection([ObservabilityThresholdAlertRequired, ObservabilityThresholdAlertOptional, AlertSchema, EcsSchema]); | ||
// prettier-ignore | ||
export type ObservabilityThresholdAlert = rt.TypeOf<typeof ObservabilityThresholdAlertSchema>; |
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
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.
I am not sure why this was generated.