Skip to content
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

[Obs AI Assistant] ai assistant system connector #179980

Merged
merged 86 commits into from
Apr 15, 2024

Conversation

klacabane
Copy link
Contributor

@klacabane klacabane commented Apr 3, 2024

Summary

Creates a system connector that can call the observability ai assistant to execute actions on behalf of user. The connector is tagged as tech preview.

The connector can be triggered when an alert fires. Connector can be configured with an initial message to the assistant which generates an answer and triggers potential actions on the assistant side. The current experimental scenario is to ask the assistant to generate a report of the alert that fired (by initially providing some context in the first message), recalling any information/potential resolutions of previous occurrences stored in the knowledge base and also including other active alerts that may be related. One last step that can be asked to the assistant is to trigger an action, currently only sending the report (or any other message) to a preconfigured slack webhook is supported.

Testing

Note: when asked to send a message to another connector (in our case slack), we'll try to include a link to the generated conversation. It is only possible to generate this link if server.publicBaseUrl is correctly set in kibana settings.

  • Create a slack webhook connector
    • Get slack webhook. I can share one and invite you to the workspace, or if you want to create one:
  • Create a rule that can be triggered with available documents and attach observability AI assistant connector. (I use Error Count Threshold and generate errors via node scripts/synthtrace many_errors.ts --live)
    • configure the connector with one genai connector and a message with instructions. Example:
High error count alert has triggered. Execute the following steps:
  - create a graph of the error count for the service impacted by the alert for the last 24h
  - to help troubleshoot recall past occurrences of this alarm, also any other active alerts. Generate a report with all the found informations and send it to slack connector as a single message. Also include the link to this conversation in the report
  • Track alert status and verify connector was executed. You should get a slack notification sent by the assistant, and a new conversation will be stored

TODO

@apmmachine
Copy link
Contributor

🤖 GitHub comments

Expand to view the GitHub comments

Just comment with:

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

@klacabane
Copy link
Contributor Author

/ci

@klacabane
Copy link
Contributor Author

/ci

@klacabane
Copy link
Contributor Author

/ci

@klacabane
Copy link
Contributor Author

/ci

@klacabane
Copy link
Contributor Author

/ci

@cnasikas
Copy link
Member

@elastic/response-ops we exposed connectors schema (email connector example) as part of this PR to teach assistant how to call them. This increases the bundle size, are we fine bumping the limit ?

++ to what @dgieselaar said 🙂.

@klacabane klacabane requested a review from a team as a code owner April 15, 2024 09:15
@botelastic botelastic bot added the Team:obs-ux-management Observability Management User Experience Team label Apr 15, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-management-team (Team:obs-ux-management)

Copy link
Contributor

@benakansara benakansara left a comment

Choose a reason for hiding this comment

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

Obs-ux-management changes LGTM

Copy link
Member

@dgieselaar dgieselaar left a comment

Choose a reason for hiding this comment

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

LGTM! There are some open comments but those can be addressed in a follow-up. Thanks for doing this, really exciting feature!

const extractAlertData = (hit: AlertHit) => {
return {
id: hit._id,
reason: get(hit, 'kibana.alert.reason') || null,
Copy link
Member

Choose a reason for hiding this comment

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

any reason why we would not send over the full alert data here? Maybe good to talk to @sorenlouv about this as well - we can also do it in a followup.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to limit the noise and amount of token sent but that's probably too early for that. Updated in cfe8800

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
observabilityAIAssistant 89 94 +5

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
stackConnectors 4 10 +6

Async chunks

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

id before after diff
observabilityAIAssistant 16.9KB 18.6KB +1.7KB

Page load bundle

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

id before after diff
observabilityAIAssistant 46.0KB 47.0KB +1.1KB
Unknown metric groups

API count

id before after diff
stackConnectors 4 10 +6

async chunk count

id before after diff
observabilityAIAssistant 2 3 +1

ESLint disabled line counts

id before after diff
observabilityAIAssistant 5 7 +2

Total ESLint disabled count

id before after diff
observabilityAIAssistant 8 10 +2

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @klacabane

@klacabane klacabane merged commit 66587d8 into elastic:main Apr 15, 2024
35 checks passed
@kibanamachine kibanamachine added v8.14.0 backport:skip This commit does not require backporting labels Apr 15, 2024
klacabane added a commit that referenced this pull request Apr 22, 2024
…app (#180949)

## Summary

Resolves #180910

This change simply moves the rule_connector introduced in
#179980 to the
`observability_ai_assistant_app` plugin. There are not functional
changes.
Also added some unit tests

### Testing
See testing section in #179980

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
dgieselaar pushed a commit to dgieselaar/kibana that referenced this pull request Apr 24, 2024
…app (elastic#180949)

## Summary

Resolves elastic#180910

This change simply moves the rule_connector introduced in
elastic#179980 to the
`observability_ai_assistant_app` plugin. There are not functional
changes.
Also added some unit tests

### Testing
See testing section in elastic#179980

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit e8fe9db)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting release_note:feature Makes this part of the condensed release notes Team:Obs AI Assistant Observability AI Assistant Team:obs-knowledge Observability Experience Knowledge team Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team Team:obs-ux-management Observability Management User Experience Team v8.14.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.