Skip to content

Commit 06b9122

Browse files
cesco-fcursoragent
andauthored
[SigEvents] Auto-create rules for high-severity queries during onboarding (elastic#267395)
## Summary Wires `cloneApiKeysOnCreate` (from elastic#265530) into the streams onboarding task so that high-severity (>=60) non-STATS queries get backing Kibana rules created automatically during onboarding, eliminating the manual promotion step for those queries. ### Changes - **Onboarding task** passes `rulesClientOptions: { cloneApiKeysOnCreate: true }` so rules get independent, non-expiring API keys - **`persistQueries`** routes new high-severity non-STATS queries to the rule-creating `syncQueries` path (same bulk call used by rule-backed replacements), while low-severity and STATS queries remain draft (no rules) ### Cleanup Removes the legacy manual-promotion UI and supporting code that is now redundant: - **Deleted components**: `PromotionCallout`, `SuggestedRulesFlyout` - **Deleted hooks**: `usePromotableQueries`, `useUnbackedQueriesCount` - **Removed client API methods**: `promoteAll`, `getUnbackedQueriesCount` from `useQueriesApi` - **Removed UI elements**: "Promote all" callout and unbacked-count badge from `KnowledgeIndicatorsTable` / discovery page tabs - **Removed server route**: `GET /internal/streams/queries/_unbacked_count` - **Removed server method**: `countPromotableUnbackedQueries` from `QueryClient` (and its tests) https://github.com/user-attachments/assets/d549d7b0-2c35-42e1-8808-99231e578fbf --------- Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 6889d71 commit 06b9122

27 files changed

Lines changed: 223 additions & 1343 deletions

File tree

x-pack/platform/packages/shared/kbn-streams-schema/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ export {
139139
type QueryType,
140140
QUERY_TYPE_MATCH,
141141
QUERY_TYPE_STATS,
142+
HIGH_SEVERITY_THRESHOLD,
142143
queryTypeSchema,
143144
type QueriesGetResponse,
144145
type QueriesOccurrencesGetResponse,

x-pack/platform/packages/shared/kbn-streams-schema/src/queries/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ export const QUERY_TYPE_STATS = 'stats' as const;
3030

3131
export type QueryType = typeof QUERY_TYPE_MATCH | typeof QUERY_TYPE_STATS;
3232

33+
/**
34+
* Minimum severity score for auto-creating backing rules.
35+
* Severity bands: Low < 40, Medium [40, 60), High [60, 80), Critical >= 80.
36+
* High + Critical queries are eligible for automatic rule creation.
37+
*/
38+
export const HIGH_SEVERITY_THRESHOLD = 60;
39+
3340
export const queryTypeSchema = z.enum([QUERY_TYPE_MATCH, QUERY_TYPE_STATS]);
3441

3542
export interface StreamQuery extends StreamQueryBase {

x-pack/platform/plugins/private/translations/translations/de-DE.json

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -51829,14 +51829,6 @@
5182951829
"xpack.streams.significantEvents.emptyState.onboardStreamButtonLabel": "Wissensindikatoren generieren",
5183051830
"xpack.streams.significantEvents.emptyState.title": "Die Wissensindikatoren dieses Streams wurden noch nicht extrahiert",
5183151831
"xpack.streams.significantEvents.emptyStateImage": "Illustration des leeren Zustands für die Ansicht „Wichtige Ereignisse“",
51832-
"xpack.streams.significantEvents.promotionCallout.acknowledgeError": "Generierungsergebnisse konnten nicht bestätigt werden",
51833-
"xpack.streams.significantEvents.promotionCallout.errorToast": "Abfragen konnten nicht befördert werden",
51834-
"xpack.streams.significantEvents.promotionCallout.message": "Wir haben {queryCount} erkannt, das Sie in {ruleCount} aufgrund der letzten Ausführung fördern können.",
51835-
"xpack.streams.significantEvents.promotionCallout.promoteButton": "Regeln erstellen",
51836-
"xpack.streams.significantEvents.promotionCallout.queryCount": "{count, plural, one {# query} other {# Abfragen}}",
51837-
"xpack.streams.significantEvents.promotionCallout.reviewButton": "Ergebnisse überprüfen",
51838-
"xpack.streams.significantEvents.promotionCallout.ruleCount": "{count, plural, one {# rule} other {# Regeln}}",
51839-
"xpack.streams.significantEvents.promotionCallout.successToast": "{count, plural, one {# query} other {# queries}} wurde erfolgreich zu {count, plural, one {rule} other {rules}} befördert.",
5184051832
"xpack.streams.significantEventsDiscovery.breadcrumbTitle": "Wichtige Ereignisse",
5184151833
"xpack.streams.significantEventsDiscovery.illustrationImage": "Illustration für die Entdeckungsansicht „Wichtige Ereignisse“",
5184251834
"xpack.streams.significantEventsDiscovery.knowledgeIndicatorsTab": "Wissensindikatoren",
@@ -52779,22 +52771,6 @@
5277952771
"xpack.streams.streamsTreeTable.retentionColumnName": "Aufbewahrung",
5278052772
"xpack.streams.streamsTreeTable.searchAriaLabel": "Streams nach Namen suchen",
5278152773
"xpack.streams.streamsTreeTable.tableCaptionAriaLabel": "Datentabelle für Streams, die Streamnamen mit Links, Dokumentanzahlen und Aufbewahrungsrichtlinien mit Links",
52782-
"xpack.streams.suggestedRulesFlyout.cancelButton": "Abbrechen",
52783-
"xpack.streams.suggestedRulesFlyout.createRulesButton": "Regeln erstellen",
52784-
"xpack.streams.suggestedRulesFlyout.createRulesError": "Regeln konnten nicht erstellt werden",
52785-
"xpack.streams.suggestedRulesFlyout.createRulesSuccess": "{count, plural, one {# rule} other {# Regeln}} erfolgreich erstellt.",
52786-
"xpack.streams.suggestedRulesFlyout.deleteAction": "Löschen",
52787-
"xpack.streams.suggestedRulesFlyout.deleteActionDescription": "Diese vorgeschlagene Regel entfernen",
52788-
"xpack.streams.suggestedRulesFlyout.deleteQueryError": "Abfrage konnte nicht gelöscht werden",
52789-
"xpack.streams.suggestedRulesFlyout.description": "Wir erstellen Regeln auf der Grundlage der Abfragen, die für diesen Stream von entscheidender Bedeutung sind. Sie können die Ergebnisse überprüfen und verwerfen.",
52790-
"xpack.streams.suggestedRulesFlyout.expandAriaLabel": "Zeilendetails erweitern",
52791-
"xpack.streams.suggestedRulesFlyout.minimizeAriaLabel": "Zeilendetails einklappen",
52792-
"xpack.streams.suggestedRulesFlyout.noItems": "Keine vorgeschlagenen Regeln gefunden.",
52793-
"xpack.streams.suggestedRulesFlyout.rulesColumn": "Regeln",
52794-
"xpack.streams.suggestedRulesFlyout.severityColumn": "Priorität",
52795-
"xpack.streams.suggestedRulesFlyout.showing": "Zeigt {count, plural, one {# Rule} other {# Regeln}}",
52796-
"xpack.streams.suggestedRulesFlyout.tableCaption": "Empfohlene Regeln",
52797-
"xpack.streams.suggestedRulesFlyout.title": "Empfohlene Regeln",
5279852774
"xpack.streams.suggestPipelineImage": "Pipeline vorschlagen",
5279952775
"xpack.streams.tableTitle.showing": "{count} von {total} {label} wird angezeigt",
5280052776
"xpack.streams.technicalPreviewLabel": "Technische Vorschau",

x-pack/platform/plugins/private/translations/translations/fr-FR.json

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -51652,11 +51652,6 @@
5165251652
"xpack.streams.significantEvents.emptyState.onboardStreamButtonLabel": "Générer des indicateurs de connaissances",
5165351653
"xpack.streams.significantEvents.emptyState.title": "Les indicateurs de connaissance de ce flux n’ont pas encore été extraits",
5165451654
"xpack.streams.significantEvents.emptyStateImage": "Illustration d'état vide pour la vue des événements significatifs",
51655-
"xpack.streams.significantEvents.promotionCallout.acknowledgeError": "Impossible de confirmer les résultats de la génération",
51656-
"xpack.streams.significantEvents.promotionCallout.errorToast": "Impossible de promouvoir les requêtes",
51657-
"xpack.streams.significantEvents.promotionCallout.message": "Nous avons détecté {queryCount} que vous pouvez promouvoir dans {ruleCount}, sur la base de la dernière exécution.",
51658-
"xpack.streams.significantEvents.promotionCallout.promoteButton": "Créer des règles",
51659-
"xpack.streams.significantEvents.promotionCallout.reviewButton": "Examiner les résultats",
5166051655
"xpack.streams.significantEventsDiscovery.breadcrumbTitle": "Événements importants",
5166151656
"xpack.streams.significantEventsDiscovery.illustrationImage": "Illustration pour la vue de découverte des événements importants",
5166251657
"xpack.streams.significantEventsDiscovery.knowledgeIndicatorsTab": "Indicateurs de connaissances",
@@ -52600,21 +52595,6 @@
5260052595
"xpack.streams.streamsTreeTable.retentionColumnName": "Conservation",
5260152596
"xpack.streams.streamsTreeTable.searchAriaLabel": "Rechercher les flux par nom",
5260252597
"xpack.streams.streamsTreeTable.tableCaptionAriaLabel": "Tableau de données Streams, listant les noms de flux avec des liens, les comptes de documents et les politiques de rétention avec des liens",
52603-
"xpack.streams.suggestedRulesFlyout.cancelButton": "Annuler",
52604-
"xpack.streams.suggestedRulesFlyout.createRulesButton": "Créer des règles",
52605-
"xpack.streams.suggestedRulesFlyout.createRulesError": "Échec de la création des règles",
52606-
"xpack.streams.suggestedRulesFlyout.deleteAction": "Supprimer",
52607-
"xpack.streams.suggestedRulesFlyout.deleteActionDescription": "Supprimez cette règle suggérée",
52608-
"xpack.streams.suggestedRulesFlyout.deleteQueryError": "Impossible de supprimer la requête",
52609-
"xpack.streams.suggestedRulesFlyout.description": "Nous générons des règles basées sur les requêtes qui sont d'une importance critique pour ce flux. Vous pouvez consulter et supprimer les résultats.",
52610-
"xpack.streams.suggestedRulesFlyout.expandAriaLabel": "Développer les détails de la ligne",
52611-
"xpack.streams.suggestedRulesFlyout.minimizeAriaLabel": "Réduire les détails de la ligne",
52612-
"xpack.streams.suggestedRulesFlyout.noItems": "Aucune règle suggérée n'a été trouvée.",
52613-
"xpack.streams.suggestedRulesFlyout.rulesColumn": "Règles",
52614-
"xpack.streams.suggestedRulesFlyout.severityColumn": "Gravité",
52615-
"xpack.streams.suggestedRulesFlyout.showing": "Affichage de {count, plural, one {# Rule} other {# Règles}}",
52616-
"xpack.streams.suggestedRulesFlyout.tableCaption": "Règles suggérées",
52617-
"xpack.streams.suggestedRulesFlyout.title": "Règles suggérées",
5261852598
"xpack.streams.suggestPipelineImage": "Suggérez un pipeline",
5261952599
"xpack.streams.tableTitle.showing": "Affichage de {count} {label} sur {total}",
5262052600
"xpack.streams.technicalPreviewLabel": "Version d'évaluation technique",

x-pack/platform/plugins/private/translations/translations/ja-JP.json

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -52020,14 +52020,6 @@
5202052020
"xpack.streams.significantEvents.emptyState.onboardStreamButtonLabel": "知識指標を生成する",
5202152021
"xpack.streams.significantEvents.emptyState.title": "このストリームのナレッジインジケーターはまだ抽出されていません",
5202252022
"xpack.streams.significantEvents.emptyStateImage": "重要なイベントビューの空の状態イラスト",
52023-
"xpack.streams.significantEvents.promotionCallout.acknowledgeError": "生成結果を認識できませんでした",
52024-
"xpack.streams.significantEvents.promotionCallout.errorToast": "クエリの昇格に失敗しました",
52025-
"xpack.streams.significantEvents.promotionCallout.message": "前回の実行に基づき、{ruleCount}件で昇格可能な{queryCount}件を検出しました。",
52026-
"xpack.streams.significantEvents.promotionCallout.promoteButton": "ルールを作成",
52027-
"xpack.streams.significantEvents.promotionCallout.queryCount": "{count, plural, one {# query} other {#件のクエリ}}",
52028-
"xpack.streams.significantEvents.promotionCallout.reviewButton": "結果を確認",
52029-
"xpack.streams.significantEvents.promotionCallout.ruleCount": "{count, plural, one {# rule} other {#件のルール}}",
52030-
"xpack.streams.significantEvents.promotionCallout.successToast": "{count, plural, one {# query} other {#件のクエリ}}が{count, plural, one {rule} other {ルール}}に正常に昇格しました。",
5203152023
"xpack.streams.significantEventsDiscovery.breadcrumbTitle": "重要なイベント",
5203252024
"xpack.streams.significantEventsDiscovery.illustrationImage": "重要なイベントの検出ビューの図",
5203352025
"xpack.streams.significantEventsDiscovery.knowledgeIndicatorsTab": "ナレッジインジケーター",
@@ -52969,22 +52961,6 @@
5296952961
"xpack.streams.streamsTreeTable.retentionColumnName": "保存",
5297052962
"xpack.streams.streamsTreeTable.searchAriaLabel": "名前でストリームを検索",
5297152963
"xpack.streams.streamsTreeTable.tableCaptionAriaLabel": "リンク付きストリーム名、ドキュメント数、リンク付き保持ポリシーを一覧表示したStreamsデータテーブル、",
52972-
"xpack.streams.suggestedRulesFlyout.cancelButton": "キャンセル",
52973-
"xpack.streams.suggestedRulesFlyout.createRulesButton": "ルールを作成",
52974-
"xpack.streams.suggestedRulesFlyout.createRulesError": "ルールの作成に失敗しました",
52975-
"xpack.streams.suggestedRulesFlyout.createRulesSuccess": "{count, plural, one {# rule} other {# 件のルール}}が正常に作成されました。",
52976-
"xpack.streams.suggestedRulesFlyout.deleteAction": "削除",
52977-
"xpack.streams.suggestedRulesFlyout.deleteActionDescription": "この推奨ルールを削除",
52978-
"xpack.streams.suggestedRulesFlyout.deleteQueryError": "クエリの削除に失敗しました",
52979-
"xpack.streams.suggestedRulesFlyout.description": "このストリームにとって重要なクエリに基づいてルールを生成します。結果を確認したり、破棄したりできます。",
52980-
"xpack.streams.suggestedRulesFlyout.expandAriaLabel": "行の詳細を展開",
52981-
"xpack.streams.suggestedRulesFlyout.minimizeAriaLabel": "行の詳細を折りたたみ",
52982-
"xpack.streams.suggestedRulesFlyout.noItems": "推奨ルールが見つかりません。",
52983-
"xpack.streams.suggestedRulesFlyout.rulesColumn": "ルール",
52984-
"xpack.streams.suggestedRulesFlyout.severityColumn": "深刻度",
52985-
"xpack.streams.suggestedRulesFlyout.showing": "{count, plural, one {# Rule} other {#件のルール}}を表示中",
52986-
"xpack.streams.suggestedRulesFlyout.tableCaption": "推奨されるルール",
52987-
"xpack.streams.suggestedRulesFlyout.title": "推奨されるルール",
5298852964
"xpack.streams.suggestPipelineImage": "パイプラインを提案してください",
5298952965
"xpack.streams.tableTitle.showing": "{total} {label}件中{count}を表示しています",
5299052966
"xpack.streams.technicalPreviewLabel": "テクニカルプレビュー",

x-pack/platform/plugins/private/translations/translations/zh-CN.json

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -52011,14 +52011,6 @@
5201152011
"xpack.streams.significantEvents.emptyState.onboardStreamButtonLabel": "生成知识指标",
5201252012
"xpack.streams.significantEvents.emptyState.title": "该流的知识指标尚未提取。",
5201352013
"xpack.streams.significantEvents.emptyStateImage": "“重大事件”视图的空状态示意图",
52014-
"xpack.streams.significantEvents.promotionCallout.acknowledgeError": "无法确认生成结果。",
52015-
"xpack.streams.significantEvents.promotionCallout.errorToast": "提升查询失败",
52016-
"xpack.streams.significantEvents.promotionCallout.message": "我们检测到 {queryCount},您可以在 {ruleCount} 中进行推广,基于上一次运行的结果。",
52017-
"xpack.streams.significantEvents.promotionCallout.promoteButton": "创建规则",
52018-
"xpack.streams.significantEvents.promotionCallout.queryCount": "{count, plural, one {# 个查询} other {# 个查询}}",
52019-
"xpack.streams.significantEvents.promotionCallout.reviewButton": "复查结果",
52020-
"xpack.streams.significantEvents.promotionCallout.ruleCount": "{count, plural, one {# 个规则} other {# 个规则}}",
52021-
"xpack.streams.significantEvents.promotionCallout.successToast": "{count, plural, one {# 个查询} other {# 个查询}} 已成功提升为{count, plural, one {规则} other {规则}}。",
5202252014
"xpack.streams.significantEventsDiscovery.breadcrumbTitle": "重大事件",
5202352015
"xpack.streams.significantEventsDiscovery.illustrationImage": "重大事件发现视图的示意图",
5202452016
"xpack.streams.significantEventsDiscovery.knowledgeIndicatorsTab": "知识指标",
@@ -52962,22 +52954,6 @@
5296252954
"xpack.streams.streamsTreeTable.retentionColumnName": "保留",
5296352955
"xpack.streams.streamsTreeTable.searchAriaLabel": "按名称搜索流",
5296452956
"xpack.streams.streamsTreeTable.tableCaptionAriaLabel": "Streams 数据表,列出带链接的数据流名称、文档数量以及带链接的保留策略。",
52965-
"xpack.streams.suggestedRulesFlyout.cancelButton": "取消",
52966-
"xpack.streams.suggestedRulesFlyout.createRulesButton": "创建规则",
52967-
"xpack.streams.suggestedRulesFlyout.createRulesError": "无法创建规则",
52968-
"xpack.streams.suggestedRulesFlyout.createRulesSuccess": "{count, plural, one {# rule} other {# rules}} 创建成功。",
52969-
"xpack.streams.suggestedRulesFlyout.deleteAction": "删除",
52970-
"xpack.streams.suggestedRulesFlyout.deleteActionDescription": "移除此建议规则",
52971-
"xpack.streams.suggestedRulesFlyout.deleteQueryError": "无法删除查询",
52972-
"xpack.streams.suggestedRulesFlyout.description": "我们根据对该数据流至关重要的查询来生成规则。您可以复查并丢弃结果",
52973-
"xpack.streams.suggestedRulesFlyout.expandAriaLabel": "展开行详情",
52974-
"xpack.streams.suggestedRulesFlyout.minimizeAriaLabel": "折叠行详情",
52975-
"xpack.streams.suggestedRulesFlyout.noItems": "未找到建议规则。",
52976-
"xpack.streams.suggestedRulesFlyout.rulesColumn": "规则",
52977-
"xpack.streams.suggestedRulesFlyout.severityColumn": "严重性",
52978-
"xpack.streams.suggestedRulesFlyout.showing": "显示 {count, plural, one {# 条规则} other {# 条规则}}",
52979-
"xpack.streams.suggestedRulesFlyout.tableCaption": "建议规则",
52980-
"xpack.streams.suggestedRulesFlyout.title": "推荐的规则",
5298152957
"xpack.streams.suggestPipelineImage": "建议管道",
5298252958
"xpack.streams.tableTitle.showing": "正在显示 {count} 个(共 {total} 个){label}",
5298352959
"xpack.streams.technicalPreviewLabel": "技术预览",

0 commit comments

Comments
 (0)