Skip to content

[Observability AI Assistant] Add alert status management to AI Assistant connector#203729

Merged
arturoliduena merged 18 commits intoelastic:mainfrom
arturoliduena:185032-o11y-AI-Assistant-action-trigger-on-alert-status-change
Feb 10, 2025
Merged

[Observability AI Assistant] Add alert status management to AI Assistant connector#203729
arturoliduena merged 18 commits intoelastic:mainfrom
arturoliduena:185032-o11y-AI-Assistant-action-trigger-on-alert-status-change

Conversation

@arturoliduena
Copy link
Copy Markdown
Contributor

@arturoliduena arturoliduena commented Dec 11, 2024

Close #185032

Summary

An Observability AI Assistant connector is available to be set as action for Observability rules. When an alert is triggered, a conversation with the AI assistant will be created sending the initial prompt set by the user in the rule action. The conversation is then stored and can be retrieved from the AI Assistant interface. the action is triggered on any status change of the alert (active, recovered, untracked), creating a new conversation for each of them using the same initial prompt which may not be suitable for the 3 cases.

Improvement
The user is able to choose in when the action should be run (active, recovered, untracked, all),. That would allow the user to specify more than one AI Assistant action, with a different and more suitable prompt in each case.

Screen.Recording.2025-01-21.at.11.59.13.mov

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines

@arturoliduena arturoliduena added release_note:feature Makes this part of the condensed release notes backport:prev-minor Team:Obs AI Assistant Observability AI Assistant labels Dec 11, 2024
@arturoliduena arturoliduena requested a review from a team as a code owner December 11, 2024 09:24
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/obs-ai-assistant (Team:Obs AI Assistant)

@botelastic botelastic bot added the ci:project-deploy-observability Create an Observability project label Dec 11, 2024
@github-actions
Copy link
Copy Markdown
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

  • /oblt-deploy : Deploy a Kibana instance using the Observability test environments.
  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@arturoliduena arturoliduena changed the title Add alert status management to AI Assistant connector [Observability AI Assistant] Add alert status management to AI Assistant connector Dec 12, 2024
@arturoliduena arturoliduena force-pushed the 185032-o11y-AI-Assistant-action-trigger-on-alert-status-change branch from ddcd274 to bfdd28e Compare December 12, 2024 11:55
@arturoliduena arturoliduena requested a review from a team as a code owner December 12, 2024 11:55
@arturoliduena arturoliduena force-pushed the 185032-o11y-AI-Assistant-action-trigger-on-alert-status-change branch from bfdd28e to 0bae13a Compare January 20, 2025 08:46
@sorenlouv
Copy link
Copy Markdown
Contributor

Can you add screenshots to show the ui changes?

@arturoliduena
Copy link
Copy Markdown
Contributor Author

@sorenlouv

The remove button removes the last prompt. I decided not to include a delete button for each prompt. You can add up to 3 prompts (number of statuses), and there must always be at least one prompt.

Screen.Recording.2025-01-21.at.11.59.13.mov

@neptunian
Copy link
Copy Markdown
Contributor

Hey Arturo, I seem to be stuck in the validation
Screenshot 2025-01-24 at 2 27 22 PM

@arturoliduena
Copy link
Copy Markdown
Contributor Author

Hey Arturo, I seem to be stuck in the validation

@neptunian fixed it, turns out it was a backward compatibility issue.

@neptunian
Copy link
Copy Markdown
Contributor

neptunian commented Jan 27, 2025

One thing I notice in your video that does not happen on main or other connectors, is it now takes some time to load the user's connector and before it does it's considered an error so the "Connector" input flashes red. Any way to avoid this?

Screenshot 2025-01-27 at 10 51 47 AM.
Do you know of any reason why the rule's message template does not exist for our connector? I think all the other connector's use that rule's message template. We could address this in a followup. It would also avoid the issue of it always being red with an error before the user has even entered anything

Screenshot 2025-01-27 at 10 56 26 AM

@arturoliduena arturoliduena added backport:version Backport to applied version labels v8.19.0 and removed backport:prev-minor labels Feb 2, 2025
recovered: [...(params.alerts?.recovered || [])],
};

if (ALERT_STATUSES.some((status) => prompt.statuses.includes(status))) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need to iterate through ALERT_STATUSES? Won't prompt.statuses always be AlertStatus[] (whatever that type is called)? Could this simply be a check on whether it's empty?

Suggested change
if (ALERT_STATUSES.some((status) => prompt.statuses.includes(status))) {
if (prompt.statuses.length > 0) {


if (ALERT_STATUSES.some((status) => prompt.statuses.includes(status))) {
alerts.new = alerts.new.filter((alert) =>
prompt.statuses.includes(get(alert, 'kibana.alert.status'))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a huge fan of mutating like this. It often leads to bugs down the road.

@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Feb 9, 2025

💚 Build Succeeded

  • Buildkite Build
  • Commit: a53991d
  • Kibana Serverless Image: docker.elastic.co/kibana-ci/kibana-serverless:pr-203729-a53991d844ec

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
observabilityAIAssistantApp 513 526 +13

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
observabilityAIAssistantApp 298.8KB 300.8KB +2.0KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
observabilityAIAssistantApp 14.9KB 15.3KB +447.0B

History

@arturoliduena arturoliduena merged commit 4da647c into elastic:main Feb 10, 2025
3 checks passed
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.x, 9.0

https://github.com/elastic/kibana/actions/runs/13240901596

@kibanamachine
Copy link
Copy Markdown
Contributor

💔 All backports failed

Status Branch Result
8.x Backport failed because of merge conflicts

You might need to backport the following PRs to 8.x:
- [Observability AI Assistant] rule connector - handle multiple prompt (#209221)
9.0 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 203729

Questions ?

Please refer to the Backport tool documentation

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Feb 11, 2025
@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 203729 locally

5 similar comments
@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 203729 locally

@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 203729 locally

@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 203729 locally

@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 203729 locally

@kibanamachine
Copy link
Copy Markdown
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add a backport:* label or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 203729 locally

@sorenlouv sorenlouv added the backport:skip This PR does not require backporting label Feb 18, 2025
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting backport:version Backport to applied version labels ci:project-deploy-observability Create an Observability project release_note:feature Makes this part of the condensed release notes Team:Obs AI Assistant Observability AI Assistant v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Observability AI Assistant] Action Frequency for the Rule Connector

6 participants