[Streams][SigEvents] Add background task for significant events query generation#248608
Merged
cesco-f merged 27 commits intoelastic:mainfrom Jan 13, 2026
Merged
[Streams][SigEvents] Add background task for significant events query generation#248608cesco-f merged 27 commits intoelastic:mainfrom
cesco-f merged 27 commits intoelastic:mainfrom
Conversation
Contributor
Author
|
/ci |
Contributor
Author
|
/ci |
663ca3e to
93fb7d2
Compare
x-pack/platform/packages/shared/kbn-streams-schema/src/api/significant_events/index.ts
Show resolved
Hide resolved
...detail_significant_events_view/add_significant_event_flyout/add_significant_event_flyout.tsx
Outdated
Show resolved
Hide resolved
x-pack/platform/plugins/shared/streams/server/routes/streams/significant_events/route.ts
Outdated
Show resolved
Hide resolved
...ns/shared/streams/server/lib/tasks/task_definitions/significant_events_queries_generation.ts
Show resolved
Hide resolved
...ns/shared/streams/server/lib/tasks/task_definitions/significant_events_queries_generation.ts
Outdated
Show resolved
Hide resolved
Contributor
|
There's two things I'd like to see in this PR:
Do you think it will be a lot of effort to change the code to this? |
Contributor
Author
In progress task: Screen.Recording.2026-01-12.at.16.24.31.movTask completed: Screen.Recording.2026-01-12.at.16.24.59.mov |
Contributor
|
@cesco-f Okay so:
|
Contributor
Author
Aren't we getting rid of this view? Does it make sense to invest more time to improve the UX? |
Contributor
|
@cesco-f You're right, ignore me, perfectionism is a hard habit to beat! |
miltonhultgren
approved these changes
Jan 13, 2026
x-pack/platform/plugins/shared/streams/server/routes/streams/significant_events/route.ts
Outdated
Show resolved
Hide resolved
Contributor
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Public APIs missing comments
Async chunks
History
|
smith
pushed a commit
to smith/kibana
that referenced
this pull request
Jan 16, 2026
… generation (elastic#248608) It closes elastic/streams-program#708. ## Summary This PR introduces a background task-based approach for significant events query generation with dedicated `_status` and `_task` endpoints. ## Changes ### Backend **Task Definition** - Added `significant_events_queries_generation` task definition that handles LLM-based generation of significant event queries as a background task - Integrated with telemetry for tracking generation events **API Endpoints** - `GET /api/streams/{name}/significant_events/_status` - Check the status of the generation task (handles stale detection, returns task results) - `POST /api/streams/{name}/significant_events/_task` - Manage task lifecycle with a discriminated union body: - `action: 'schedule'` - Schedule a new generation task with `from`, `to`, `connectorId`, `sampleDocsSize`, and `systems` parameters - `action: 'cancel'` - Cancel an in-progress task - `action: 'acknowledge'` - Acknowledge a completed task ### Frontend - Added `useSignificantEventsApi` hook methods for task management (`getGenerationTask`, `scheduleGenerationTask`, `cancelGenerationTask`, `acknowledgeGenerationTask`) - Updated `AddSignificantEventFlyout` to work with the task-based generation flow https://github.com/user-attachments/assets/64f82260-7108-4fcc-95e7-3330c644600a --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
It closes https://github.com/elastic/streams-program/issues/708.
Summary
This PR introduces a background task-based approach for significant events query generation with dedicated
_statusand_taskendpoints.Changes
Backend
Task Definition
significant_events_queries_generationtask definition that handles LLM-based generation of significant event queries as a background taskAPI Endpoints
GET /api/streams/{name}/significant_events/_status- Check the status of the generation task (handles stale detection, returns task results)POST /api/streams/{name}/significant_events/_task- Manage task lifecycle with a discriminated union body:action: 'schedule'- Schedule a new generation task withfrom,to,connectorId,sampleDocsSize, andsystemsparametersaction: 'cancel'- Cancel an in-progress taskaction: 'acknowledge'- Acknowledge a completed taskFrontend
useSignificantEventsApihook methods for task management (getGenerationTask,scheduleGenerationTask,cancelGenerationTask,acknowledgeGenerationTask)AddSignificantEventFlyoutto work with the task-based generation flowScreen.Recording.2026-01-09.at.16.53.35.mov