-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Integration Assistant plugin (#184296)
## Summary This is a PR to add a new backend plugin (frontend will be done in separate [PR](#184546)). The purpose of the plugin is to provide a set of API routes that is used to perform a variety of GenAI workflows to generate new integrations based on provided inputs. It reuses the existing GenAI connectors for its LLM communication, and provides a set of API's to create ECS mapping, Categorization, Related Fields and an API to generate the actual integration package zip, which is forwarded to the UI component. ### Planned follow-up changes: As the PR is getting way too large, some planned changes would be added in much smaller follow-ups. This includes mostly more improved try/catch for certain routes, adding debug/error log entries where relevant, especially for the API endpoints themself, some more unit and end2end tests. - OpenAPI spec for the API will be handled in a separate PR - All the missing unit tests will be added as a followup PR ### Testing The `integration_assistant` plugin will be disabled by default while it's being implemented so we can iterate and merge partial PRs without interfering with the releases. This config will work as our feature flag: https://github.com/elastic/kibana/blob/6aefd4ff7be57d88936e71fbd6c22ed094d13676/x-pack/plugins/integration_assistant/server/config.ts#L11-L13 To test it add this to your _kibana.dev.yml_: ``` xpack.integration_assistant.enabled: true ``` ### Checklist Delete any items that are not applicable to this PR. - [x] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios ### Risk Matrix Delete this section if it is not applicable to this PR. Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release. When forming the risk matrix, consider some of the following examples and how they may potentially impact the change: | Risk | Probability | Severity | Mitigation/Notes | |---------------------------|-------------|----------|-------------------------| | Multiple Spaces—unexpected behavior in non-default Kibana Space. | Low | High | Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces. | | Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. | High | Low | Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure. | | Code should gracefully handle cases when feature X or plugin Y are disabled. | Medium | High | Unit tests will verify that any feature flag or plugin combination still results in our service operational. | | [See more potential risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) | ### For maintainers - [ ] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) --------- Co-authored-by: Patryk Kopycinski <[email protected]> Co-authored-by: Sergi Massaneda <[email protected]> Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Bharat Pasupula <[email protected]> Co-authored-by: Bharat Pasupula <[email protected]>
- Loading branch information
1 parent
5000201
commit 9ed2865
Showing
143 changed files
with
12,386 additions
and
165 deletions.
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
Validating CODEOWNERS rules …
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
26 changes: 26 additions & 0 deletions
26
x-pack/plugins/actions/server/integration_tests/__snapshots__/connector_types.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,66 @@ | ||
# Integration Assistant | ||
|
||
## Overview | ||
|
||
Team owner: Security Integrations Scalability | ||
|
||
This is a new Kibana plugin created to help users with automatically generating integration packages based on provided log samples and relevant information | ||
|
||
## Features | ||
|
||
Exposes 4 API's that can be consumed by any frontend plugin, which are: | ||
|
||
- ECS Mapping API | ||
- Categorization API | ||
- Related Fields API | ||
- Build Integration API | ||
- Optional Test Pipeline API (Used to update pipeline results if the ingest pipeline is changed by a user in the UI). | ||
|
||
## Development | ||
|
||
### Backend | ||
|
||
#### Overview | ||
|
||
The backend part of the plugin utilizes langraph extensively to parse the provided log samples and generate the integration package. | ||
|
||
One instance of langraph is created that will include one or more `nodes` in which each node represents a step in the integration package generation process. | ||
|
||
Each node links to a specific function, usually a `handler` specified in its own file under each graph folder that will be executed when the node is reached. | ||
|
||
#### Structure | ||
|
||
**Graphs** | ||
|
||
The graph components are split into logical parts and are placed in separate folders for each graph under the `./server/graphs` directory. | ||
|
||
Each graph folder needs to contains at least one `graph.ts`, which exports a function that returns the compiled graph object. | ||
|
||
Each exported graph function is then linked up to one or more API routes. | ||
|
||
**Routes** | ||
|
||
All routes are defined under `./server/routes` in its own file, and then included in the `./server/routes/register_routes.ts` file. | ||
|
||
**Integration Builder** | ||
|
||
The integration builder is the last step in the expected API flow (ECS Mapping -> Categorization -> Related Fields -> Integration Builder). | ||
With the provided package and data stream details, an optional logo and a list of sample logs, the API will build out the entire folder structure and files required for the integration package, archive it and return it as a `Buffer`. | ||
|
||
**Templates** | ||
|
||
Currently the templates are stored as `nunjucks` files as they were converted from `jinja2` templates, which use the exact same format. Longer term this will most likely be switched to the Kibana forked Handlebars templating engine. | ||
|
||
The templates are stored in the `./server/templates` directory and are used to generate the integration package files while running the Integration Builder API. | ||
|
||
One template (pipeline.yml.njk) is used by the ECS Mapping API to generate the boilerplate ingest pipeline structure we want to use for all generated integrations. | ||
|
||
## Tests | ||
|
||
All mocks/fixtures are placed in the top `./__jest__` directory of the plugin. If many mocks/fixtures are required, try to split them up into separate file(s). | ||
|
||
Tests can be run with: | ||
|
||
```bash | ||
node scripts/jest x-pack/plugins/integration_assistant/ --coverage | ||
``` |
Oops, something went wrong.