From 7dd352a65ef8d23dccd36ab6a85fa4eff90e7a45 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Fri, 29 Sep 2023 11:09:02 -0500 Subject: [PATCH 1/7] Revert "[Security solution] Rename Generative AI connector to OpenAI (#167519)" This reverts commit a81b620a41b1118eef5fa6995f07b2e861b20467. --- .github/CODEOWNERS | 6 +- api_docs/actions.devdocs.json | 16 ++--- .../connector-apis-passthru.asciidoc | 14 ++--- docs/management/action-types.asciidoc | 2 +- .../{openai.asciidoc => gen-ai.asciidoc} | 24 +++---- docs/management/connectors/index.asciidoc | 2 +- .../pre-configured-connectors.asciidoc | 8 +-- docs/redirects.asciidoc | 5 -- docs/settings/alert-action-settings.asciidoc | 8 +-- .../README.md | 4 +- .../public/components/list_connector.tsx | 2 +- .../public/components/setup_connector.tsx | 6 +- .../gen_ai_streaming_response_example.tsx | 2 +- .../public/plugin.tsx | 7 ++- .../server/plugin.ts | 2 +- .../impl/assistant/assistant_header/index.tsx | 2 +- .../conversation_selector/index.tsx | 2 +- .../conversation_selector_settings/index.tsx | 2 +- .../impl/assistant/index.tsx | 2 +- .../assistant/settings/assistant_settings.tsx | 2 +- .../settings/assistant_settings_button.tsx | 2 +- .../impl/assistant_context/types.tsx | 2 +- .../connectorland/connector_button/index.tsx | 4 +- .../impl/connectorland/helpers.tsx | 4 +- .../use_load_action_types/index.tsx | 7 +-- .../content/prompts/welcome/translations.ts | 2 +- .../impl/mock/conversation.ts | 2 +- .../common/connector_feature_config.test.ts | 10 +-- .../common/connector_feature_config.ts | 18 +++--- x-pack/plugins/actions/common/types.ts | 2 +- .../plugins/actions/docs/openapi/bundled.json | 10 +-- .../plugins/actions/docs/openapi/bundled.yaml | 12 ++-- .../schemas/config_properties_genai.yaml | 4 +- .../connector_response_properties_genai.yaml | 2 +- .../create_connector_request_genai.yaml | 6 +- .../schemas/secrets_properties_genai.yaml | 4 +- .../update_connector_request_genai.yaml | 4 +- .../server/lib/action_executor.test.ts | 2 +- .../actions/server/lib/action_executor.ts | 6 +- .../observability_ai_assistant/README.md | 2 +- .../components/chat/initial_setup_panel.tsx | 6 +- .../common/{openai => gen_ai}/constants.ts | 4 +- .../common/{openai => gen_ai}/schema.ts | 0 .../common/{openai => gen_ai}/types.ts | 0 .../stack_connectors/public/common/index.ts | 6 +- .../connector_types/d3security/d3security.tsx | 2 +- .../{openai => gen_ai}/api.test.ts | 2 +- .../connector_types/{openai => gen_ai}/api.ts | 2 +- .../{openai => gen_ai}/connector.test.tsx | 62 +++++++++++++++---- .../{openai => gen_ai}/connector.tsx | 9 ++- .../{openai => gen_ai}/constants.tsx | 10 +-- .../gen_ai.test.tsx} | 6 +- .../{openai/openai.tsx => gen_ai/gen_ai.tsx} | 16 ++--- .../{openai => gen_ai}/index.ts | 2 +- .../{openai => gen_ai}/logo.tsx | 0 .../{openai => gen_ai}/params.test.tsx | 14 ++--- .../{openai => gen_ai}/params.tsx | 14 +++-- .../{openai => gen_ai}/translations.ts | 4 +- .../{openai => gen_ai}/types.ts | 21 ++++--- .../use_get_dashboard.test.ts | 2 +- .../{openai => gen_ai}/use_get_dashboard.ts | 0 .../public/connector_types/index.ts | 4 +- .../server/connector_types/bedrock/index.ts | 4 +- .../create_dashboard.test.ts | 0 .../{openai => gen_ai}/create_dashboard.ts | 0 .../{openai => gen_ai}/dashboard.ts | 12 ++-- .../openai.test.ts => gen_ai/gen_ai.test.ts} | 22 +++---- .../{openai/openai.ts => gen_ai/gen_ai.ts} | 12 ++-- .../{openai => gen_ai}/index.test.ts | 16 ++--- .../{openai => gen_ai}/index.ts | 24 +++---- .../lib/azure_openai_utils.test.ts | 2 +- .../lib/azure_openai_utils.ts | 2 +- .../lib/openai_utils.test.ts | 2 +- .../{openai => gen_ai}/lib/openai_utils.ts | 2 +- .../{openai => gen_ai}/lib/utils.test.ts | 2 +- .../{openai => gen_ai}/lib/utils.ts | 2 +- .../{openai => gen_ai}/render.test.ts | 2 +- .../{openai => gen_ai}/render.ts | 2 +- .../server/connector_types/index.ts | 4 +- .../translations/translations/fr-FR.json | 3 +- .../translations/translations/ja-JP.json | 3 +- .../translations/translations/zh-CN.json | 3 +- ...nai_simulation.ts => gen_ai_simulation.ts} | 6 +- .../connector_types/{openai.ts => gen_ai.ts} | 18 +++--- .../group2/tests/actions/index.ts | 2 +- .../generative_ai_connector.ts | 4 +- .../stack_connectors/xmatters_connector.ts | 2 +- 87 files changed, 303 insertions(+), 257 deletions(-) rename docs/management/connectors/action-types/{openai.asciidoc => gen-ai.asciidoc} (65%) rename x-pack/plugins/stack_connectors/common/{openai => gen_ai}/constants.ts (93%) rename x-pack/plugins/stack_connectors/common/{openai => gen_ai}/schema.ts (100%) rename x-pack/plugins/stack_connectors/common/{openai => gen_ai}/types.ts (100%) rename x-pack/plugins/stack_connectors/public/connector_types/{openai => gen_ai}/api.test.ts (95%) rename x-pack/plugins/stack_connectors/public/connector_types/{openai => gen_ai}/api.ts (94%) rename x-pack/plugins/stack_connectors/public/connector_types/{openai => gen_ai}/connector.test.tsx (81%) rename x-pack/plugins/stack_connectors/public/connector_types/{openai => gen_ai}/connector.tsx (93%) rename x-pack/plugins/stack_connectors/public/connector_types/{openai => gen_ai}/constants.tsx (96%) rename x-pack/plugins/stack_connectors/public/connector_types/{openai/openai.test.tsx => gen_ai/gen_ai.test.tsx} (94%) rename x-pack/plugins/stack_connectors/public/connector_types/{openai/openai.tsx => gen_ai/gen_ai.tsx} (80%) rename x-pack/plugins/stack_connectors/public/connector_types/{openai => gen_ai}/index.ts (76%) rename x-pack/plugins/stack_connectors/public/connector_types/{openai => gen_ai}/logo.tsx (100%) rename x-pack/plugins/stack_connectors/public/connector_types/{openai => gen_ai}/params.test.tsx (94%) rename x-pack/plugins/stack_connectors/public/connector_types/{openai => gen_ai}/params.tsx (86%) rename x-pack/plugins/stack_connectors/public/connector_types/{openai => gen_ai}/translations.ts (94%) rename x-pack/plugins/stack_connectors/public/connector_types/{openai => gen_ai}/types.ts (59%) rename x-pack/plugins/stack_connectors/public/connector_types/{openai => gen_ai}/use_get_dashboard.test.ts (98%) rename x-pack/plugins/stack_connectors/public/connector_types/{openai => gen_ai}/use_get_dashboard.ts (100%) rename x-pack/plugins/stack_connectors/server/connector_types/{openai => gen_ai}/create_dashboard.test.ts (100%) rename x-pack/plugins/stack_connectors/server/connector_types/{openai => gen_ai}/create_dashboard.ts (100%) rename x-pack/plugins/stack_connectors/server/connector_types/{openai => gen_ai}/dashboard.ts (97%) rename x-pack/plugins/stack_connectors/server/connector_types/{openai/openai.test.ts => gen_ai/gen_ai.test.ts} (97%) rename x-pack/plugins/stack_connectors/server/connector_types/{openai/openai.ts => gen_ai/gen_ai.ts} (96%) rename x-pack/plugins/stack_connectors/server/connector_types/{openai => gen_ai}/index.test.ts (85%) rename x-pack/plugins/stack_connectors/server/connector_types/{openai => gen_ai}/index.ts (76%) rename x-pack/plugins/stack_connectors/server/connector_types/{openai => gen_ai}/lib/azure_openai_utils.test.ts (99%) rename x-pack/plugins/stack_connectors/server/connector_types/{openai => gen_ai}/lib/azure_openai_utils.ts (97%) rename x-pack/plugins/stack_connectors/server/connector_types/{openai => gen_ai}/lib/openai_utils.test.ts (99%) rename x-pack/plugins/stack_connectors/server/connector_types/{openai => gen_ai}/lib/openai_utils.ts (97%) rename x-pack/plugins/stack_connectors/server/connector_types/{openai => gen_ai}/lib/utils.test.ts (99%) rename x-pack/plugins/stack_connectors/server/connector_types/{openai => gen_ai}/lib/utils.ts (97%) rename x-pack/plugins/stack_connectors/server/connector_types/{openai => gen_ai}/render.test.ts (96%) rename x-pack/plugins/stack_connectors/server/connector_types/{openai => gen_ai}/render.ts (93%) rename x-pack/test/alerting_api_integration/common/plugins/actions_simulators/server/{openai_simulation.ts => gen_ai_simulation.ts} (91%) rename x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/{openai.ts => gen_ai.ts} (96%) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c0ba6f69d592a..9de177e16947e 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1212,9 +1212,9 @@ x-pack/plugins/cloud_integrations/cloud_full_story/server/config.ts @elastic/kib /x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users @elastic/security-threat-hunting-explore ## Explore owner connectors -/x-pack/plugins/stack_connectors/public/connector_types/openai @elastic/security-threat-hunting-explore -/x-pack/plugins/stack_connectors/server/connector_types/openai @elastic/security-threat-hunting-explore -/x-pack/plugins/stack_connectors/common/openai @elastic/security-threat-hunting-explore +/x-pack/plugins/stack_connectors/public/connector_types/gen_ai @elastic/security-threat-hunting-explore +/x-pack/plugins/stack_connectors/server/connector_types/gen_ai @elastic/security-threat-hunting-explore +/x-pack/plugins/stack_connectors/common/gen_ai @elastic/security-threat-hunting-explore ## Defend Workflows owner connectors /x-pack/plugins/stack_connectors/public/connector_types/sentinelone @elastic/security-defend-workflows diff --git a/api_docs/actions.devdocs.json b/api_docs/actions.devdocs.json index 247840029729f..4e648524c704d 100644 --- a/api_docs/actions.devdocs.json +++ b/api_docs/actions.devdocs.json @@ -5273,10 +5273,10 @@ }, { "parentPluginId": "actions", - "id": "def-common.GenerativeAIConnectorFeatureId", + "id": "def-common.GeneralConnectorFeatureId", "type": "string", "tags": [], - "label": "GenerativeAIConnectorFeatureId", + "label": "GeneralConnectorFeatureId", "description": [], "signature": [ "\"general\"" @@ -5613,10 +5613,10 @@ }, { "parentPluginId": "actions", - "id": "def-common.GenerativeAIFeature", + "id": "def-common.GeneralFeature", "type": "Object", "tags": [], - "label": "GenerativeAIFeature", + "label": "GeneralFeature", "description": [], "path": "x-pack/plugins/actions/common/connector_feature_config.ts", "deprecated": false, @@ -5624,7 +5624,7 @@ "children": [ { "parentPluginId": "actions", - "id": "def-common.GenerativeAIFeature.id", + "id": "def-common.GeneralFeature.id", "type": "string", "tags": [], "label": "id", @@ -5635,7 +5635,7 @@ }, { "parentPluginId": "actions", - "id": "def-common.GenerativeAIFeature.name", + "id": "def-common.GeneralFeature.name", "type": "string", "tags": [], "label": "name", @@ -5646,7 +5646,7 @@ }, { "parentPluginId": "actions", - "id": "def-common.GenerativeAIFeature.compatibility", + "id": "def-common.GeneralFeature.compatibility", "type": "string", "tags": [], "label": "compatibility", @@ -5769,4 +5769,4 @@ } ] } -} +} \ No newline at end of file diff --git a/docs/api-generated/connectors/connector-apis-passthru.asciidoc b/docs/api-generated/connectors/connector-apis-passthru.asciidoc index d3495cecf9edf..fb1a9b87dbcda 100644 --- a/docs/api-generated/connectors/connector-apis-passthru.asciidoc +++ b/docs/api-generated/connectors/connector-apis-passthru.asciidoc @@ -1004,7 +1004,7 @@ Any modifications made to this file will be overwritten.
  • config_properties_cases_webhook - Connector request properties for Webhook - Case Management connector
  • config_properties_d3security - Connector request properties for a D3 Security connector
  • config_properties_email - Connector request properties for an email connector
  • -
  • config_properties_genai - Connector request properties for an OpenAI connector
  • +
  • config_properties_genai - Connector request properties for a generative AI connector
  • config_properties_genai_oneOf -
  • config_properties_genai_oneOf_1 -
  • config_properties_index - Connector request properties for an index connector
  • @@ -1044,7 +1044,7 @@ Any modifications made to this file will be overwritten.
  • create_connector_request_cases_webhook - Create Webhook - Case Managment connector request
  • create_connector_request_d3security - Create D3 Security connector request
  • create_connector_request_email - Create email connector request
  • -
  • create_connector_request_genai - Create OpenAI connector request
  • +
  • create_connector_request_genai - Create generative AI connector request
  • create_connector_request_index - Create index connector request
  • create_connector_request_jira - Create Jira connector request
  • create_connector_request_opsgenie - Create Opsgenie connector request
  • @@ -1100,7 +1100,7 @@ Any modifications made to this file will be overwritten.
  • secrets_properties_cases_webhook - Connector secrets properties for Webhook - Case Management connector
  • secrets_properties_d3security - Connector secrets properties for a D3 Security connector
  • secrets_properties_email - Connector secrets properties for an email connector
  • -
  • secrets_properties_genai - Connector secrets properties for an OpenAI connector
  • +
  • secrets_properties_genai - Connector secrets properties for a generative AI connector
  • secrets_properties_jira - Connector secrets properties for a Jira connector
  • secrets_properties_opsgenie - Connector secrets properties for an Opsgenie connector
  • secrets_properties_pagerduty - Connector secrets properties for a PagerDuty connector
  • @@ -1432,7 +1432,7 @@ Any modifications made to this file will be overwritten.
    -

    config_properties_genai - Connector request properties for an OpenAI connector Up

    +

    config_properties_genai - Connector request properties for a generative AI connector Up

    Defines properties for connectors when type is .gen-ai.
    apiProvider
    String The OpenAI API provider.
    @@ -1958,8 +1958,8 @@ Any modifications made to this file will be overwritten.
    -

    create_connector_request_genai - Create OpenAI connector request Up

    -
    The OpenAI connector uses axios to send a POST request to either OpenAI or Azure OpenAPI.
    +

    create_connector_request_genai - Create generative AI connector request Up

    +
    The generative AI connector uses axios to send a POST request to either OpenAI or Azure OpenAPI.
    config
    connector_type_id
    String The type of connector.
    @@ -2535,7 +2535,7 @@ Any modifications made to this file will be overwritten.
    -

    secrets_properties_genai - Connector secrets properties for an OpenAI connector Up

    +

    secrets_properties_genai - Connector secrets properties for a generative AI connector Up

    Defines secrets for connectors when type is .gen-ai.
    apiKey (optional)
    String The OpenAI API key.
    diff --git a/docs/management/action-types.asciidoc b/docs/management/action-types.asciidoc index 357d0e5de50ea..67dd4e3fd0019 100644 --- a/docs/management/action-types.asciidoc +++ b/docs/management/action-types.asciidoc @@ -35,7 +35,7 @@ a| <> | Send a message to a Microsoft Teams channel. -a| <> +a| <> | Send a request to OpenAI. diff --git a/docs/management/connectors/action-types/openai.asciidoc b/docs/management/connectors/action-types/gen-ai.asciidoc similarity index 65% rename from docs/management/connectors/action-types/openai.asciidoc rename to docs/management/connectors/action-types/gen-ai.asciidoc index 49033b92cd740..6388a483e7fc3 100644 --- a/docs/management/connectors/action-types/openai.asciidoc +++ b/docs/management/connectors/action-types/gen-ai.asciidoc @@ -1,7 +1,7 @@ -[[openai-action-type]] -== OpenAI connector and action +[[gen-ai-action-type]] +== Generative AI connector and action ++++ -OpenAI +Generative AI ++++ :frontmatter-description: Add a connector that can send requests to an OpenAI provider. :frontmatter-tags-products: [kibana] @@ -9,7 +9,7 @@ :frontmatter-tags-user-goals: [configure] -The OpenAI connector uses https://github.com/axios/axios[axios] to send a POST request to an OpenAI provider, either OpenAI or Azure OpenAI. The connector uses the <> to send the request. +The Generative AI connector uses https://github.com/axios/axios[axios] to send a POST request to an OpenAI provider, either OpenAI or Azure OpenAI. The connector uses the <> to send the request. [float] [[define-gen-ai-ui]] @@ -18,14 +18,14 @@ The OpenAI connector uses https://github.com/axios/axios[axios] to send a POST r You can create connectors in *{stack-manage-app} > {connectors-ui}*. For example: [role="screenshot"] -image::management/connectors/images/gen-ai-connector.png[OpenAI connector] +image::management/connectors/images/gen-ai-connector.png[Generative AI connector] // NOTE: This is an autogenerated screenshot. Do not edit it directly. [float] -[[openai-connector-configuration]] +[[gen-ai-connector-configuration]] ==== Connector configuration -OpenAI connectors have the following configuration properties: +Generative AI connectors have the following configuration properties: Name:: The name of the connector. OpenAI provider:: The OpenAI API provider, either OpenAI or Azure OpenAI. @@ -41,10 +41,10 @@ You can test connectors with the <> or as you're creating or editing the connector in {kib}. For example: [role="screenshot"] -image::management/connectors/images/gen-ai-params-test.png[OpenAI params test] +image::management/connectors/images/gen-ai-params-test.png[Generative AI params test] // NOTE: This is an autogenerated screenshot. Do not edit it directly. -The OpenAI actions have the following configuration properties. +The Generative AI actions have the following configuration properties. Body:: A JSON payload sent to the OpenAI API URL. For example: + @@ -61,15 +61,15 @@ Body:: A JSON payload sent to the OpenAI API URL. For example: } -- [float] -[[openai-connector-networking-configuration]] +[[gen-ai-connector-networking-configuration]] === Connector networking configuration Use the <> to customize connector networking configurations, such as proxies, certificates, or TLS settings. You can set configurations that apply to all your connectors or use `xpack.actions.customHostSettings` to set per-host configurations. [float] -[[openai-connector-token-dashboard]] +[[gen-ai-connector-token-dashboard]] === Token usage dashboard -Once you've created a OpenAI connector, you can monitor its token usage using the *OpenAI Token Usage* dashboard. Select the connector in *{stack-manage-app}* > *{connectors-ui}* to view its details, then click the *View OpenAI Usage Dashboard for "__" Connector* link to open the dashboard. +Once you've created a Generative AI connector, you can monitor its token usage using the *Generative AI Token Usage* dashboard. Select the connector in *{stack-manage-app}* > *{connectors-ui}* to view its details, then click the *View OpenAI Usage Dashboard for "__" Connector* link to open the dashboard. NOTE: To view the dashboard, you need at least `read` and `view_index_metadata` privileges for the `.kibana-event-log-*` index and the `Read` feature privilege for {kib}. You can set up a role with these minimum privileges and assign it to non-admin users who need to view this dashboard. diff --git a/docs/management/connectors/index.asciidoc b/docs/management/connectors/index.asciidoc index 14cfd57fd3c80..e7ef07ba4f737 100644 --- a/docs/management/connectors/index.asciidoc +++ b/docs/management/connectors/index.asciidoc @@ -1,11 +1,11 @@ include::action-types/bedrock.asciidoc[leveloffset=+1] include::action-types/d3security.asciidoc[leveloffset=+1] include::action-types/email.asciidoc[leveloffset=+1] +include::action-types/gen-ai.asciidoc[leveloffset=+1] include::action-types/resilient.asciidoc[leveloffset=+1] include::action-types/index.asciidoc[leveloffset=+1] include::action-types/jira.asciidoc[leveloffset=+1] include::action-types/teams.asciidoc[leveloffset=+1] -include::action-types/openai.asciidoc[leveloffset=+1] include::action-types/opsgenie.asciidoc[leveloffset=+1] include::action-types/pagerduty.asciidoc[leveloffset=+1] include::action-types/server-log.asciidoc[leveloffset=+1] diff --git a/docs/management/connectors/pre-configured-connectors.asciidoc b/docs/management/connectors/pre-configured-connectors.asciidoc index 79b4e331fa19a..8f40554d5bbf3 100644 --- a/docs/management/connectors/pre-configured-connectors.asciidoc +++ b/docs/management/connectors/pre-configured-connectors.asciidoc @@ -282,15 +282,15 @@ secrets: [float] [[preconfigured-gen-ai-configuration]] -==== OpenAI connectors +==== Generative AI connectors -The following example creates a <>: +The following example creates a <>: [source,text] -- xpack.actions.preconfigured: - my-open-ai: - name: preconfigured-openai-connector-type + my-gen-ai: + name: preconfigured-gen-ai-connector-type actionTypeId: .gen-ai config: apiUrl: https://api.openai.com/v1/chat/completions <1> diff --git a/docs/redirects.asciidoc b/docs/redirects.asciidoc index eac4ff0c800d8..f4ac0f11739b0 100644 --- a/docs/redirects.asciidoc +++ b/docs/redirects.asciidoc @@ -422,8 +422,3 @@ This page has been deleted. Refer to <>. == Enhancements and bug fixes for 8.10.0 This content has moved. Refer to <> for 8.10.0. - -[role="exclude",id="gen-ai-action-type"] -== Generative AI connector and action - -This connector was renamed. Refer to <>. \ No newline at end of file diff --git a/docs/settings/alert-action-settings.asciidoc b/docs/settings/alert-action-settings.asciidoc index 76b1ebadc98d1..fff867cc65a2a 100644 --- a/docs/settings/alert-action-settings.asciidoc +++ b/docs/settings/alert-action-settings.asciidoc @@ -261,13 +261,13 @@ For example: `.email`, `.index`, `.opsgenie`, `.server-log`, `.resilient`, `.sla The configuration details, which are specific to the type of preconfigured connector. `xpack.actions.preconfigured..config.apiProvider`:: -For a <>, specifies the OpenAI API provider, either `OpenAI` or `Azure OpenAI`. +For a <>, specifies the OpenAI API provider, either `OpenAI` or `Azure OpenAI`. `xpack.actions.preconfigured..config.apiUrl`:: A configuration URL that varies by connector: + -- -* For a <>, specifies the OpenAI request URL. +* For a <>, specifies the OpenAI request URL. * For a <>, specifies the {ibm-r} instance URL. * For a <>, specifies the Jira instance URL. * For an <>, specifies the {opsgenie} URL. For example, `https://api.opsgenie.com` or `https://api.eu.opsgenie.com`. @@ -321,7 +321,7 @@ NOTE: If you are using the `xpack.actions.allowedHosts` setting, make sure the h For a <>, specifies a string from the response body of the create case method that corresponds to the external service identifier. `xpack.actions.preconfigured..config.defaultModel`:: -For a <>, specifies the default model to use for requests. It is optional and applicable only when `xpack.actions.preconfigured..config.apiProvider` is `OpenAI`. +For a <>, specifies the default model to use for requests. It is optional and applicable only when `xpack.actions.preconfigured..config.apiProvider` is `OpenAI`. `xpack.actions.preconfigured..config.executionTimeField`:: For an <>, a field that indicates when the document was indexed. @@ -448,7 +448,7 @@ TIP: Sensitive properties, such as passwords, should be stored in the <>, specifies the OpenAI or Azure OpenAI API key for authentication. +* For a <>, specifies the OpenAI or Azure OpenAI API key for authentication. * For an <>, specifies the {opsgenie} API authentication key for HTTP basic authentication. -- diff --git a/x-pack/examples/gen_ai_streaming_response_example/README.md b/x-pack/examples/gen_ai_streaming_response_example/README.md index 7bac7351af235..30d9b35009304 100644 --- a/x-pack/examples/gen_ai_streaming_response_example/README.md +++ b/x-pack/examples/gen_ai_streaming_response_example/README.md @@ -1,5 +1,5 @@ -## OpenAI Connector Streaming Response Example +## Generative AI Connector Streaming Response Example -This example plugin shows you how to stream a response from a OpenAI connector. +This example plugin shows you how to stream a response from a Generative AI connector. To run this example, use the command `yarn start --run-examples`. \ No newline at end of file diff --git a/x-pack/examples/gen_ai_streaming_response_example/public/components/list_connector.tsx b/x-pack/examples/gen_ai_streaming_response_example/public/components/list_connector.tsx index 06e33429892c1..119a2ddb90d51 100644 --- a/x-pack/examples/gen_ai_streaming_response_example/public/components/list_connector.tsx +++ b/x-pack/examples/gen_ai_streaming_response_example/public/components/list_connector.tsx @@ -52,7 +52,7 @@ export const ListConnectors = ({ label={i18n.translate( 'genAiStreamingResponseExample.app.component.selectConnectorLabel', { - defaultMessage: 'Select an OpenAI Connector', + defaultMessage: 'Select a Generative AI Connector', } )} labelAppend={ diff --git a/x-pack/examples/gen_ai_streaming_response_example/public/components/setup_connector.tsx b/x-pack/examples/gen_ai_streaming_response_example/public/components/setup_connector.tsx index 2aafcf1a79031..518a0d9ceb3c3 100644 --- a/x-pack/examples/gen_ai_streaming_response_example/public/components/setup_connector.tsx +++ b/x-pack/examples/gen_ai_streaming_response_example/public/components/setup_connector.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { OpenAILogo } from '@kbn/stack-connectors-plugin/public/common'; +import { GenAiLogo } from '@kbn/stack-connectors-plugin/public/common'; import { EuiFlexGroup, EuiCard, EuiFlexItem, EuiIcon } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; @@ -20,11 +20,11 @@ export const SetupConnector = ({ setIsConnectorModalVisible }: SetupConnectorPro } + icon={} title={i18n.translate( 'genAiStreamingResponseExample.app.component.addConnectorCardTitle', { - defaultMessage: 'Add OpenAI Connector', + defaultMessage: 'Add Generative AI Connector', } )} description={i18n.translate( diff --git a/x-pack/examples/gen_ai_streaming_response_example/public/gen_ai_streaming_response_example.tsx b/x-pack/examples/gen_ai_streaming_response_example/public/gen_ai_streaming_response_example.tsx index 2f300c49a992d..8e671338c1bdb 100644 --- a/x-pack/examples/gen_ai_streaming_response_example/public/gen_ai_streaming_response_example.tsx +++ b/x-pack/examples/gen_ai_streaming_response_example/public/gen_ai_streaming_response_example.tsx @@ -65,7 +65,7 @@ export const GenAiStreamingResponseExampleApp = ({ minimumLicenseRequired: 'platinum', supportedFeatureIds: ['general'], id: '.gen-ai', - name: 'OpenAI', + name: 'Generative AI', enabled: true, }); const [loading, setLoading] = useState(true); diff --git a/x-pack/examples/gen_ai_streaming_response_example/public/plugin.tsx b/x-pack/examples/gen_ai_streaming_response_example/public/plugin.tsx index 23cd797a61d06..ccf4fe8aa06b0 100644 --- a/x-pack/examples/gen_ai_streaming_response_example/public/plugin.tsx +++ b/x-pack/examples/gen_ai_streaming_response_example/public/plugin.tsx @@ -37,7 +37,7 @@ export class GenAiStreamingResponseExamplePlugin ) { core.application.register({ id: 'GenAiStreamingResponseExample', - title: 'OpenAI Streaming Response Example', + title: 'Generative AI Streaming Response Example', navLinkStatus: AppNavLinkStatus.hidden, async mount(params: AppMountParameters) { const [coreStart, depsStart] = await core.getStartServices(); @@ -48,8 +48,9 @@ export class GenAiStreamingResponseExamplePlugin developerExamples.register({ appId: 'GenAiStreamingResponseExample', - title: 'OpenAI Streaming Response Example', - description: 'This example demonstrates how to stream a response from an OpenAI connector', + title: 'Generative AI Streaming Response Example', + description: + 'This example demonstrates how to stream a response from a Generative AI connector', }); } diff --git a/x-pack/examples/gen_ai_streaming_response_example/server/plugin.ts b/x-pack/examples/gen_ai_streaming_response_example/server/plugin.ts index 05f9612bcf73d..3d4dc4bcf33ab 100644 --- a/x-pack/examples/gen_ai_streaming_response_example/server/plugin.ts +++ b/x-pack/examples/gen_ai_streaming_response_example/server/plugin.ts @@ -87,7 +87,7 @@ export class GenAiStreamingResponseExamplePlugin implements Plugin { }; } else { throw Boom.badRequest( - `Invalid OpenAI connector selected - ${connector.config?.apiProvider} is not a valid provider` + `Invalid generative AI connector selected - ${connector.config?.apiProvider} is not a valid provider` ); } diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant/assistant_header/index.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant/assistant_header/index.tsx index e4c4454859d34..65c3c267e9a8e 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant/assistant_header/index.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant/assistant_header/index.tsx @@ -17,7 +17,7 @@ import { } from '@elastic/eui'; import { css } from '@emotion/react'; import { DocLinksStart } from '@kbn/core-doc-links-browser'; -import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants'; +import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants'; import { Conversation } from '../../..'; import { AssistantTitle } from '../assistant_title'; import { ConversationSelector } from '../conversations/conversation_selector'; diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant/conversations/conversation_selector/index.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant/conversations/conversation_selector/index.tsx index b68cff6713e91..4891df533fdf1 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant/conversations/conversation_selector/index.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant/conversations/conversation_selector/index.tsx @@ -19,7 +19,7 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react'; import useEvent from 'react-use/lib/useEvent'; import { css } from '@emotion/react'; -import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants'; +import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants'; import { Conversation } from '../../../..'; import { useAssistantContext } from '../../../assistant_context'; import * as i18n from './translations'; diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant/conversations/conversation_selector_settings/index.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant/conversations/conversation_selector_settings/index.tsx index 3f26c97f5ad0b..a4618c736eb60 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant/conversations/conversation_selector_settings/index.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant/conversations/conversation_selector_settings/index.tsx @@ -18,7 +18,7 @@ import { import React, { useCallback, useMemo, useState } from 'react'; import { css } from '@emotion/react'; -import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants'; +import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants'; import { Conversation, Prompt } from '../../../..'; import { UseAssistantContext } from '../../../assistant_context'; import * as i18n from './translations'; diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant/index.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant/index.tsx index cdfd8187e7a2f..d119526a198c5 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant/index.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant/index.tsx @@ -29,7 +29,7 @@ import { import { createPortal } from 'react-dom'; import { css } from '@emotion/react'; -import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants'; +import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants'; import { ActionConnectorProps } from '@kbn/triggers-actions-ui-plugin/public/types'; import { ChatSend } from './chat_send'; import { BlockBotCallToAction } from './block_bot/cta'; diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/assistant_settings.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/assistant_settings.tsx index caf8fa77a9b61..1fec8e79af75a 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/assistant_settings.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/assistant_settings.tsx @@ -23,7 +23,7 @@ import { // eslint-disable-next-line @kbn/eslint/module_migration import styled from 'styled-components'; import { css } from '@emotion/react'; -import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants'; +import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants'; import { Conversation, Prompt, QuickPrompt } from '../../..'; import * as i18n from './translations'; import { useAssistantContext } from '../../assistant_context'; diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/assistant_settings_button.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/assistant_settings_button.tsx index f559ae8aa76dd..773c68bbccf0e 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/assistant_settings_button.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/assistant_settings_button.tsx @@ -8,7 +8,7 @@ import React, { useCallback } from 'react'; import { EuiButtonIcon, EuiToolTip } from '@elastic/eui'; -import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants'; +import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants'; import { Conversation } from '../../..'; import { AssistantSettings, CONVERSATIONS_TAB } from './assistant_settings'; import * as i18n from './translations'; diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/types.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/types.tsx index bf0a20e2b6ea5..573581091eebf 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/types.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/types.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants'; +import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants'; export type ConversationRole = 'system' | 'user' | 'assistant'; diff --git a/x-pack/packages/kbn-elastic-assistant/impl/connectorland/connector_button/index.tsx b/x-pack/packages/kbn-elastic-assistant/impl/connectorland/connector_button/index.tsx index 8cfeb2ce0efdc..8db849f64fdf6 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/connectorland/connector_button/index.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/connectorland/connector_button/index.tsx @@ -8,7 +8,7 @@ import React, { useCallback } from 'react'; import { EuiCard, EuiFlexGroup, EuiFlexItem, EuiIcon } from '@elastic/eui'; -import { OpenAILogo } from '@kbn/stack-connectors-plugin/public/common'; +import { GenAiLogo } from '@kbn/stack-connectors-plugin/public/common'; import * as i18n from '../translations'; import { useAssistantContext } from '../../assistant_context'; @@ -41,7 +41,7 @@ export const ConnectorButton: React.FC = React.memo} + icon={} title={title} description={description} onClick={assistantAvailability.hasConnectorsAllPrivilege ? onClick : undefined} diff --git a/x-pack/packages/kbn-elastic-assistant/impl/connectorland/helpers.tsx b/x-pack/packages/kbn-elastic-assistant/impl/connectorland/helpers.tsx index 9147a6ca83dba..b5db94fe041d3 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/connectorland/helpers.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/connectorland/helpers.tsx @@ -7,7 +7,7 @@ import type { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public'; import { ActionConnectorProps } from '@kbn/triggers-actions-ui-plugin/public/types'; -import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants'; +import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants'; import { ActionTypeModel } from '@kbn/triggers-actions-ui-plugin/public'; interface GenAiConfig { @@ -20,7 +20,7 @@ interface GenAiConfig { * Returns the GenAiConfig for a given ActionConnector. Note that if the connector is preconfigured, * the config will be undefined as the connector is neither available nor editable. * - * TODO: Extract and use separate types from GenAiConfig from '@kbn/stack-connectors-plugin/common/openai/types' + * TODO: Extract and use separate types from GenAiConfig from '@kbn/stack-connectors-plugin/common/gen_ai/types' * * @param connector */ diff --git a/x-pack/packages/kbn-elastic-assistant/impl/connectorland/use_load_action_types/index.tsx b/x-pack/packages/kbn-elastic-assistant/impl/connectorland/use_load_action_types/index.tsx index b923471e8c368..796ece694664a 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/connectorland/use_load_action_types/index.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/connectorland/use_load_action_types/index.tsx @@ -15,7 +15,7 @@ import type { IHttpFetchError } from '@kbn/core-http-browser'; import type { ActionType } from '@kbn/actions-plugin/common'; import { HttpSetup } from '@kbn/core-http-browser'; import { IToasts } from '@kbn/core-notifications-browser'; -import { GenerativeAIConnectorFeatureId } from '@kbn/actions-plugin/common'; +import { GeneralConnectorFeatureId } from '@kbn/actions-plugin/common'; import * as i18n from '../translations'; /** @@ -37,10 +37,7 @@ export const useLoadActionTypes = ({ QUERY_KEY, async () => { - const queryResult = await loadActionTypes({ - http, - featureId: GenerativeAIConnectorFeatureId, - }); + const queryResult = await loadActionTypes({ http, featureId: GeneralConnectorFeatureId }); const sortedData = queryResult.sort((a, b) => a.name.localeCompare(b.name)); return sortedData; diff --git a/x-pack/packages/kbn-elastic-assistant/impl/content/prompts/welcome/translations.ts b/x-pack/packages/kbn-elastic-assistant/impl/content/prompts/welcome/translations.ts index 936d27fb1005a..85c355cf4456c 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/content/prompts/welcome/translations.ts +++ b/x-pack/packages/kbn-elastic-assistant/impl/content/prompts/welcome/translations.ts @@ -19,7 +19,7 @@ export const WELCOME_GENERAL_2 = i18n.translate( 'xpack.elasticAssistant.securityAssistant.content.prompts.welcome.welcomeGeneral2Prompt', { defaultMessage: - "First things first, we'll need to set up a Generative AI Connector to get this chat experience going! With the Generative AI Connector, you'll be able to configure access to either an OpenAI service or an AWS Bedrock service, but you better believe you'll be able to deploy your own models within your Elastic Cloud instance and use those here in the future... 😉", + "First things first, we'll need to set up a Generative AI Connector to get this chat experience going! With the Generative AI Connector, you'll be able to configure access to either an Azure OpenAI Service or OpenAI API account, but you better believe you'll be able to deploy your own models within your Elastic Cloud instance and use those here in the future... 😉", } ); diff --git a/x-pack/packages/kbn-elastic-assistant/impl/mock/conversation.ts b/x-pack/packages/kbn-elastic-assistant/impl/mock/conversation.ts index 8e8a099766812..9444350e1a0e1 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/mock/conversation.ts +++ b/x-pack/packages/kbn-elastic-assistant/impl/mock/conversation.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants'; +import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants'; import { Conversation } from '../..'; export const alertConvo: Conversation = { diff --git a/x-pack/plugins/actions/common/connector_feature_config.test.ts b/x-pack/plugins/actions/common/connector_feature_config.test.ts index c12e3db21127f..cb571dfa8714d 100644 --- a/x-pack/plugins/actions/common/connector_feature_config.test.ts +++ b/x-pack/plugins/actions/common/connector_feature_config.test.ts @@ -13,7 +13,7 @@ import { describe('areValidFeatures', () => { it('returns true when all inputs are valid features', () => { - expect(areValidFeatures(['alerting', 'cases', 'generativeAI'])).toBeTruthy(); + expect(areValidFeatures(['alerting', 'cases', 'general'])).toBeTruthy(); }); it('returns true when only one input and it is a valid feature', () => { @@ -42,9 +42,11 @@ describe('getConnectorFeatureName', () => { describe('getConnectorCompatibility', () => { it('returns the compatibility list for valid feature ids', () => { - expect( - getConnectorCompatibility(['alerting', 'cases', 'uptime', 'siem', 'generativeAI']) - ).toEqual(['Alerting Rules', 'Cases', 'Generative AI']); + expect(getConnectorCompatibility(['alerting', 'cases', 'uptime', 'siem', 'general'])).toEqual([ + 'Alerting Rules', + 'Cases', + 'General', + ]); }); it('skips invalid feature ids', () => { diff --git a/x-pack/plugins/actions/common/connector_feature_config.ts b/x-pack/plugins/actions/common/connector_feature_config.ts index 61a67087da9fa..27c035546882b 100644 --- a/x-pack/plugins/actions/common/connector_feature_config.ts +++ b/x-pack/plugins/actions/common/connector_feature_config.ts @@ -25,12 +25,12 @@ export const AlertingConnectorFeatureId = 'alerting'; export const CasesConnectorFeatureId = 'cases'; export const UptimeConnectorFeatureId = 'uptime'; export const SecurityConnectorFeatureId = 'siem'; -export const GenerativeAIConnectorFeatureId = 'generativeAI'; +export const GeneralConnectorFeatureId = 'general'; -const compatibilityGenerativeAI = i18n.translate( - 'xpack.actions.availableConnectorFeatures.compatibility.generativeAI', +const compatibilityGeneral = i18n.translate( + 'xpack.actions.availableConnectorFeatures.compatibility.general', { - defaultMessage: 'Generative AI', + defaultMessage: 'General', } ); @@ -80,10 +80,10 @@ export const SecuritySolutionFeature: ConnectorFeatureConfig = { compatibility: compatibilityAlertingRules, }; -export const GenerativeAIFeature: ConnectorFeatureConfig = { - id: GenerativeAIConnectorFeatureId, - name: compatibilityGenerativeAI, - compatibility: compatibilityGenerativeAI, +export const GeneralFeature: ConnectorFeatureConfig = { + id: GeneralConnectorFeatureId, + name: compatibilityGeneral, + compatibility: compatibilityGeneral, }; const AllAvailableConnectorFeatures = { @@ -91,7 +91,7 @@ const AllAvailableConnectorFeatures = { [CasesConnectorFeature.id]: CasesConnectorFeature, [UptimeConnectorFeature.id]: UptimeConnectorFeature, [SecuritySolutionFeature.id]: SecuritySolutionFeature, - [GenerativeAIFeature.id]: GenerativeAIFeature, + [GeneralFeature.id]: GeneralFeature, }; export function areValidFeatures(ids: string[]) { diff --git a/x-pack/plugins/actions/common/types.ts b/x-pack/plugins/actions/common/types.ts index 44d7516595d19..c3e1b35777fff 100644 --- a/x-pack/plugins/actions/common/types.ts +++ b/x-pack/plugins/actions/common/types.ts @@ -12,7 +12,7 @@ export { CasesConnectorFeatureId, UptimeConnectorFeatureId, SecurityConnectorFeatureId, - GenerativeAIConnectorFeatureId, + GeneralConnectorFeatureId, } from './connector_feature_config'; export interface ActionType { id: string; diff --git a/x-pack/plugins/actions/docs/openapi/bundled.json b/x-pack/plugins/actions/docs/openapi/bundled.json index 801dd78a76936..94efaf061fb4f 100644 --- a/x-pack/plugins/actions/docs/openapi/bundled.json +++ b/x-pack/plugins/actions/docs/openapi/bundled.json @@ -1768,7 +1768,7 @@ } }, "config_properties_genai": { - "title": "Connector request properties for an OpenAI connector", + "title": "Connector request properties for a generative AI connector", "description": "Defines properties for connectors when type is `.gen-ai`.", "oneOf": [ { @@ -1821,7 +1821,7 @@ } }, "secrets_properties_genai": { - "title": "Connector secrets properties for an OpenAI connector", + "title": "Connector secrets properties for a generative AI connector", "description": "Defines secrets for connectors when type is `.gen-ai`.", "type": "object", "properties": { @@ -1832,8 +1832,8 @@ } }, "create_connector_request_genai": { - "title": "Create OpenAI connector request", - "description": "The OpenAI connector uses axios to send a POST request to either OpenAI or Azure OpenAPI.\n", + "title": "Create generative AI connector request", + "description": "The generative AI connector uses axios to send a POST request to either OpenAI or Azure OpenAPI.\n", "type": "object", "required": [ "config", @@ -5722,4 +5722,4 @@ } } } -} +} \ No newline at end of file diff --git a/x-pack/plugins/actions/docs/openapi/bundled.yaml b/x-pack/plugins/actions/docs/openapi/bundled.yaml index 63156405da018..b1ff36d6f3370 100644 --- a/x-pack/plugins/actions/docs/openapi/bundled.yaml +++ b/x-pack/plugins/actions/docs/openapi/bundled.yaml @@ -1031,14 +1031,14 @@ components: type: boolean host: description: | - The host name of the service provider. If the `service` is `elastic_cloud` (for Elastic Cloud notifications) or one of Nodemailer's well-known email service providers, this property is ignored. If `service` is `other`, this property must be defined. + The host name of the service provider. If the `service` is `elastic_cloud` (for Elastic Cloud notifications) or one of Nodemailer's well-known email service providers, this property is ignored. If `service` is `other`, this property must be defined. type: string oauthTokenUrl: type: string nullable: true port: description: | - The port to connect to on the service provider. If the `service` is `elastic_cloud` (for Elastic Cloud notifications) or one of Nodemailer's well-known email service providers, this property is ignored. If `service` is `other`, this property must be defined. + The port to connect to on the service provider. If the `service` is `elastic_cloud` (for Elastic Cloud notifications) or one of Nodemailer's well-known email service providers, this property is ignored. If `service` is `other`, this property must be defined. type: integer secure: description: | @@ -1103,7 +1103,7 @@ components: secrets: $ref: '#/components/schemas/secrets_properties_email' config_properties_genai: - title: Connector request properties for an OpenAI connector + title: Connector request properties for a generative AI connector description: Defines properties for connectors when type is `.gen-ai`. oneOf: - type: object @@ -1138,7 +1138,7 @@ components: discriminator: propertyName: apiProvider secrets_properties_genai: - title: Connector secrets properties for an OpenAI connector + title: Connector secrets properties for a generative AI connector description: Defines secrets for connectors when type is `.gen-ai`. type: object properties: @@ -1146,9 +1146,9 @@ components: type: string description: The OpenAI API key. create_connector_request_genai: - title: Create OpenAI connector request + title: Create generative AI connector request description: | - The OpenAI connector uses axios to send a POST request to either OpenAI or Azure OpenAPI. + The generative AI connector uses axios to send a POST request to either OpenAI or Azure OpenAPI. type: object required: - config diff --git a/x-pack/plugins/actions/docs/openapi/components/schemas/config_properties_genai.yaml b/x-pack/plugins/actions/docs/openapi/components/schemas/config_properties_genai.yaml index 8797f1b330374..ca4388303fd2c 100644 --- a/x-pack/plugins/actions/docs/openapi/components/schemas/config_properties_genai.yaml +++ b/x-pack/plugins/actions/docs/openapi/components/schemas/config_properties_genai.yaml @@ -1,4 +1,4 @@ -title: Connector request properties for an OpenAI connector +title: Connector request properties for a generative AI connector description: Defines properties for connectors when type is `.gen-ai`. oneOf: - type: object @@ -29,4 +29,4 @@ oneOf: type: string description: The default model to use for requests. discriminator: - propertyName: apiProvider + propertyName: apiProvider \ No newline at end of file diff --git a/x-pack/plugins/actions/docs/openapi/components/schemas/connector_response_properties_genai.yaml b/x-pack/plugins/actions/docs/openapi/components/schemas/connector_response_properties_genai.yaml index 928147ed87a69..17e748216639d 100644 --- a/x-pack/plugins/actions/docs/openapi/components/schemas/connector_response_properties_genai.yaml +++ b/x-pack/plugins/actions/docs/openapi/components/schemas/connector_response_properties_genai.yaml @@ -1,4 +1,4 @@ -title: Connector response properties for an OpenAI connector +title: Connector response properties for a generative AI connector type: object required: - config diff --git a/x-pack/plugins/actions/docs/openapi/components/schemas/create_connector_request_genai.yaml b/x-pack/plugins/actions/docs/openapi/components/schemas/create_connector_request_genai.yaml index 95d65bdb80919..9aa605c136bb9 100644 --- a/x-pack/plugins/actions/docs/openapi/components/schemas/create_connector_request_genai.yaml +++ b/x-pack/plugins/actions/docs/openapi/components/schemas/create_connector_request_genai.yaml @@ -1,6 +1,6 @@ -title: Create OpenAI connector request +title: Create generative AI connector request description: > - The OpenAI connector uses axios to send a POST request to either + The generative AI connector uses axios to send a POST request to either OpenAI or Azure OpenAPI. type: object required: @@ -22,4 +22,4 @@ properties: description: The display name for the connector. example: my-connector secrets: - $ref: 'secrets_properties_genai.yaml' + $ref: 'secrets_properties_genai.yaml' \ No newline at end of file diff --git a/x-pack/plugins/actions/docs/openapi/components/schemas/secrets_properties_genai.yaml b/x-pack/plugins/actions/docs/openapi/components/schemas/secrets_properties_genai.yaml index 586c50ddbbd37..fae3f0ea131cc 100644 --- a/x-pack/plugins/actions/docs/openapi/components/schemas/secrets_properties_genai.yaml +++ b/x-pack/plugins/actions/docs/openapi/components/schemas/secrets_properties_genai.yaml @@ -1,7 +1,7 @@ -title: Connector secrets properties for an OpenAI connector +title: Connector secrets properties for a generative AI connector description: Defines secrets for connectors when type is `.gen-ai`. type: object properties: apiKey: type: string - description: The OpenAI API key. + description: The OpenAI API key. \ No newline at end of file diff --git a/x-pack/plugins/actions/docs/openapi/components/schemas/update_connector_request_genai.yaml b/x-pack/plugins/actions/docs/openapi/components/schemas/update_connector_request_genai.yaml index 709dea64280dc..a7fbf5cb7bcfa 100644 --- a/x-pack/plugins/actions/docs/openapi/components/schemas/update_connector_request_genai.yaml +++ b/x-pack/plugins/actions/docs/openapi/components/schemas/update_connector_request_genai.yaml @@ -1,4 +1,4 @@ -title: Update OpenAI connector request +title: Update generative AI connector request type: object required: - config @@ -10,4 +10,4 @@ properties: type: string description: The display name for the connector. secrets: - $ref: 'secrets_properties_genai.yaml' + $ref: 'secrets_properties_genai.yaml' \ No newline at end of file diff --git a/x-pack/plugins/actions/server/lib/action_executor.test.ts b/x-pack/plugins/actions/server/lib/action_executor.test.ts index a966605bd3a4f..f0a11b9f90042 100644 --- a/x-pack/plugins/actions/server/lib/action_executor.test.ts +++ b/x-pack/plugins/actions/server/lib/action_executor.test.ts @@ -1766,7 +1766,7 @@ test('writes to event log for execute and execute start when consumer and relate }); }); -test('writes usage data to event log for OpenAI events', async () => { +test('writes usage data to event log for gen ai events', async () => { const executorMock = setupActionExecutorMock('.gen-ai'); const mockGenAi = { id: 'chatcmpl-7LztF5xsJl2z5jcNpJKvaPm4uWt8x', diff --git a/x-pack/plugins/actions/server/lib/action_executor.ts b/x-pack/plugins/actions/server/lib/action_executor.ts index d3d57de4cda4e..d5257f4eb8450 100644 --- a/x-pack/plugins/actions/server/lib/action_executor.ts +++ b/x-pack/plugins/actions/server/lib/action_executor.ts @@ -286,8 +286,8 @@ export class ActionExecutor { event.event = event.event || {}; - // start openai extension - // add event.kibana.action.execution.openai to event log when OpenAI Connector is executed + // start gen_ai extension + // add event.kibana.action.execution.gen_ai to event log when GenerativeAi Connector is executed if (result.status === 'ok' && actionTypeId === '.gen-ai') { const data = result.data as unknown as { usage: { prompt_tokens?: number; completion_tokens?: number; total_tokens?: number }; @@ -311,7 +311,7 @@ export class ActionExecutor { }, }; } - // end openai extension + // end gen_ai extension const currentUser = security?.authc.getCurrentUser(request); diff --git a/x-pack/plugins/observability_ai_assistant/README.md b/x-pack/plugins/observability_ai_assistant/README.md index 8d5e166883995..11e6d7d38d659 100644 --- a/x-pack/plugins/observability_ai_assistant/README.md +++ b/x-pack/plugins/observability_ai_assistant/README.md @@ -6,7 +6,7 @@ This document gives an overview of the features of the Observability AI Assistan #### **1.1. Configuration** -Users can connect to an LLM using [connectors](https://www.elastic.co/guide/en/kibana/current/action-types.html) - specifically the [OpenAI connector](https://www.elastic.co/guide/en/kibana/current/openai-action-type.html), which currently supports both OpenAI and Azure OpenAI as providers. The connector is Enterprise-only. Users can also leverage [preconfigured connectors](https://www.elastic.co/guide/en/kibana/current/pre-configured-connectors.html), in which case the following should be added to `kibana.yml`: +Users can connect to an LLM using [connectors](https://www.elastic.co/guide/en/kibana/current/action-types.html) - specifically the [Generative AI connector](https://www.elastic.co/guide/en/kibana/current/gen-ai-action-type.html), which currently supports both OpenAI and Azure OpenAI as providers. The connector is Enterprise-only. Users can also leverage [preconfigured connectors](https://www.elastic.co/guide/en/kibana/current/pre-configured-connectors.html), in which case the following should be added to `kibana.yml`: ```yaml xpack.actions.preconfigured: diff --git a/x-pack/plugins/observability_ai_assistant/public/components/chat/initial_setup_panel.tsx b/x-pack/plugins/observability_ai_assistant/public/components/chat/initial_setup_panel.tsx index b8c99bbfa7cd4..281cf46c972bb 100644 --- a/x-pack/plugins/observability_ai_assistant/public/components/chat/initial_setup_panel.tsx +++ b/x-pack/plugins/observability_ai_assistant/public/components/chat/initial_setup_panel.tsx @@ -143,7 +143,7 @@ export function InitialSetupPanel({ {i18n.translate( 'xpack.observabilityAiAssistant.initialSetupPanel.setupConnector.description1', { - defaultMessage: 'Set up an OpenAI connector with your AI provider.', + defaultMessage: 'Set up a Generative AI connector with your AI provider.', } )}

    @@ -153,7 +153,7 @@ export function InitialSetupPanel({ 'xpack.observabilityAiAssistant.initialSetupPanel.setupConnector.description2', { defaultMessage: - 'The OpenAI model needs to support function calls. We strongly recommend using GPT4.', + 'The Generative AI model needs to support function calls. We strongly recommend using GPT4.', } )} diff --git a/x-pack/plugins/stack_connectors/common/openai/constants.ts b/x-pack/plugins/stack_connectors/common/gen_ai/constants.ts similarity index 93% rename from x-pack/plugins/stack_connectors/common/openai/constants.ts rename to x-pack/plugins/stack_connectors/common/gen_ai/constants.ts index db01f52d762cf..8c8dd84c4e326 100644 --- a/x-pack/plugins/stack_connectors/common/openai/constants.ts +++ b/x-pack/plugins/stack_connectors/common/gen_ai/constants.ts @@ -7,13 +7,13 @@ import { i18n } from '@kbn/i18n'; -export const OPENAI_TITLE = i18n.translate( +export const OPEN_AI_TITLE = i18n.translate( 'xpack.stackConnectors.components.genAi.connectorTypeTitle', { defaultMessage: 'OpenAI', } ); -export const OPENAI_CONNECTOR_ID = '.gen-ai'; +export const GEN_AI_CONNECTOR_ID = '.gen-ai'; export enum SUB_ACTION { RUN = 'run', INVOKE_AI = 'invokeAI', diff --git a/x-pack/plugins/stack_connectors/common/openai/schema.ts b/x-pack/plugins/stack_connectors/common/gen_ai/schema.ts similarity index 100% rename from x-pack/plugins/stack_connectors/common/openai/schema.ts rename to x-pack/plugins/stack_connectors/common/gen_ai/schema.ts diff --git a/x-pack/plugins/stack_connectors/common/openai/types.ts b/x-pack/plugins/stack_connectors/common/gen_ai/types.ts similarity index 100% rename from x-pack/plugins/stack_connectors/common/openai/types.ts rename to x-pack/plugins/stack_connectors/common/gen_ai/types.ts diff --git a/x-pack/plugins/stack_connectors/public/common/index.ts b/x-pack/plugins/stack_connectors/public/common/index.ts index ec5dd5e69e242..ec0ce2960114b 100644 --- a/x-pack/plugins/stack_connectors/public/common/index.ts +++ b/x-pack/plugins/stack_connectors/public/common/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import OpenAILogo from '../connector_types/openai/logo'; +import GenAiLogo from '../connector_types/gen_ai/logo'; -export { OPENAI_CONNECTOR_ID, OpenAiProviderType } from '../../common/openai/constants'; -export { OpenAILogo }; +export { GEN_AI_CONNECTOR_ID, OpenAiProviderType } from '../../common/gen_ai/constants'; +export { GenAiLogo }; diff --git a/x-pack/plugins/stack_connectors/public/connector_types/d3security/d3security.tsx b/x-pack/plugins/stack_connectors/public/connector_types/d3security/d3security.tsx index f3223eb8314f3..41df7d3aed16d 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/d3security/d3security.tsx +++ b/x-pack/plugins/stack_connectors/public/connector_types/d3security/d3security.tsx @@ -8,7 +8,7 @@ import { lazy } from 'react'; import { i18n } from '@kbn/i18n'; import { GenericValidationResult } from '@kbn/triggers-actions-ui-plugin/public/types'; -import { SUB_ACTION } from '../../../common/d3security/constants'; +import { SUB_ACTION } from '../../../common/gen_ai/constants'; import { D3SecurityActionParams, D3SecurityConnector } from './types'; import { D3_SECURITY_CONNECTOR_ID } from '../../../common/d3security/constants'; interface ValidationErrors { diff --git a/x-pack/plugins/stack_connectors/public/connector_types/openai/api.test.ts b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/api.test.ts similarity index 95% rename from x-pack/plugins/stack_connectors/public/connector_types/openai/api.test.ts rename to x-pack/plugins/stack_connectors/public/connector_types/gen_ai/api.test.ts index 5ab342a22828b..cf1197c487cd9 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/openai/api.test.ts +++ b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/api.test.ts @@ -7,7 +7,7 @@ import { httpServiceMock } from '@kbn/core-http-browser-mocks'; import { getDashboard } from './api'; -import { SUB_ACTION } from '../../../common/openai/constants'; +import { SUB_ACTION } from '../../../common/gen_ai/constants'; const response = { available: true, }; diff --git a/x-pack/plugins/stack_connectors/public/connector_types/openai/api.ts b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/api.ts similarity index 94% rename from x-pack/plugins/stack_connectors/public/connector_types/openai/api.ts rename to x-pack/plugins/stack_connectors/public/connector_types/gen_ai/api.ts index 97b0608bb725d..da35d608239b1 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/openai/api.ts +++ b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/api.ts @@ -7,7 +7,7 @@ import { HttpSetup } from '@kbn/core-http-browser'; import { ActionTypeExecutorResult, BASE_ACTION_API_PATH } from '@kbn/actions-plugin/common'; -import { SUB_ACTION } from '../../../common/openai/constants'; +import { SUB_ACTION } from '../../../common/gen_ai/constants'; import { ConnectorExecutorResult, rewriteResponseToCamelCase } from '../lib/rewrite_response_body'; export async function getDashboard({ diff --git a/x-pack/plugins/stack_connectors/public/connector_types/openai/connector.test.tsx b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/connector.test.tsx similarity index 81% rename from x-pack/plugins/stack_connectors/public/connector_types/openai/connector.test.tsx rename to x-pack/plugins/stack_connectors/public/connector_types/gen_ai/connector.test.tsx index e88c3fa116153..5e561615f0bcf 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/openai/connector.test.tsx +++ b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/connector.test.tsx @@ -6,11 +6,11 @@ */ import React from 'react'; -import ConnectorFields from './connector'; +import GenerativeAiConnectorFields from './connector'; import { ConnectorFormTestProvider } from '../lib/test_utils'; import { act, fireEvent, render, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { DEFAULT_OPENAI_MODEL, OpenAiProviderType } from '../../../common/openai/constants'; +import { DEFAULT_OPENAI_MODEL, OpenAiProviderType } from '../../../common/gen_ai/constants'; import { useKibana } from '@kbn/triggers-actions-ui-plugin/public'; import { useGetDashboard } from './use_get_dashboard'; @@ -21,7 +21,7 @@ const useKibanaMock = useKibana as jest.Mocked; const mockDashboard = useGetDashboard as jest.Mock; const openAiConnector = { actionTypeId: '.gen-ai', - name: 'OpenAI', + name: 'genAi', id: '123', config: { apiUrl: 'https://openaiurl.com', @@ -46,7 +46,7 @@ const azureConnector = { const navigateToUrl = jest.fn(); -describe('ConnectorFields renders', () => { +describe('GenerativeAiConnectorFields renders', () => { beforeEach(() => { jest.clearAllMocks(); useKibanaMock().services.application.navigateToUrl = navigateToUrl; @@ -57,7 +57,11 @@ describe('ConnectorFields renders', () => { test('open ai connector fields are rendered', async () => { const { getAllByTestId } = render( - {}} /> + {}} + /> ); expect(getAllByTestId('config.apiUrl-input')[0]).toBeInTheDocument(); @@ -73,7 +77,11 @@ describe('ConnectorFields renders', () => { test('azure ai connector fields are rendered', async () => { const { getAllByTestId } = render( - {}} /> + {}} + /> ); expect(getAllByTestId('config.apiUrl-input')[0]).toBeInTheDocument(); @@ -90,7 +98,11 @@ describe('ConnectorFields renders', () => { it('Does not render if isEdit is false and dashboardUrl is defined', async () => { const { queryByTestId } = render( - {}} /> + {}} + /> ); expect(queryByTestId('link-gen-ai-token-dashboard')).not.toBeInTheDocument(); @@ -101,7 +113,11 @@ describe('ConnectorFields renders', () => { })); const { queryByTestId } = render( - {}} /> + {}} + /> ); expect(queryByTestId('link-gen-ai-token-dashboard')).not.toBeInTheDocument(); @@ -109,7 +125,11 @@ describe('ConnectorFields renders', () => { it('Renders if isEdit is true and dashboardUrl is defined', async () => { const { getByTestId } = render( - {}} /> + {}} + /> ); expect(getByTestId('link-gen-ai-token-dashboard')).toBeInTheDocument(); @@ -117,7 +137,11 @@ describe('ConnectorFields renders', () => { it('On click triggers redirect with correct saved object id', async () => { const { getByTestId } = render( - {}} /> + {}} + /> ); fireEvent.click(getByTestId('link-gen-ai-token-dashboard')); @@ -134,7 +158,11 @@ describe('ConnectorFields renders', () => { it('connector validation succeeds when connector config is valid', async () => { const { getByTestId } = render( - {}} /> + {}} + /> ); @@ -163,7 +191,11 @@ describe('ConnectorFields renders', () => { const res = render( - {}} /> + {}} + /> ); @@ -192,7 +224,11 @@ describe('ConnectorFields renders', () => { const res = render( - {}} /> + {}} + /> ); diff --git a/x-pack/plugins/stack_connectors/public/connector_types/openai/connector.tsx b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/connector.tsx similarity index 93% rename from x-pack/plugins/stack_connectors/public/connector_types/openai/connector.tsx rename to x-pack/plugins/stack_connectors/public/connector_types/gen_ai/connector.tsx index 516ff9c3e9264..99b8bb701e60e 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/openai/connector.tsx +++ b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/connector.tsx @@ -19,8 +19,8 @@ import { } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib'; import { useKibana } from '@kbn/triggers-actions-ui-plugin/public'; import { fieldValidators } from '@kbn/es-ui-shared-plugin/static/forms/helpers'; -import { OpenAiProviderType } from '../../../common/openai/constants'; import { useGetDashboard } from './use_get_dashboard'; +import { OpenAiProviderType } from '../../../common/gen_ai/constants'; import * as i18n from './translations'; import { azureAiConfig, @@ -31,7 +31,10 @@ import { } from './constants'; const { emptyField } = fieldValidators; -const ConnectorFields: React.FC = ({ readOnly, isEdit }) => { +const GenerativeAiConnectorFields: React.FC = ({ + readOnly, + isEdit, +}) => { const { getFieldDefaultValue } = useFormContext(); const [{ config, id, name }] = useFormData({ watch: ['config.apiProvider'], @@ -114,4 +117,4 @@ const ConnectorFields: React.FC = ({ readOnly, isEdi }; // eslint-disable-next-line import/no-default-export -export { ConnectorFields as default }; +export { GenerativeAiConnectorFields as default }; diff --git a/x-pack/plugins/stack_connectors/public/connector_types/openai/constants.tsx b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/constants.tsx similarity index 96% rename from x-pack/plugins/stack_connectors/public/connector_types/openai/constants.tsx rename to x-pack/plugins/stack_connectors/public/connector_types/gen_ai/constants.tsx index 4df722ecfae04..ab7f18e2be00f 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/openai/constants.tsx +++ b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/constants.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { ConfigFieldSchema, SecretsFieldSchema } from '@kbn/triggers-actions-ui-plugin/public'; import { FormattedMessage } from '@kbn/i18n-react'; import { EuiLink } from '@elastic/eui'; -import { DEFAULT_OPENAI_MODEL, OpenAiProviderType } from '../../../common/openai/constants'; +import { DEFAULT_OPENAI_MODEL, OpenAiProviderType } from '../../../common/gen_ai/constants'; import * as i18n from './translations'; export const DEFAULT_URL = 'https://api.openai.com/v1/chat/completions' as const; @@ -46,7 +46,7 @@ export const openAiConfig: ConfigFieldSchema[] = [ href="https://platform.openai.com/docs/api-reference" target="_blank" > - {`${i18n.OPENAI} ${i18n.DOCUMENTATION}`} + {`${i18n.OPEN_AI} ${i18n.DOCUMENTATION}`} ), }} @@ -108,7 +108,7 @@ export const openAiSecrets: SecretsFieldSchema[] = [ href="https://platform.openai.com/account/api-keys" target="_blank" > - {`${i18n.OPENAI} ${i18n.DOCUMENTATION}`} + {`${i18n.OPEN_AI} ${i18n.DOCUMENTATION}`} ), }} @@ -145,8 +145,8 @@ export const azureAiSecrets: SecretsFieldSchema[] = [ export const providerOptions = [ { value: OpenAiProviderType.OpenAi, - text: i18n.OPENAI, - label: i18n.OPENAI, + text: i18n.OPEN_AI, + label: i18n.OPEN_AI, }, { value: OpenAiProviderType.AzureAi, diff --git a/x-pack/plugins/stack_connectors/public/connector_types/openai/openai.test.tsx b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/gen_ai.test.tsx similarity index 94% rename from x-pack/plugins/stack_connectors/public/connector_types/openai/openai.test.tsx rename to x-pack/plugins/stack_connectors/public/connector_types/gen_ai/gen_ai.test.tsx index 49a4d87524f7a..3bed686dca025 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/openai/openai.test.tsx +++ b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/gen_ai.test.tsx @@ -9,7 +9,7 @@ import { TypeRegistry } from '@kbn/triggers-actions-ui-plugin/public/application import { registerConnectorTypes } from '..'; import type { ActionTypeModel } from '@kbn/triggers-actions-ui-plugin/public/types'; import { registrationServicesMock } from '../../mocks'; -import { SUB_ACTION } from '../../../common/openai/constants'; +import { SUB_ACTION } from '../../../common/gen_ai/constants'; const ACTION_TYPE_ID = '.gen-ai'; let actionTypeModel: ActionTypeModel; @@ -26,12 +26,12 @@ beforeAll(() => { describe('actionTypeRegistry.get() works', () => { test('connector type static data is as expected', () => { expect(actionTypeModel.id).toEqual(ACTION_TYPE_ID); - expect(actionTypeModel.selectMessage).toBe('Send a request to OpenAI systems.'); + expect(actionTypeModel.selectMessage).toBe('Send a request to generative AI systems.'); expect(actionTypeModel.actionTypeTitle).toBe('OpenAI'); }); }); -describe('OpenAI action params validation', () => { +describe('gen ai action params validation', () => { test('action params validation succeeds when action params is valid', async () => { const actionParams = { subAction: SUB_ACTION.RUN, diff --git a/x-pack/plugins/stack_connectors/public/connector_types/openai/openai.tsx b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/gen_ai.tsx similarity index 80% rename from x-pack/plugins/stack_connectors/public/connector_types/openai/openai.tsx rename to x-pack/plugins/stack_connectors/public/connector_types/gen_ai/gen_ai.tsx index 83340c90be804..7a4c798763c46 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/openai/openai.tsx +++ b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/gen_ai.tsx @@ -8,24 +8,24 @@ import { lazy } from 'react'; import { i18n } from '@kbn/i18n'; import type { GenericValidationResult } from '@kbn/triggers-actions-ui-plugin/public/types'; -import { SUB_ACTION } from '../../../common/openai/constants'; -import { OPENAI_CONNECTOR_ID, OPENAI_TITLE } from '../../../common/openai/constants'; -import { ActionParams, OpenAIConnector } from './types'; +import { SUB_ACTION } from '../../../common/gen_ai/constants'; +import { GEN_AI_CONNECTOR_ID, OPEN_AI_TITLE } from '../../../common/gen_ai/constants'; +import { GenerativeAiActionParams, GenerativeAiConnector } from './types'; interface ValidationErrors { subAction: string[]; body: string[]; } -export function getConnectorType(): OpenAIConnector { +export function getConnectorType(): GenerativeAiConnector { return { - id: OPENAI_CONNECTOR_ID, + id: GEN_AI_CONNECTOR_ID, iconClass: lazy(() => import('./logo')), selectMessage: i18n.translate('xpack.stackConnectors.components.genAi.selectMessageText', { - defaultMessage: 'Send a request to OpenAI systems.', + defaultMessage: 'Send a request to generative AI systems.', }), - actionTypeTitle: OPENAI_TITLE, + actionTypeTitle: OPEN_AI_TITLE, validateParams: async ( - actionParams: ActionParams + actionParams: GenerativeAiActionParams ): Promise> => { const { subAction, subActionParams } = actionParams; const translations = await import('./translations'); diff --git a/x-pack/plugins/stack_connectors/public/connector_types/openai/index.ts b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/index.ts similarity index 76% rename from x-pack/plugins/stack_connectors/public/connector_types/openai/index.ts rename to x-pack/plugins/stack_connectors/public/connector_types/gen_ai/index.ts index 8c51a45c58f9f..dea9dbeaef3d7 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/openai/index.ts +++ b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/index.ts @@ -5,4 +5,4 @@ * 2.0. */ -export { getConnectorType as getOpenAIConnectorType } from './openai'; +export { getConnectorType as getGenerativeAiConnectorType } from './gen_ai'; diff --git a/x-pack/plugins/stack_connectors/public/connector_types/openai/logo.tsx b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/logo.tsx similarity index 100% rename from x-pack/plugins/stack_connectors/public/connector_types/openai/logo.tsx rename to x-pack/plugins/stack_connectors/public/connector_types/gen_ai/logo.tsx diff --git a/x-pack/plugins/stack_connectors/public/connector_types/openai/params.test.tsx b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/params.test.tsx similarity index 94% rename from x-pack/plugins/stack_connectors/public/connector_types/openai/params.test.tsx rename to x-pack/plugins/stack_connectors/public/connector_types/gen_ai/params.test.tsx index cefabe4d3b1aa..ef418bd16965d 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/openai/params.test.tsx +++ b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/params.test.tsx @@ -7,9 +7,9 @@ import React from 'react'; import { fireEvent, render } from '@testing-library/react'; -import ParamsFields from './params'; +import GenerativeAiParamsFields from './params'; import { MockCodeEditor } from '@kbn/triggers-actions-ui-plugin/public/application/code_editor.mock'; -import { OpenAiProviderType, SUB_ACTION } from '../../../common/openai/constants'; +import { OpenAiProviderType, SUB_ACTION } from '../../../common/gen_ai/constants'; import { DEFAULT_BODY, DEFAULT_BODY_AZURE, DEFAULT_URL } from './constants'; const kibanaReactPath = '../../../../../../src/plugins/kibana_react/public'; @@ -34,7 +34,7 @@ const messageVariables = [ describe('Gen AI Params Fields renders', () => { test('all params fields are rendered', () => { const { getByTestId } = render( - { isPreconfigured: false, isSystemAction: false as const, isDeprecated: false, - name: 'My OpenAI Connector', + name: 'My GenAI Connector', config: { apiProvider, apiUrl: DEFAULT_URL, }, }; render( - { const editAction = jest.fn(); const errors = {}; render( - { const editAction = jest.fn(); const errors = {}; const { getByTestId } = render( - > = ({ +const GenerativeAiParamsFields: React.FunctionComponent< + ActionParamsProps +> = ({ actionConnector, actionParams, editAction, @@ -29,7 +31,7 @@ const ParamsFields: React.FunctionComponent> = ( const { body } = subActionParams ?? {}; - const typedActionConnector = actionConnector as unknown as OpenAIActionConnector; + const typedActionConnector = actionConnector as unknown as GenerativeAiActionConnector; const isTest = useMemo(() => executionMode === ActionConnectorMode.Test, [executionMode]); @@ -53,7 +55,7 @@ const ParamsFields: React.FunctionComponent> = ( }, [typedActionConnector?.config?.apiProvider, editAction, index, subActionParams]); const editSubActionParams = useCallback( - (params: ActionParams['subActionParams']) => { + (params: GenerativeAiActionParams['subActionParams']) => { editAction('subActionParams', { ...subActionParams, ...params }, index); }, [editAction, index, subActionParams] @@ -85,4 +87,4 @@ const ParamsFields: React.FunctionComponent> = ( }; // eslint-disable-next-line import/no-default-export -export { ParamsFields as default }; +export { GenerativeAiParamsFields as default }; diff --git a/x-pack/plugins/stack_connectors/public/connector_types/openai/translations.ts b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/translations.ts similarity index 94% rename from x-pack/plugins/stack_connectors/public/connector_types/openai/translations.ts rename to x-pack/plugins/stack_connectors/public/connector_types/gen_ai/translations.ts index f6cfa4a91cf61..ef6ccd07d386b 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/openai/translations.ts +++ b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/translations.ts @@ -39,7 +39,7 @@ export const API_PROVIDER_LABEL = i18n.translate( } ); -export const OPENAI = i18n.translate('xpack.stackConnectors.components.genAi.openAi', { +export const OPEN_AI = i18n.translate('xpack.stackConnectors.components.genAi.openAi', { defaultMessage: 'OpenAI', }); @@ -104,6 +104,6 @@ export const USAGE_DASHBOARD_LINK = (apiProvider: string, connectorName: string) export const GET_DASHBOARD_API_ERROR = i18n.translate( 'xpack.stackConnectors.components.genAi.error.dashboardApiError', { - defaultMessage: 'Error finding OpenAI Token Usage Dashboard.', + defaultMessage: 'Error finding Generative AI Token Usage Dashboard.', } ); diff --git a/x-pack/plugins/stack_connectors/public/connector_types/openai/types.ts b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/types.ts similarity index 59% rename from x-pack/plugins/stack_connectors/public/connector_types/openai/types.ts rename to x-pack/plugins/stack_connectors/public/connector_types/gen_ai/types.ts index 3ba19c04d13a7..ddb0f8e871b19 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/openai/types.ts +++ b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/types.ts @@ -7,22 +7,29 @@ import { ActionTypeModel as ConnectorTypeModel } from '@kbn/triggers-actions-ui-plugin/public'; import { UserConfiguredActionConnector } from '@kbn/triggers-actions-ui-plugin/public/types'; -import { OpenAiProviderType, SUB_ACTION } from '../../../common/openai/constants'; -import { RunActionParams } from '../../../common/openai/types'; +import { OpenAiProviderType, SUB_ACTION } from '../../../common/gen_ai/constants'; +import { RunActionParams } from '../../../common/gen_ai/types'; -export interface ActionParams { +export interface GenerativeAiActionParams { subAction: SUB_ACTION.RUN | SUB_ACTION.TEST; subActionParams: RunActionParams; } -export interface Config { +export interface GenerativeAiConfig { apiProvider: OpenAiProviderType; apiUrl: string; } -export interface Secrets { +export interface GenerativeAiSecrets { apiKey: string; } -export type OpenAIConnector = ConnectorTypeModel; -export type OpenAIActionConnector = UserConfiguredActionConnector; +export type GenerativeAiConnector = ConnectorTypeModel< + GenerativeAiConfig, + GenerativeAiSecrets, + GenerativeAiActionParams +>; +export type GenerativeAiActionConnector = UserConfiguredActionConnector< + GenerativeAiConfig, + GenerativeAiSecrets +>; diff --git a/x-pack/plugins/stack_connectors/public/connector_types/openai/use_get_dashboard.test.ts b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/use_get_dashboard.test.ts similarity index 98% rename from x-pack/plugins/stack_connectors/public/connector_types/openai/use_get_dashboard.test.ts rename to x-pack/plugins/stack_connectors/public/connector_types/gen_ai/use_get_dashboard.test.ts index 8e78c522712bd..255e2aba1b000 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/openai/use_get_dashboard.test.ts +++ b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/use_get_dashboard.test.ts @@ -123,7 +123,7 @@ describe('useGetDashboard_function', () => { await waitForNextUpdate(); expect(result.current.isLoading).toBe(false); expect(mockToasts.addDanger).toHaveBeenCalledWith({ - title: 'Error finding OpenAI Token Usage Dashboard.', + title: 'Error finding Generative AI Token Usage Dashboard.', text: 'Error fetching dashboard', }); }); diff --git a/x-pack/plugins/stack_connectors/public/connector_types/openai/use_get_dashboard.ts b/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/use_get_dashboard.ts similarity index 100% rename from x-pack/plugins/stack_connectors/public/connector_types/openai/use_get_dashboard.ts rename to x-pack/plugins/stack_connectors/public/connector_types/gen_ai/use_get_dashboard.ts diff --git a/x-pack/plugins/stack_connectors/public/connector_types/index.ts b/x-pack/plugins/stack_connectors/public/connector_types/index.ts index 0c024870133dc..20964012607f8 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/index.ts +++ b/x-pack/plugins/stack_connectors/public/connector_types/index.ts @@ -11,7 +11,7 @@ import { getCasesWebhookConnectorType } from './cases_webhook'; import { getEmailConnectorType } from './email'; import { getIndexConnectorType } from './es_index'; import { getJiraConnectorType } from './jira'; -import { getOpenAIConnectorType } from './openai'; +import { getGenerativeAiConnectorType } from './gen_ai'; import { getBedrockConnectorType } from './bedrock'; import { getOpsgenieConnectorType } from './opsgenie'; import { getPagerDutyConnectorType } from './pagerduty'; @@ -60,7 +60,7 @@ export function registerConnectorTypes({ connectorTypeRegistry.register(getJiraConnectorType()); connectorTypeRegistry.register(getResilientConnectorType()); connectorTypeRegistry.register(getOpsgenieConnectorType()); - connectorTypeRegistry.register(getOpenAIConnectorType()); + connectorTypeRegistry.register(getGenerativeAiConnectorType()); connectorTypeRegistry.register(getBedrockConnectorType()); connectorTypeRegistry.register(getTeamsConnectorType()); connectorTypeRegistry.register(getTorqConnectorType()); diff --git a/x-pack/plugins/stack_connectors/server/connector_types/bedrock/index.ts b/x-pack/plugins/stack_connectors/server/connector_types/bedrock/index.ts index 11050628203a9..661771f6df124 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/bedrock/index.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/bedrock/index.ts @@ -10,7 +10,7 @@ import { SubActionConnectorType, ValidatorType, } from '@kbn/actions-plugin/server/sub_action_framework/types'; -import { GenerativeAIConnectorFeatureId } from '@kbn/actions-plugin/common'; +import { GeneralConnectorFeatureId } from '@kbn/actions-plugin/common'; import { urlAllowListValidator } from '@kbn/actions-plugin/server'; import { ValidatorServices } from '@kbn/actions-plugin/server/types'; import { assertURL } from '@kbn/actions-plugin/server/sub_action_framework/helpers/validators'; @@ -29,7 +29,7 @@ export const getConnectorType = (): SubActionConnectorType => ( secrets: SecretsSchema, }, validators: [{ type: ValidatorType.CONFIG, validator: configValidator }], - supportedFeatureIds: [GenerativeAIConnectorFeatureId], + supportedFeatureIds: [GeneralConnectorFeatureId], minimumLicenseRequired: 'enterprise' as const, renderParameterTemplates, }); diff --git a/x-pack/plugins/stack_connectors/server/connector_types/openai/create_dashboard.test.ts b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/create_dashboard.test.ts similarity index 100% rename from x-pack/plugins/stack_connectors/server/connector_types/openai/create_dashboard.test.ts rename to x-pack/plugins/stack_connectors/server/connector_types/gen_ai/create_dashboard.test.ts diff --git a/x-pack/plugins/stack_connectors/server/connector_types/openai/create_dashboard.ts b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/create_dashboard.ts similarity index 100% rename from x-pack/plugins/stack_connectors/server/connector_types/openai/create_dashboard.ts rename to x-pack/plugins/stack_connectors/server/connector_types/gen_ai/create_dashboard.ts diff --git a/x-pack/plugins/stack_connectors/server/connector_types/openai/dashboard.ts b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/dashboard.ts similarity index 97% rename from x-pack/plugins/stack_connectors/server/connector_types/openai/dashboard.ts rename to x-pack/plugins/stack_connectors/server/connector_types/gen_ai/dashboard.ts index 8503ef9bf59fc..6470f088577b7 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/openai/dashboard.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/dashboard.ts @@ -9,7 +9,7 @@ import { DashboardAttributes } from '@kbn/dashboard-plugin/common'; import { v4 as uuidv4 } from 'uuid'; import { SavedObject } from '@kbn/core-saved-objects-common/src/server_types'; -export const dashboardTitle = `OpenAI Token Usage`; +export const dashboardTitle = `Generative AI Token Usage`; export const getDashboard = (dashboardId: string): SavedObject => { const ids: Record = { @@ -125,7 +125,7 @@ export const getDashboard = (dashboardId: string): SavedObject { +describe('GenAiConnector', () => { let mockRequest: jest.Mock; let mockError: jest.Mock; const mockResponseString = 'Hello! How can I assist you today?'; @@ -46,9 +46,9 @@ describe('OpenAIConnector', () => { }); describe('OpenAI', () => { - const connector = new OpenAIConnector({ + const connector = new GenAiConnector({ configurationUtilities: actionsConfigMock.create(), - connector: { id: '1', type: OPENAI_CONNECTOR_ID }, + connector: { id: '1', type: GEN_AI_CONNECTOR_ID }, config: { apiUrl: 'https://api.openai.com/v1/chat/completions', apiProvider: OpenAiProviderType.OpenAi, @@ -285,9 +285,9 @@ describe('OpenAIConnector', () => { }); describe('AzureAI', () => { - const connector = new OpenAIConnector({ + const connector = new GenAiConnector({ configurationUtilities: actionsConfigMock.create(), - connector: { id: '1', type: OPENAI_CONNECTOR_ID }, + connector: { id: '1', type: GEN_AI_CONNECTOR_ID }, config: { apiUrl: 'https://My-test-resource-123.openai.azure.com/openai/deployments/NEW-DEPLOYMENT-321/chat/completions?api-version=2023-05-15', @@ -455,9 +455,9 @@ describe('OpenAIConnector', () => { }); describe('Token dashboard', () => { - const connector = new OpenAIConnector({ + const connector = new GenAiConnector({ configurationUtilities: actionsConfigMock.create(), - connector: { id: '1', type: OPENAI_CONNECTOR_ID }, + connector: { id: '1', type: GEN_AI_CONNECTOR_ID }, config: { apiUrl: 'https://example.com/api', apiProvider: OpenAiProviderType.AzureAi }, secrets: { apiKey: '123' }, logger: loggingSystemMock.createLogger(), diff --git a/x-pack/plugins/stack_connectors/server/connector_types/openai/openai.ts b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/gen_ai.ts similarity index 96% rename from x-pack/plugins/stack_connectors/server/connector_types/openai/openai.ts rename to x-pack/plugins/stack_connectors/server/connector_types/gen_ai/gen_ai.ts index dec34ac2bb388..4a0efbe11d472 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/openai/openai.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/gen_ai.ts @@ -7,6 +7,7 @@ import { ServiceParams, SubActionConnector } from '@kbn/actions-plugin/server'; import type { AxiosError } from 'axios'; +import { initDashboard } from './create_dashboard'; import { RunActionParamsSchema, RunActionResponseSchema, @@ -14,22 +15,21 @@ import { StreamActionParamsSchema, StreamingResponseSchema, InvokeAIActionParamsSchema, -} from '../../../common/openai/schema'; +} from '../../../common/gen_ai/schema'; import type { Config, Secrets, RunActionParams, RunActionResponse, StreamActionParams, -} from '../../../common/openai/types'; -import { SUB_ACTION } from '../../../common/openai/constants'; +} from '../../../common/gen_ai/types'; +import { SUB_ACTION } from '../../../common/gen_ai/constants'; import { DashboardActionParams, DashboardActionResponse, InvokeAIActionParams, InvokeAIActionResponse, -} from '../../../common/openai/types'; -import { initDashboard } from './create_dashboard'; +} from '../../../common/gen_ai/types'; import { getAxiosOptions, getRequestWithStreamOption, @@ -37,7 +37,7 @@ import { sanitizeRequest, } from './lib/utils'; -export class OpenAIConnector extends SubActionConnector { +export class GenAiConnector extends SubActionConnector { private url; private provider; private key; diff --git a/x-pack/plugins/stack_connectors/server/connector_types/openai/index.test.ts b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/index.test.ts similarity index 85% rename from x-pack/plugins/stack_connectors/server/connector_types/openai/index.test.ts rename to x-pack/plugins/stack_connectors/server/connector_types/gen_ai/index.test.ts index 489fcb93a9cb5..5ed6aaf070b88 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/openai/index.test.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/index.test.ts @@ -9,9 +9,9 @@ import { actionsConfigMock } from '@kbn/actions-plugin/server/actions_config.moc import { ActionsConfigurationUtilities } from '@kbn/actions-plugin/server/actions_config'; import axios from 'axios'; import { configValidator, getConnectorType } from '.'; -import { Config, Secrets } from '../../../common/openai/types'; +import { Config, Secrets } from '../../../common/gen_ai/types'; import { SubActionConnectorType } from '@kbn/actions-plugin/server/sub_action_framework/types'; -import { DEFAULT_OPENAI_MODEL, OpenAiProviderType } from '../../../common/openai/constants'; +import { DEFAULT_OPENAI_MODEL, OpenAiProviderType } from '../../../common/gen_ai/constants'; jest.mock('axios'); jest.mock('@kbn/actions-plugin/server/lib/axios_utils', () => { @@ -30,12 +30,12 @@ axios.create = jest.fn(() => axios); let connectorType: SubActionConnectorType; let configurationUtilities: jest.Mocked; -describe('OpenAI Connector', () => { +describe('Generative AI Connector', () => { beforeEach(() => { configurationUtilities = actionsConfigMock.create(); connectorType = getConnectorType(); }); - test('exposes the connector as `OpenAI` with id `.gen-ai`', () => { + test('exposes the connector as `Generative AI` with id `.gen-ai`', () => { expect(connectorType.id).toEqual('.gen-ai'); expect(connectorType.name).toEqual('OpenAI'); }); @@ -59,7 +59,7 @@ describe('OpenAI Connector', () => { expect(() => { configValidator(config, { configurationUtilities }); }).toThrowErrorMatchingInlineSnapshot( - '"Error configuring OpenAI action: Error: URL Error: Invalid URL: example.com/do-something"' + '"Error configuring Generative AI action: Error: URL Error: Invalid URL: example.com/do-something"' ); }); @@ -72,7 +72,7 @@ describe('OpenAI Connector', () => { expect(() => { configValidator(config, { configurationUtilities }); }).toThrowErrorMatchingInlineSnapshot( - '"Error configuring OpenAI action: Error: API Provider is not supported"' + '"Error configuring Generative AI action: Error: API Provider is not supported"' ); }); @@ -85,7 +85,7 @@ describe('OpenAI Connector', () => { expect(() => { configValidator(config, { configurationUtilities }); }).toThrowErrorMatchingInlineSnapshot( - '"Error configuring OpenAI action: Error: API Provider is not supported: bad-one"' + '"Error configuring Generative AI action: Error: API Provider is not supported: bad-one"' ); }); @@ -106,7 +106,7 @@ describe('OpenAI Connector', () => { expect(() => { configValidator(config, { configurationUtilities: configUtils }); }).toThrowErrorMatchingInlineSnapshot( - `"Error configuring OpenAI action: Error: error validating url: target url is not present in allowedHosts"` + `"Error configuring Generative AI action: Error: error validating url: target url is not present in allowedHosts"` ); }); }); diff --git a/x-pack/plugins/stack_connectors/server/connector_types/openai/index.ts b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/index.ts similarity index 76% rename from x-pack/plugins/stack_connectors/server/connector_types/openai/index.ts rename to x-pack/plugins/stack_connectors/server/connector_types/gen_ai/index.ts index fb6a27b17bad5..cc43a05fd346d 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/openai/index.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/index.ts @@ -10,30 +10,30 @@ import { SubActionConnectorType, ValidatorType, } from '@kbn/actions-plugin/server/sub_action_framework/types'; -import { GenerativeAIConnectorFeatureId } from '@kbn/actions-plugin/common'; +import { GeneralConnectorFeatureId } from '@kbn/actions-plugin/common'; import { urlAllowListValidator } from '@kbn/actions-plugin/server'; import { ValidatorServices } from '@kbn/actions-plugin/server/types'; import { assertURL } from '@kbn/actions-plugin/server/sub_action_framework/helpers/validators'; import { - OPENAI_CONNECTOR_ID, - OPENAI_TITLE, + GEN_AI_CONNECTOR_ID, + OPEN_AI_TITLE, OpenAiProviderType, -} from '../../../common/openai/constants'; -import { ConfigSchema, SecretsSchema } from '../../../common/openai/schema'; -import { Config, Secrets } from '../../../common/openai/types'; -import { OpenAIConnector } from './openai'; +} from '../../../common/gen_ai/constants'; +import { ConfigSchema, SecretsSchema } from '../../../common/gen_ai/schema'; +import { Config, Secrets } from '../../../common/gen_ai/types'; +import { GenAiConnector } from './gen_ai'; import { renderParameterTemplates } from './render'; export const getConnectorType = (): SubActionConnectorType => ({ - id: OPENAI_CONNECTOR_ID, - name: OPENAI_TITLE, - Service: OpenAIConnector, + id: GEN_AI_CONNECTOR_ID, + name: OPEN_AI_TITLE, + Service: GenAiConnector, schema: { config: ConfigSchema, secrets: SecretsSchema, }, validators: [{ type: ValidatorType.CONFIG, validator: configValidator }], - supportedFeatureIds: [GenerativeAIConnectorFeatureId], + supportedFeatureIds: [GeneralConnectorFeatureId], minimumLicenseRequired: 'enterprise' as const, renderParameterTemplates, }); @@ -57,7 +57,7 @@ export const configValidator = (configObject: Config, validatorServices: Validat } catch (err) { throw new Error( i18n.translate('xpack.stackConnectors.genAi.configurationErrorApiProvider', { - defaultMessage: 'Error configuring OpenAI action: {err}', + defaultMessage: 'Error configuring Generative AI action: {err}', values: { err, }, diff --git a/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/azure_openai_utils.test.ts b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/azure_openai_utils.test.ts similarity index 99% rename from x-pack/plugins/stack_connectors/server/connector_types/openai/lib/azure_openai_utils.test.ts rename to x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/azure_openai_utils.test.ts index 43a9aa83a3f02..7e064fcd6fc1e 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/azure_openai_utils.test.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/azure_openai_utils.test.ts @@ -14,7 +14,7 @@ import { AZURE_OPENAI_CHAT_URL, AZURE_OPENAI_COMPLETIONS_URL, AZURE_OPENAI_COMPLETIONS_EXTENSIONS_URL, -} from '../../../../common/openai/constants'; +} from '../../../../common/gen_ai/constants'; describe('Azure Open AI Utils', () => { const chatUrl = diff --git a/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/azure_openai_utils.ts b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/azure_openai_utils.ts similarity index 97% rename from x-pack/plugins/stack_connectors/server/connector_types/openai/lib/azure_openai_utils.ts rename to x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/azure_openai_utils.ts index f39a574554a57..f892fdbfff093 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/azure_openai_utils.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/azure_openai_utils.ts @@ -9,7 +9,7 @@ import { AZURE_OPENAI_CHAT_URL, AZURE_OPENAI_COMPLETIONS_URL, AZURE_OPENAI_COMPLETIONS_EXTENSIONS_URL, -} from '../../../../common/openai/constants'; +} from '../../../../common/gen_ai/constants'; const APIS_ALLOWING_STREAMING = new Set([ AZURE_OPENAI_CHAT_URL, diff --git a/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/openai_utils.test.ts b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/openai_utils.test.ts similarity index 99% rename from x-pack/plugins/stack_connectors/server/connector_types/openai/lib/openai_utils.test.ts rename to x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/openai_utils.test.ts index 656982525cd0e..17e9b2365ae9f 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/openai_utils.test.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/openai_utils.test.ts @@ -10,7 +10,7 @@ import { DEFAULT_OPENAI_MODEL, OPENAI_CHAT_URL, OPENAI_LEGACY_COMPLETION_URL, -} from '../../../../common/openai/constants'; +} from '../../../../common/gen_ai/constants'; describe('Open AI Utils', () => { describe('sanitizeRequest', () => { diff --git a/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/openai_utils.ts b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/openai_utils.ts similarity index 97% rename from x-pack/plugins/stack_connectors/server/connector_types/openai/lib/openai_utils.ts rename to x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/openai_utils.ts index 8bbe8997c7e50..aacae0d7bc0c6 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/openai_utils.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/openai_utils.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { OPENAI_CHAT_URL, OPENAI_LEGACY_COMPLETION_URL } from '../../../../common/openai/constants'; +import { OPENAI_CHAT_URL, OPENAI_LEGACY_COMPLETION_URL } from '../../../../common/gen_ai/constants'; const APIS_ALLOWING_STREAMING = new Set([OPENAI_CHAT_URL, OPENAI_LEGACY_COMPLETION_URL]); diff --git a/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/utils.test.ts b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/utils.test.ts similarity index 99% rename from x-pack/plugins/stack_connectors/server/connector_types/openai/lib/utils.test.ts rename to x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/utils.test.ts index 9dffaab3e5e00..c50b513661ba3 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/utils.test.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/utils.test.ts @@ -10,7 +10,7 @@ import { DEFAULT_OPENAI_MODEL, OpenAiProviderType, OPENAI_CHAT_URL, -} from '../../../../common/openai/constants'; +} from '../../../../common/gen_ai/constants'; import { sanitizeRequest as openAiSanitizeRequest, getRequestWithStreamOption as openAiGetRequestWithStreamOption, diff --git a/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/utils.ts b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/utils.ts similarity index 97% rename from x-pack/plugins/stack_connectors/server/connector_types/openai/lib/utils.ts rename to x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/utils.ts index 74cf97e95ac06..d51f85c7aa514 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/utils.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/utils.ts @@ -7,7 +7,7 @@ import { AxiosResponse, ResponseType } from 'axios'; import { IncomingMessage } from 'http'; -import { OpenAiProviderType } from '../../../../common/openai/constants'; +import { OpenAiProviderType } from '../../../../common/gen_ai/constants'; import { sanitizeRequest as openAiSanitizeRequest, getRequestWithStreamOption as openAiGetRequestWithStreamOption, diff --git a/x-pack/plugins/stack_connectors/server/connector_types/openai/render.test.ts b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/render.test.ts similarity index 96% rename from x-pack/plugins/stack_connectors/server/connector_types/openai/render.test.ts rename to x-pack/plugins/stack_connectors/server/connector_types/gen_ai/render.test.ts index b9fff0362913c..301e096ad35bb 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/openai/render.test.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/render.test.ts @@ -17,7 +17,7 @@ const params = { const variables = { domain: 'm0zepcuuu2' }; -describe('OpenAI - renderParameterTemplates', () => { +describe('GenAI - renderParameterTemplates', () => { it('should not render body on test action', () => { const testParams = { subAction: 'test', subActionParams: { body: 'test_json' } }; const result = renderParameterTemplates(testParams, variables); diff --git a/x-pack/plugins/stack_connectors/server/connector_types/openai/render.ts b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/render.ts similarity index 93% rename from x-pack/plugins/stack_connectors/server/connector_types/openai/render.ts rename to x-pack/plugins/stack_connectors/server/connector_types/gen_ai/render.ts index bb2f97d7ca0db..aae342a5acd8f 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/openai/render.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/render.ts @@ -8,7 +8,7 @@ import { ExecutorParams } from '@kbn/actions-plugin/server/sub_action_framework/types'; import { renderMustacheString } from '@kbn/actions-plugin/server/lib/mustache_renderer'; import { RenderParameterTemplates } from '@kbn/actions-plugin/server/types'; -import { SUB_ACTION } from '../../../common/openai/constants'; +import { SUB_ACTION } from '../../../common/gen_ai/constants'; export const renderParameterTemplates: RenderParameterTemplates = ( params, diff --git a/x-pack/plugins/stack_connectors/server/connector_types/index.ts b/x-pack/plugins/stack_connectors/server/connector_types/index.ts index 0117a9d1a7a2a..743f2664ed0b5 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/index.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/index.ts @@ -17,7 +17,7 @@ import { getTinesConnectorType } from './tines'; import { getActionType as getTorqConnectorType } from './torq'; import { getConnectorType as getEmailConnectorType } from './email'; import { getConnectorType as getIndexConnectorType } from './es_index'; -import { getConnectorType as getOpenAIConnectorType } from './openai'; +import { getConnectorType as getGenerativeAiConnectorType } from './gen_ai'; import { getConnectorType as getBedrockConnectorType } from './bedrock'; import { getConnectorType as getPagerDutyConnectorType } from './pagerduty'; import { getConnectorType as getSwimlaneConnectorType } from './swimlane'; @@ -101,7 +101,7 @@ export function registerConnectorTypes({ actions.registerSubActionConnectorType(getOpsgenieConnectorType()); actions.registerSubActionConnectorType(getTinesConnectorType()); - actions.registerSubActionConnectorType(getOpenAIConnectorType()); + actions.registerSubActionConnectorType(getGenerativeAiConnectorType()); actions.registerSubActionConnectorType(getBedrockConnectorType()); actions.registerSubActionConnectorType(getD3SecurityConnectorType()); } diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 2391c36acc263..15a96b01726c2 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -7073,6 +7073,7 @@ "xpack.actions.availableConnectorFeatures.cases": "Cas", "xpack.actions.availableConnectorFeatures.compatibility.alertingRules": "Règles d'alerting", "xpack.actions.availableConnectorFeatures.compatibility.cases": "Cas", + "xpack.actions.availableConnectorFeatures.compatibility.general": "Général", "xpack.actions.availableConnectorFeatures.securitySolution": "Solution de sécurité", "xpack.actions.availableConnectorFeatures.uptime": "Uptime", "xpack.actions.builtin.cases.jiraTitle": "Jira", @@ -39765,4 +39766,4 @@ "xpack.painlessLab.walkthroughButtonLabel": "Présentation", "xpack.serverlessObservability.nav.getStarted": "Démarrer" } -} +} \ No newline at end of file diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index ebd523dace815..9ddbc69b1fcc3 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -7089,6 +7089,7 @@ "xpack.actions.availableConnectorFeatures.cases": "ケース", "xpack.actions.availableConnectorFeatures.compatibility.alertingRules": "アラートルール", "xpack.actions.availableConnectorFeatures.compatibility.cases": "ケース", + "xpack.actions.availableConnectorFeatures.compatibility.general": "一般", "xpack.actions.availableConnectorFeatures.securitySolution": "セキュリティソリューション", "xpack.actions.availableConnectorFeatures.uptime": "アップタイム", "xpack.actions.builtin.cases.jiraTitle": "Jira", @@ -39756,4 +39757,4 @@ "xpack.painlessLab.walkthroughButtonLabel": "実地検証", "xpack.serverlessObservability.nav.getStarted": "使ってみる" } -} +} \ No newline at end of file diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 96adbe87e50d9..17bfa24a3b450 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -7088,6 +7088,7 @@ "xpack.actions.availableConnectorFeatures.cases": "案例", "xpack.actions.availableConnectorFeatures.compatibility.alertingRules": "告警规则", "xpack.actions.availableConnectorFeatures.compatibility.cases": "案例", + "xpack.actions.availableConnectorFeatures.compatibility.general": "常规", "xpack.actions.availableConnectorFeatures.securitySolution": "安全解决方案", "xpack.actions.availableConnectorFeatures.uptime": "运行时间", "xpack.actions.builtin.cases.jiraTitle": "Jira", @@ -39750,4 +39751,4 @@ "xpack.painlessLab.walkthroughButtonLabel": "指导", "xpack.serverlessObservability.nav.getStarted": "开始使用" } -} +} \ No newline at end of file diff --git a/x-pack/test/alerting_api_integration/common/plugins/actions_simulators/server/openai_simulation.ts b/x-pack/test/alerting_api_integration/common/plugins/actions_simulators/server/gen_ai_simulation.ts similarity index 91% rename from x-pack/test/alerting_api_integration/common/plugins/actions_simulators/server/openai_simulation.ts rename to x-pack/test/alerting_api_integration/common/plugins/actions_simulators/server/gen_ai_simulation.ts index 3ab2c3b0dd54e..b10c5b6aa5f7c 100644 --- a/x-pack/test/alerting_api_integration/common/plugins/actions_simulators/server/openai_simulation.ts +++ b/x-pack/test/alerting_api_integration/common/plugins/actions_simulators/server/gen_ai_simulation.ts @@ -9,7 +9,7 @@ import http from 'http'; import { ProxyArgs, Simulator } from './simulator'; -export class OpenAISimulator extends Simulator { +export class GenAiSimulator extends Simulator { private readonly returnError: boolean; constructor({ returnError = false, proxy }: { returnError?: boolean; proxy?: ProxyArgs }) { @@ -24,10 +24,10 @@ export class OpenAISimulator extends Simulator { data: Record ) { if (this.returnError) { - return OpenAISimulator.sendErrorResponse(response); + return GenAiSimulator.sendErrorResponse(response); } - return OpenAISimulator.sendResponse(response); + return GenAiSimulator.sendResponse(response); } private static sendResponse(response: http.ServerResponse) { diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/openai.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/gen_ai.ts similarity index 96% rename from x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/openai.ts rename to x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/gen_ai.ts index c4f8d1078002c..5cfe992171dac 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/openai.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/gen_ai.ts @@ -8,9 +8,9 @@ import expect from '@kbn/expect'; import { - OpenAISimulator, + GenAiSimulator, genAiSuccessResponse, -} from '@kbn/actions-simulators-plugin/server/openai_simulation'; +} from '@kbn/actions-simulators-plugin/server/gen_ai_simulation'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; import { getUrlPrefix, ObjectRemover } from '../../../../../common/lib'; @@ -51,7 +51,7 @@ export default function genAiTest({ getService }: FtrProviderContext) { objectRemover.removeAll(); }); describe('action creation', () => { - const simulator = new OpenAISimulator({ + const simulator = new GenAiSimulator({ returnError: false, proxy: { config: configService.get('kbnTestServer.serverArgs'), @@ -189,7 +189,7 @@ export default function genAiTest({ getService }: FtrProviderContext) { statusCode: 400, error: 'Bad Request', message: - 'error validating action type config: Error configuring OpenAI action: Error: error validating url: target url "http://genAi.mynonexistent.com" is not added to the Kibana config xpack.actions.allowedHosts', + 'error validating action type config: Error configuring Generative AI action: Error: error validating url: target url "http://genAi.mynonexistent.com" is not added to the Kibana config xpack.actions.allowedHosts', }); }); }); @@ -217,7 +217,7 @@ export default function genAiTest({ getService }: FtrProviderContext) { describe('executor', () => { describe('validation', () => { - const simulator = new OpenAISimulator({ + const simulator = new GenAiSimulator({ proxy: { config: configService.get('kbnTestServer.serverArgs'), }, @@ -272,7 +272,7 @@ export default function genAiTest({ getService }: FtrProviderContext) { describe('execution', () => { describe('successful response simulator', () => { - const simulator = new OpenAISimulator({ + const simulator = new GenAiSimulator({ proxy: { config: configService.get('kbnTestServer.serverArgs'), }, @@ -313,7 +313,7 @@ export default function genAiTest({ getService }: FtrProviderContext) { data: genAiSuccessResponse, }); }); - describe('OpenAI dashboard', () => { + describe('gen ai dashboard', () => { const dashboardId = 'specific-dashboard-id-default'; it('should not create a dashboard when user does not have kibana event log permissions', async () => { @@ -377,7 +377,7 @@ export default function genAiTest({ getService }: FtrProviderContext) { }); }); describe('non-default space simulator', () => { - const simulator = new OpenAISimulator({ + const simulator = new GenAiSimulator({ proxy: { config: configService.get('kbnTestServer.serverArgs'), }, @@ -428,7 +428,7 @@ export default function genAiTest({ getService }: FtrProviderContext) { }); describe('error response simulator', () => { - const simulator = new OpenAISimulator({ + const simulator = new GenAiSimulator({ returnError: true, proxy: { config: configService.get('kbnTestServer.serverArgs'), diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/index.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/index.ts index e9fc2cbeb7c00..fd667f8f1025a 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/index.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/index.ts @@ -39,7 +39,7 @@ export default function connectorsTests({ loadTestFile, getService }: FtrProvide loadTestFile(require.resolve('./connector_types/xmatters')); loadTestFile(require.resolve('./connector_types/tines')); loadTestFile(require.resolve('./connector_types/torq')); - loadTestFile(require.resolve('./connector_types/openai')); + loadTestFile(require.resolve('./connector_types/gen_ai')); loadTestFile(require.resolve('./connector_types/d3security')); loadTestFile(require.resolve('./connector_types/bedrock')); loadTestFile(require.resolve('./create')); diff --git a/x-pack/test/screenshot_creation/apps/response_ops_docs/stack_connectors/generative_ai_connector.ts b/x-pack/test/screenshot_creation/apps/response_ops_docs/stack_connectors/generative_ai_connector.ts index 4dc7d6d3fa26e..69fa2448a7818 100644 --- a/x-pack/test/screenshot_creation/apps/response_ops_docs/stack_connectors/generative_ai_connector.ts +++ b/x-pack/test/screenshot_creation/apps/response_ops_docs/stack_connectors/generative_ai_connector.ts @@ -21,13 +21,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { `"content": "You are a cyber security analyst using Elastic Security. I would like you to evaluate the event below and format your output neatly in markdown syntax. Add your description, an accuracy rating, and a threat rating."\n` + `}]`; - describe('OpenAI connector', function () { + describe('generative ai connector', function () { beforeEach(async () => { await pageObjects.common.navigateToApp('connectors'); await pageObjects.header.waitUntilLoadingHasFinished(); }); - it('OpenAI connector screenshots', async () => { + it('generative ai connector screenshots', async () => { await pageObjects.common.navigateToApp('connectors'); await pageObjects.header.waitUntilLoadingHasFinished(); await actions.common.openNewConnectorForm('gen-ai'); diff --git a/x-pack/test/screenshot_creation/apps/response_ops_docs/stack_connectors/xmatters_connector.ts b/x-pack/test/screenshot_creation/apps/response_ops_docs/stack_connectors/xmatters_connector.ts index 709d9bdfae76e..80aafd27dc63b 100644 --- a/x-pack/test/screenshot_creation/apps/response_ops_docs/stack_connectors/xmatters_connector.ts +++ b/x-pack/test/screenshot_creation/apps/response_ops_docs/stack_connectors/xmatters_connector.ts @@ -20,7 +20,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await pageObjects.header.waitUntilLoadingHasFinished(); }); - it('xmatters connector screenshots', async () => { + it('generative ai connector screenshots', async () => { await pageObjects.common.navigateToApp('connectors'); await pageObjects.header.waitUntilLoadingHasFinished(); await actions.common.openNewConnectorForm('xmatters'); From 0bdbcc0ccc0cd33c571b3cb9fae03b3411bb8192 Mon Sep 17 00:00:00 2001 From: Melissa Alvarez Date: Fri, 29 Sep 2023 09:12:09 -0700 Subject: [PATCH 2/7] [ML][AIOps] Telemetry: track analysis endpoint usage (#166988) ## Summary This PR adds tracking for Log Rate Analysis and Log Pattern Analysis endpoints for AIOps. - tracks type of analysis and source (where the analysis is being run from) --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- src/plugins/ui_actions/public/types.ts | 2 +- .../ml/response_stream/client/fetch_stream.ts | 6 ++-- .../client/use_fetch_stream.ts | 8 +++-- x-pack/plugins/aiops/common/constants.ts | 5 +++ x-pack/plugins/aiops/kibana.jsonc | 3 +- .../categorize_field_actions.ts | 4 +-- .../log_categorization_app_state.tsx | 3 +- .../log_categorization_for_flyout.tsx | 8 ++++- .../log_categorization_page.tsx | 14 ++++++-- .../log_categorization/show_flyout.tsx | 4 ++- .../use_validate_category_field.ts | 6 +++- .../log_rate_analysis_content.tsx | 4 +++ .../log_rate_analysis_content_wrapper.tsx | 4 +++ .../log_rate_analysis_page.tsx | 2 ++ .../log_rate_analysis_results.tsx | 7 +++- .../server/lib/track_route_usage.test.ts | 32 +++++++++++++++++++ .../aiops/server/lib/track_route_usage.ts | 22 +++++++++++++ x-pack/plugins/aiops/server/plugin.ts | 8 +++-- .../aiops/server/routes/log_categorization.ts | 13 +++++++- .../aiops/server/routes/log_rate_analysis.ts | 15 +++++++-- x-pack/plugins/aiops/server/types.ts | 2 ++ x-pack/plugins/aiops/tsconfig.json | 1 + .../components/log_rate_analysis.tsx | 1 + 23 files changed, 153 insertions(+), 21 deletions(-) create mode 100644 x-pack/plugins/aiops/server/lib/track_route_usage.test.ts create mode 100644 x-pack/plugins/aiops/server/lib/track_route_usage.ts diff --git a/src/plugins/ui_actions/public/types.ts b/src/plugins/ui_actions/public/types.ts index e8ee3f39996a3..6d689f6776d96 100644 --- a/src/plugins/ui_actions/public/types.ts +++ b/src/plugins/ui_actions/public/types.ts @@ -27,7 +27,7 @@ export interface VisualizeFieldContext { export interface CategorizeFieldContext { field: DataViewField; dataView: DataView; - originatingApp?: string; + originatingApp: string; } export const ACTION_VISUALIZE_FIELD = 'ACTION_VISUALIZE_FIELD'; diff --git a/x-pack/packages/ml/response_stream/client/fetch_stream.ts b/x-pack/packages/ml/response_stream/client/fetch_stream.ts index da262f423d47d..7384b5f2311e2 100644 --- a/x-pack/packages/ml/response_stream/client/fetch_stream.ts +++ b/x-pack/packages/ml/response_stream/client/fetch_stream.ts @@ -8,7 +8,7 @@ import startsWith from 'lodash/startsWith'; import type { Reducer, ReducerAction } from 'react'; -import type { HttpSetup } from '@kbn/core/public'; +import type { HttpSetup, HttpFetchOptions } from '@kbn/core/public'; type GeneratorError = string | null; @@ -42,7 +42,8 @@ export async function* fetchStream apiVersion: string | undefined, abortCtrl: React.MutableRefObject, body?: B, - ndjson = true + ndjson = true, + headers?: HttpFetchOptions['headers'] ): AsyncGenerator<[GeneratorError, ReducerAction | Array> | undefined]> { let stream: Readonly | undefined; @@ -52,6 +53,7 @@ export async function* fetchStream version: apiVersion, asResponse: true, rawResponse: true, + headers, ...(body && Object.keys(body).length > 0 ? { body: JSON.stringify(body) } : {}), }); diff --git a/x-pack/packages/ml/response_stream/client/use_fetch_stream.ts b/x-pack/packages/ml/response_stream/client/use_fetch_stream.ts index d2d140f80ee41..309d53e8dd4bd 100644 --- a/x-pack/packages/ml/response_stream/client/use_fetch_stream.ts +++ b/x-pack/packages/ml/response_stream/client/use_fetch_stream.ts @@ -16,7 +16,7 @@ import { } from 'react'; import useThrottle from 'react-use/lib/useThrottle'; -import type { HttpSetup } from '@kbn/core/public'; +import type { HttpSetup, HttpFetchOptions } from '@kbn/core/public'; import { isPopulatedObject } from '@kbn/ml-is-populated-object'; import { fetchStream } from './fetch_stream'; @@ -64,7 +64,8 @@ export function useFetchStream>( endpoint: string, apiVersion?: string, body?: B, - customReducer?: FetchStreamCustomReducer + customReducer?: FetchStreamCustomReducer, + headers?: HttpFetchOptions['headers'] ) { const [errors, setErrors] = useState([]); const [isCancelled, setIsCancelled] = useState(false); @@ -104,7 +105,8 @@ export function useFetchStream>( apiVersion, abortCtrl, body, - customReducer !== undefined + customReducer !== undefined, + headers )) { if (fetchStreamError !== null) { addError(fetchStreamError); diff --git a/x-pack/plugins/aiops/common/constants.ts b/x-pack/plugins/aiops/common/constants.ts index c8831aa06b330..226082e6041b9 100644 --- a/x-pack/plugins/aiops/common/constants.ts +++ b/x-pack/plugins/aiops/common/constants.ts @@ -19,3 +19,8 @@ export const RANDOM_SAMPLER_SEED = 3867412; export const CASES_ATTACHMENT_CHANGE_POINT_CHART = 'aiopsChangePointChart'; export const EMBEDDABLE_CHANGE_POINT_CHART_TYPE = 'aiopsChangePointChart' as const; + +export const AIOPS_TELEMETRY_ID = { + AIOPS_DEFAULT_SOURCE: 'ml_aiops_labs', + AIOPS_ANALYSIS_RUN_ORIGIN: 'aiops-analysis-run-origin', +} as const; diff --git a/x-pack/plugins/aiops/kibana.jsonc b/x-pack/plugins/aiops/kibana.jsonc index 9b787992c7c54..192fa65cd9a2b 100644 --- a/x-pack/plugins/aiops/kibana.jsonc +++ b/x-pack/plugins/aiops/kibana.jsonc @@ -20,7 +20,8 @@ "unifiedSearch" ], "optionalPlugins": [ - "cases" + "cases", + "usageCollection" ], "requiredBundles": [ "fieldFormats", diff --git a/x-pack/plugins/aiops/public/components/log_categorization/categorize_field_actions.ts b/x-pack/plugins/aiops/public/components/log_categorization/categorize_field_actions.ts index b915626ade72c..4d03465605463 100644 --- a/x-pack/plugins/aiops/public/components/log_categorization/categorize_field_actions.ts +++ b/x-pack/plugins/aiops/public/components/log_categorization/categorize_field_actions.ts @@ -27,7 +27,7 @@ export const categorizeFieldAction = (coreStart: CoreStart, plugins: AiopsPlugin return field.esTypes?.includes('text') === true; }, execute: async (context: CategorizeFieldContext) => { - const { field, dataView } = context; - showCategorizeFlyout(field, dataView, coreStart, plugins); + const { field, dataView, originatingApp } = context; + showCategorizeFlyout(field, dataView, coreStart, plugins, originatingApp); }, }); diff --git a/x-pack/plugins/aiops/public/components/log_categorization/log_categorization_app_state.tsx b/x-pack/plugins/aiops/public/components/log_categorization/log_categorization_app_state.tsx index c6e2600b7e4f4..46e3de8b01b67 100644 --- a/x-pack/plugins/aiops/public/components/log_categorization/log_categorization_app_state.tsx +++ b/x-pack/plugins/aiops/public/components/log_categorization/log_categorization_app_state.tsx @@ -15,6 +15,7 @@ import { Storage } from '@kbn/kibana-utils-plugin/public'; import { DatePickerContextProvider, type DatePickerDependencies } from '@kbn/ml-date-picker'; import { UI_SETTINGS } from '@kbn/data-plugin/common'; +import { AIOPS_TELEMETRY_ID } from '../../../common/constants'; import { DataSourceContext } from '../../hooks/use_data_source'; import type { AiopsAppDependencies } from '../../hooks/use_aiops_app_context'; import { AIOPS_STORAGE_KEYS } from '../../types/storage'; @@ -65,7 +66,7 @@ export const LogCategorizationAppState: FC = ({ - + diff --git a/x-pack/plugins/aiops/public/components/log_categorization/log_categorization_for_flyout.tsx b/x-pack/plugins/aiops/public/components/log_categorization/log_categorization_for_flyout.tsx index 28c1350a88141..a5262393e0eec 100644 --- a/x-pack/plugins/aiops/public/components/log_categorization/log_categorization_for_flyout.tsx +++ b/x-pack/plugins/aiops/public/components/log_categorization/log_categorization_for_flyout.tsx @@ -22,6 +22,7 @@ import { FormattedMessage } from '@kbn/i18n-react'; import { buildEmptyFilter, Filter } from '@kbn/es-query'; import { usePageUrlState } from '@kbn/ml-url-state'; import type { FieldValidationResults } from '@kbn/ml-category-validator'; +import { AIOPS_TELEMETRY_ID } from '../../../common/constants'; import type { Category, SparkLinesPerCategory } from '../../../common/api/log_categorization/types'; @@ -49,6 +50,8 @@ export interface LogCategorizationPageProps { savedSearch: SavedSearch | null; selectedField: DataViewField; onClose: () => void; + /** Identifier to indicate the plugin utilizing the component */ + embeddingOrigin: string; } const BAR_TARGET = 20; @@ -58,6 +61,7 @@ export const LogCategorizationFlyout: FC = ({ savedSearch, selectedField, onClose, + embeddingOrigin, }) => { const { notifications: { toasts }, @@ -151,7 +155,8 @@ export const LogCategorizationFlyout: FC = ({ timeField, earliest, latest, - searchQuery + searchQuery, + { [AIOPS_TELEMETRY_ID.AIOPS_ANALYSIS_RUN_ORIGIN]: embeddingOrigin } ), runCategorizeRequest( index, @@ -193,6 +198,7 @@ export const LogCategorizationFlyout: FC = ({ runCategorizeRequest, intervalMs, toasts, + embeddingOrigin, ]); const onAddFilter = useCallback( diff --git a/x-pack/plugins/aiops/public/components/log_categorization/log_categorization_page.tsx b/x-pack/plugins/aiops/public/components/log_categorization/log_categorization_page.tsx index bfa609bb5dd21..af3a636be27e8 100644 --- a/x-pack/plugins/aiops/public/components/log_categorization/log_categorization_page.tsx +++ b/x-pack/plugins/aiops/public/components/log_categorization/log_categorization_page.tsx @@ -26,6 +26,7 @@ import { FormattedMessage } from '@kbn/i18n-react'; import { usePageUrlState, useUrlState } from '@kbn/ml-url-state'; import type { FieldValidationResults } from '@kbn/ml-category-validator'; import type { SearchQueryLanguage } from '@kbn/ml-query-utils'; +import { AIOPS_TELEMETRY_ID } from '../../../common/constants'; import type { Category, SparkLinesPerCategory } from '../../../common/api/log_categorization/types'; @@ -53,7 +54,12 @@ import { FieldValidationCallout } from './category_validation_callout'; const BAR_TARGET = 20; const DEFAULT_SELECTED_FIELD = 'message'; -export const LogCategorizationPage: FC = () => { +interface LogCategorizationPageProps { + /** Identifier to indicate the plugin utilizing the component */ + embeddingOrigin: string; +} + +export const LogCategorizationPage: FC = ({ embeddingOrigin }) => { const { notifications: { toasts }, } = useAiopsAppContext(); @@ -208,7 +214,10 @@ export const LogCategorizationPage: FC = () => { try { const [validationResult, categorizationResult] = await Promise.all([ - runValidateFieldRequest(index, selectedField, timeField, earliest, latest, searchQuery), + runValidateFieldRequest(index, selectedField, timeField, earliest, latest, searchQuery, { + [AIOPS_TELEMETRY_ID.AIOPS_ANALYSIS_RUN_ORIGIN]: embeddingOrigin, + }), + runCategorizeRequest( index, selectedField, @@ -245,6 +254,7 @@ export const LogCategorizationPage: FC = () => { runCategorizeRequest, intervalMs, toasts, + embeddingOrigin, ]); useEffect( diff --git a/x-pack/plugins/aiops/public/components/log_categorization/show_flyout.tsx b/x-pack/plugins/aiops/public/components/log_categorization/show_flyout.tsx index 5890bd8a2f74d..36606b85a55a7 100644 --- a/x-pack/plugins/aiops/public/components/log_categorization/show_flyout.tsx +++ b/x-pack/plugins/aiops/public/components/log_categorization/show_flyout.tsx @@ -29,7 +29,8 @@ export async function showCategorizeFlyout( field: DataViewField, dataView: DataView, coreStart: CoreStart, - plugins: AiopsPluginStartDeps + plugins: AiopsPluginStartDeps, + originatingApp: string ): Promise { const { http, theme, overlays, application, notifications, uiSettings, i18n } = coreStart; @@ -70,6 +71,7 @@ export async function showCategorizeFlyout( savedSearch={null} selectedField={field} onClose={onFlyoutClose} + embeddingOrigin={originatingApp} /> diff --git a/x-pack/plugins/aiops/public/components/log_categorization/use_validate_category_field.ts b/x-pack/plugins/aiops/public/components/log_categorization/use_validate_category_field.ts index 8e0850aa1daa8..e9587e97b2eca 100644 --- a/x-pack/plugins/aiops/public/components/log_categorization/use_validate_category_field.ts +++ b/x-pack/plugins/aiops/public/components/log_categorization/use_validate_category_field.ts @@ -11,6 +11,8 @@ import type { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/type import type { FieldValidationResults } from '@kbn/ml-category-validator'; +import type { HttpFetchOptions } from '@kbn/core/public'; + import { AIOPS_API_ENDPOINT } from '../../../common/api'; import { createCategorizeQuery } from '../../../common/api/log_categorization/create_categorize_query'; @@ -27,7 +29,8 @@ export function useValidateFieldRequest() { timeField: string, start: number | undefined, end: number | undefined, - queryIn: QueryDslQueryContainer + queryIn: QueryDslQueryContainer, + headers?: HttpFetchOptions['headers'] ) => { const query = createCategorizeQuery(queryIn, timeField, start, end); const resp = await http.post( @@ -48,6 +51,7 @@ export function useValidateFieldRequest() { indicesOptions: undefined, includeExamples: false, }), + headers, version: '1', } ); diff --git a/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_content/log_rate_analysis_content.tsx b/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_content/log_rate_analysis_content.tsx index e27d3af3aefa7..5e2af3d4cb917 100644 --- a/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_content/log_rate_analysis_content.tsx +++ b/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_content/log_rate_analysis_content.tsx @@ -64,6 +64,8 @@ export interface LogRateAnalysisContentProps { barHighlightColorOverride?: string; /** Optional callback that exposes data of the completed analysis */ onAnalysisCompleted?: (d: LogRateAnalysisResultsData) => void; + /** Identifier to indicate the plugin utilizing the component */ + embeddingOrigin: string; } export const LogRateAnalysisContent: FC = ({ @@ -76,6 +78,7 @@ export const LogRateAnalysisContent: FC = ({ barColorOverride, barHighlightColorOverride, onAnalysisCompleted, + embeddingOrigin, }) => { const [windowParameters, setWindowParameters] = useState(); const [initialAnalysisStart, setInitialAnalysisStart] = useState< @@ -172,6 +175,7 @@ export const LogRateAnalysisContent: FC = ({ barColorOverride={barColorOverride} barHighlightColorOverride={barHighlightColorOverride} onAnalysisCompleted={onAnalysisCompleted} + embeddingOrigin={embeddingOrigin} /> )} {windowParameters === undefined && ( diff --git a/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_content/log_rate_analysis_content_wrapper.tsx b/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_content/log_rate_analysis_content_wrapper.tsx index 806dc7f0e2cb2..62fac2312ebfd 100644 --- a/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_content/log_rate_analysis_content_wrapper.tsx +++ b/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_content/log_rate_analysis_content_wrapper.tsx @@ -59,6 +59,8 @@ export interface LogRateAnalysisContentWrapperProps { onAnalysisCompleted?: (d: LogRateAnalysisResultsData) => void; /** Optional flag to indicate whether kibana is running in serverless */ showFrozenDataTierChoice?: boolean; + /** Identifier to indicate the plugin utilizing the component */ + embeddingOrigin: string; } export const LogRateAnalysisContentWrapper: FC = ({ @@ -73,6 +75,7 @@ export const LogRateAnalysisContentWrapper: FC { if (!dataView) return null; @@ -105,6 +108,7 @@ export const LogRateAnalysisContentWrapper: FC diff --git a/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_page.tsx b/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_page.tsx index 3c092f5e91f67..c3d53fb999023 100644 --- a/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_page.tsx +++ b/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_page.tsx @@ -22,6 +22,7 @@ import { getDefaultAiOpsListState, type AiOpsPageUrlState, } from '../../application/utils/url_state'; +import { AIOPS_TELEMETRY_ID } from '../../../common/constants'; import { SearchPanel } from '../search_panel'; import { useLogRateAnalysisResultsTableRowContext } from '../log_rate_analysis_results_table/log_rate_analysis_results_table_row_provider'; @@ -151,6 +152,7 @@ export const LogRateAnalysisPage: FC = ({ stickyHistogram }) => { setGlobalState={setGlobalState} esSearchQuery={searchQuery} stickyHistogram={stickyHistogram} + embeddingOrigin={AIOPS_TELEMETRY_ID.AIOPS_DEFAULT_SOURCE} /> diff --git a/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_results.tsx b/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_results.tsx index a62db054d4d52..40ee98f3234dc 100644 --- a/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_results.tsx +++ b/x-pack/plugins/aiops/public/components/log_rate_analysis/log_rate_analysis_results.tsx @@ -36,6 +36,7 @@ import type { SignificantTerm, SignificantTermGroup } from '@kbn/ml-agg-utils'; import { useAiopsAppContext } from '../../hooks/use_aiops_app_context'; import { initialState, streamReducer } from '../../../common/api/stream_reducer'; import type { AiopsApiLogRateAnalysis } from '../../../common/api'; +import { AIOPS_TELEMETRY_ID } from '../../../common/constants'; import { getGroupTableItems, LogRateAnalysisResultsTable, @@ -113,6 +114,8 @@ interface LogRateAnalysisResultsProps { barHighlightColorOverride?: string; /** Optional callback that exposes data of the completed analysis */ onAnalysisCompleted?: (d: LogRateAnalysisResultsData) => void; + /** Identifier to indicate the plugin utilizing the component */ + embeddingOrigin: string; } export const LogRateAnalysisResults: FC = ({ @@ -129,6 +132,7 @@ export const LogRateAnalysisResults: FC = ({ barColorOverride, barHighlightColorOverride, onAnalysisCompleted, + embeddingOrigin, }) => { const { http } = useAiopsAppContext(); @@ -198,7 +202,8 @@ export const LogRateAnalysisResults: FC = ({ overrides, sampleProbability, }, - { reducer: streamReducer, initialState } + { reducer: streamReducer, initialState }, + { [AIOPS_TELEMETRY_ID.AIOPS_ANALYSIS_RUN_ORIGIN]: embeddingOrigin } ); const { significantTerms } = data; diff --git a/x-pack/plugins/aiops/server/lib/track_route_usage.test.ts b/x-pack/plugins/aiops/server/lib/track_route_usage.test.ts new file mode 100644 index 0000000000000..31e8435e7be3f --- /dev/null +++ b/x-pack/plugins/aiops/server/lib/track_route_usage.test.ts @@ -0,0 +1,32 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ +import { usageCountersServiceMock } from '@kbn/usage-collection-plugin/server/usage_counters/usage_counters_service.mock'; +import { trackAIOpsRouteUsage } from './track_route_usage'; + +describe('trackAIOpsRouteUsage', () => { + it('should call `usageCounter.incrementCounter`', () => { + const mockUsageCountersSetup = usageCountersServiceMock.createSetupContract(); + const mockUsageCounter = mockUsageCountersSetup.createUsageCounter('test'); + + trackAIOpsRouteUsage('test_type', 'test_source', mockUsageCounter); + expect(mockUsageCounter.incrementCounter).toHaveBeenCalledWith({ + counterName: 'test_type', + counterType: 'run_via_test_source', + incrementBy: 1, + }); + }); + + it('should do nothing if no usage counter is provided', () => { + let err; + try { + trackAIOpsRouteUsage('test', undefined); + } catch (e) { + err = e; + } + expect(err).toBeUndefined(); + }); +}); diff --git a/x-pack/plugins/aiops/server/lib/track_route_usage.ts b/x-pack/plugins/aiops/server/lib/track_route_usage.ts new file mode 100644 index 0000000000000..ebea9cd0c24c6 --- /dev/null +++ b/x-pack/plugins/aiops/server/lib/track_route_usage.ts @@ -0,0 +1,22 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { UsageCounter } from '@kbn/usage-collection-plugin/server'; + +export function trackAIOpsRouteUsage( + analysisType: string, + source?: string | string[], + usageCounter?: UsageCounter +) { + if (usageCounter && typeof source === 'string') { + usageCounter.incrementCounter({ + counterName: analysisType, + counterType: `run_via_${source}`, + incrementBy: 1, + }); + } +} diff --git a/x-pack/plugins/aiops/server/plugin.ts b/x-pack/plugins/aiops/server/plugin.ts index 356dfc570e6ef..2adcb2aaaa88b 100755 --- a/x-pack/plugins/aiops/server/plugin.ts +++ b/x-pack/plugins/aiops/server/plugin.ts @@ -9,8 +9,10 @@ import { Subscription } from 'rxjs'; import { PluginInitializerContext, CoreSetup, CoreStart, Plugin, Logger } from '@kbn/core/server'; import type { DataRequestHandlerContext } from '@kbn/data-plugin/server'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; import { CASES_ATTACHMENT_CHANGE_POINT_CHART } from '../common/constants'; +import { PLUGIN_ID } from '../common'; import { isActiveLicense } from './lib/license'; import { AiopsLicense, @@ -28,6 +30,7 @@ export class AiopsPlugin { private readonly logger: Logger; private licenseSubscription: Subscription | null = null; + private usageCounter?: UsageCounter; constructor(initializerContext: PluginInitializerContext) { this.logger = initializerContext.logger.get(); @@ -38,6 +41,7 @@ export class AiopsPlugin plugins: AiopsPluginSetupDeps ) { this.logger.debug('aiops: Setup'); + this.usageCounter = plugins.usageCollection?.createUsageCounter(PLUGIN_ID); // Subscribe to license changes and store the current license in `currentLicense`. // This way we can pass on license changes to the route factory having always @@ -51,8 +55,8 @@ export class AiopsPlugin // Register server side APIs core.getStartServices().then(([coreStart, depsStart]) => { - defineLogRateAnalysisRoute(router, aiopsLicense, this.logger, coreStart); - defineLogCategorizationRoutes(router, aiopsLicense); + defineLogRateAnalysisRoute(router, aiopsLicense, this.logger, coreStart, this.usageCounter); + defineLogCategorizationRoutes(router, aiopsLicense, this.usageCounter); }); if (plugins.cases) { diff --git a/x-pack/plugins/aiops/server/routes/log_categorization.ts b/x-pack/plugins/aiops/server/routes/log_categorization.ts index 9ce8bd3379f0e..dd437f68617ad 100644 --- a/x-pack/plugins/aiops/server/routes/log_categorization.ts +++ b/x-pack/plugins/aiops/server/routes/log_categorization.ts @@ -8,14 +8,18 @@ import type { IRouter } from '@kbn/core/server'; import type { DataRequestHandlerContext } from '@kbn/data-plugin/server'; import { categorizationExamplesProvider } from '@kbn/ml-category-validator'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; import { categorizationFieldValidationSchema } from '../../common/api/log_categorization/schema'; import { AIOPS_API_ENDPOINT } from '../../common/api'; import type { AiopsLicense } from '../types'; import { wrapError } from './error_wrapper'; +import { trackAIOpsRouteUsage } from '../lib/track_route_usage'; +import { AIOPS_TELEMETRY_ID } from '../../common/constants'; export const defineLogCategorizationRoutes = ( router: IRouter, - license: AiopsLicense + license: AiopsLicense, + usageCounter?: UsageCounter ) => { router.versioned .post({ @@ -32,6 +36,13 @@ export const defineLogCategorizationRoutes = ( }, }, async (context, request, response) => { + const { headers } = request; + trackAIOpsRouteUsage( + `POST ${AIOPS_API_ENDPOINT.CATEGORIZATION_FIELD_VALIDATION}`, + headers[AIOPS_TELEMETRY_ID.AIOPS_ANALYSIS_RUN_ORIGIN], + usageCounter + ); + if (!license.isActivePlatinumLicense) { return response.forbidden(); } diff --git a/x-pack/plugins/aiops/server/routes/log_rate_analysis.ts b/x-pack/plugins/aiops/server/routes/log_rate_analysis.ts index f31f6c5f30c35..a9ccce753a02a 100644 --- a/x-pack/plugins/aiops/server/routes/log_rate_analysis.ts +++ b/x-pack/plugins/aiops/server/routes/log_rate_analysis.ts @@ -23,8 +23,9 @@ import type { } from '@kbn/ml-agg-utils'; import { fetchHistogramsForFields } from '@kbn/ml-agg-utils'; import { createExecutionContext } from '@kbn/ml-route-utils'; +import type { UsageCounter } from '@kbn/usage-collection-plugin/server'; -import { RANDOM_SAMPLER_SEED } from '../../common/constants'; +import { RANDOM_SAMPLER_SEED, AIOPS_TELEMETRY_ID } from '../../common/constants'; import { addSignificantTermsAction, addSignificantTermsGroupAction, @@ -52,6 +53,7 @@ import { fetchFrequentItemSets } from './queries/fetch_frequent_item_sets'; import { getHistogramQuery } from './queries/get_histogram_query'; import { getGroupFilter } from './queries/get_group_filter'; import { getSignificantTermGroups } from './queries/get_significant_term_groups'; +import { trackAIOpsRouteUsage } from '../lib/track_route_usage'; // 10s ping frequency to keep the stream alive. const PING_FREQUENCY = 10000; @@ -67,7 +69,8 @@ export const defineLogRateAnalysisRoute = ( router: IRouter, license: AiopsLicense, logger: Logger, - coreStart: CoreStart + coreStart: CoreStart, + usageCounter?: UsageCounter ) => { router.versioned .post({ @@ -85,6 +88,14 @@ export const defineLogRateAnalysisRoute = ( }, }, async (context, request, response) => { + const { headers } = request; + + trackAIOpsRouteUsage( + `POST ${AIOPS_API_ENDPOINT.LOG_RATE_ANALYSIS}`, + headers[AIOPS_TELEMETRY_ID.AIOPS_ANALYSIS_RUN_ORIGIN], + usageCounter + ); + if (!license.isActivePlatinumLicense) { return response.forbidden(); } diff --git a/x-pack/plugins/aiops/server/types.ts b/x-pack/plugins/aiops/server/types.ts index 8359996138dce..562f6f7535b87 100755 --- a/x-pack/plugins/aiops/server/types.ts +++ b/x-pack/plugins/aiops/server/types.ts @@ -8,11 +8,13 @@ import type { PluginSetup, PluginStart } from '@kbn/data-plugin/server'; import type { LicensingPluginStart } from '@kbn/licensing-plugin/server'; import type { CasesSetup } from '@kbn/cases-plugin/server'; +import type { UsageCollectionSetup } from '@kbn/usage-collection-plugin/server'; export interface AiopsPluginSetupDeps { data: PluginSetup; licensing: LicensingPluginStart; cases?: CasesSetup; + usageCollection?: UsageCollectionSetup; } export interface AiopsPluginStartDeps { diff --git a/x-pack/plugins/aiops/tsconfig.json b/x-pack/plugins/aiops/tsconfig.json index 6ee1275439d6e..6303a009bb36d 100644 --- a/x-pack/plugins/aiops/tsconfig.json +++ b/x-pack/plugins/aiops/tsconfig.json @@ -63,6 +63,7 @@ "@kbn/core-lifecycle-browser", "@kbn/cases-plugin", "@kbn/react-kibana-mount", + "@kbn/usage-collection-plugin", ], "exclude": [ "target/**/*", diff --git a/x-pack/plugins/infra/public/alerting/log_threshold/components/alert_details_app_section/components/log_rate_analysis.tsx b/x-pack/plugins/infra/public/alerting/log_threshold/components/alert_details_app_section/components/log_rate_analysis.tsx index 8dc2688956a49..8ffb0cc87a1d9 100644 --- a/x-pack/plugins/infra/public/alerting/log_threshold/components/alert_details_app_section/components/log_rate_analysis.tsx +++ b/x-pack/plugins/infra/public/alerting/log_threshold/components/alert_details_app_section/components/log_rate_analysis.tsx @@ -268,6 +268,7 @@ export const LogRateAnalysis: FC = ({ r
    Date: Fri, 29 Sep 2023 12:15:56 -0400 Subject: [PATCH 3/7] skip failing test suite (#167621) --- .../apps/observability_log_explorer/dataset_selector.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/test/functional/apps/observability_log_explorer/dataset_selector.ts b/x-pack/test/functional/apps/observability_log_explorer/dataset_selector.ts index d7d63384eec29..b630cfea6ba4d 100644 --- a/x-pack/test/functional/apps/observability_log_explorer/dataset_selector.ts +++ b/x-pack/test/functional/apps/observability_log_explorer/dataset_selector.ts @@ -30,7 +30,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { const noIntegrationsTitle = 'No integrations found'; const noUncategorizedTitle = 'No data streams found'; - describe('Dataset Selector', () => { + // Failing: See https://github.com/elastic/kibana/issues/167621 + describe.skip('Dataset Selector', () => { before(async () => { await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover'); await PageObjects.observabilityLogExplorer.removeInstalledPackages(); From ee1f448d64f9788afba872e12dbfb62064510a28 Mon Sep 17 00:00:00 2001 From: Bryce Buchanan <75274611+bryce-b@users.noreply.github.com> Date: Fri, 29 Sep 2023 09:16:29 -0700 Subject: [PATCH 4/7] Changed mobile badge from 'technical preview' to 'beta' (#167543) ## Summary The Mobile product is moving from technical preview to beta. This change reflects that in the UI. Before: Screenshot 2023-09-25 at 4 15 13 PM After: Screenshot 2023-09-25 at 4 02 50 PM Screenshot 2023-09-25 at 4 04 54 PM --- .../routing/templates/mobile_service_template/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/apm/public/components/routing/templates/mobile_service_template/index.tsx b/x-pack/plugins/apm/public/components/routing/templates/mobile_service_template/index.tsx index cc841b200a5b5..acddb4677bf07 100644 --- a/x-pack/plugins/apm/public/components/routing/templates/mobile_service_template/index.tsx +++ b/x-pack/plugins/apm/public/components/routing/templates/mobile_service_template/index.tsx @@ -24,6 +24,7 @@ import { useTimeRange } from '../../../../hooks/use_time_range'; import { getAlertingCapabilities } from '../../../alerting/utils/get_alerting_capabilities'; import { MobileSearchBar } from '../../../app/mobile/search_bar'; import { ServiceIcons } from '../../../shared/service_icons'; +import { BetaBadge } from '../../../shared/beta_badge'; import { TechnicalPreviewBadge } from '../../../shared/technical_preview_badge'; import { ApmMainTemplate } from '../apm_main_template'; import { AnalyzeDataButton } from '../apm_service_template/analyze_data_button'; @@ -122,7 +123,7 @@ function TemplateWithContext({ /> - + From 772739ab4034a70ef0f503c6dfe05fba368a04fe Mon Sep 17 00:00:00 2001 From: Dima Arnautov Date: Fri, 29 Sep 2023 18:24:10 +0200 Subject: [PATCH 5/7] [ML] AIOps: Additional props for Change Point embeddable (#167606) --- ...mbeddable_change_point_chart_component.tsx | 13 ++++++ .../embeddable_chart_component_wrapper.tsx | 42 +++++++++++++++++-- x-pack/plugins/aiops/public/types.ts | 6 +-- .../components/alert_details_app_section.tsx | 26 ++++++------ 4 files changed, 67 insertions(+), 20 deletions(-) diff --git a/x-pack/plugins/aiops/public/embeddable/embeddable_change_point_chart_component.tsx b/x-pack/plugins/aiops/public/embeddable/embeddable_change_point_chart_component.tsx index d7d1c84cf9f10..034450735cb09 100644 --- a/x-pack/plugins/aiops/public/embeddable/embeddable_change_point_chart_component.tsx +++ b/x-pack/plugins/aiops/public/embeddable/embeddable_change_point_chart_component.tsx @@ -18,6 +18,7 @@ import { EuiLoadingChart } from '@elastic/eui'; import { EMBEDDABLE_CHANGE_POINT_CHART_TYPE } from '../../common/constants'; import type { AiopsPluginStartDeps } from '../types'; import type { EmbeddableChangePointChartInput } from './embeddable_change_point_chart'; +import type { ChangePointAnnotation } from '../components/change_point_detection/change_point_detection_context'; export interface EmbeddableChangePointChartProps { dataViewId: string; @@ -27,6 +28,18 @@ export interface EmbeddableChangePointChartProps { splitField?: string; partitions?: string[]; maxSeriesToPlot?: number; + /** + * Component to render if there are no change points found + */ + emptyState?: React.ReactElement; + /** + * Outputs the most recent change point data + */ + onChange?: (changePointData: ChangePointAnnotation[]) => void; + /** + * Last reload request time, can be used for manual reload + */ + lastReloadRequestTime?: number; } export function getEmbeddableChangePointChart(core: CoreStart, plugins: AiopsPluginStartDeps) { diff --git a/x-pack/plugins/aiops/public/embeddable/embeddable_chart_component_wrapper.tsx b/x-pack/plugins/aiops/public/embeddable/embeddable_chart_component_wrapper.tsx index 54ed702eadf63..2bace3b693853 100644 --- a/x-pack/plugins/aiops/public/embeddable/embeddable_chart_component_wrapper.tsx +++ b/x-pack/plugins/aiops/public/embeddable/embeddable_chart_component_wrapper.tsx @@ -5,8 +5,9 @@ * 2.0. */ -import { type Observable } from 'rxjs'; -import React, { FC, useEffect, useMemo } from 'react'; +import { BehaviorSubject, type Observable, combineLatest } from 'rxjs'; +import { map, distinctUntilChanged } from 'rxjs/operators'; +import React, { FC, useEffect, useMemo, useState } from 'react'; import { useTimefilter } from '@kbn/ml-date-picker'; import { css } from '@emotion/react'; import useObservable from 'react-use/lib/useObservable'; @@ -55,8 +56,31 @@ export const EmbeddableInputTracker: FC = ({ }) => { const input = useObservable(input$, initialInput); + const [manualReload$] = useState>( + new BehaviorSubject(initialInput.lastReloadRequestTime ?? Date.now()) + ); + + useEffect( + function updateManualReloadSubject() { + if ( + input.lastReloadRequestTime === initialInput.lastReloadRequestTime || + !input.lastReloadRequestTime + ) + return; + manualReload$.next(input.lastReloadRequestTime); + }, + [input.lastReloadRequestTime, initialInput.lastReloadRequestTime, manualReload$] + ); + + const resultObservable$ = useMemo>(() => { + return combineLatest([reload$, manualReload$]).pipe( + map(([reload, manualReload]) => Math.max(reload, manualReload)), + distinctUntilChanged() + ); + }, [manualReload$, reload$]); + return ( - + = ({ onLoading={onLoading} onRenderComplete={onRenderComplete} onError={onError} + onChange={input.onChange} + emptyState={input.emptyState} /> @@ -103,6 +129,8 @@ export const ChartGridEmbeddableWrapper: FC< onError, onLoading, onRenderComplete, + onChange, + emptyState, }) => { const { filters, query, timeRange } = useFilerQueryUpdates(); @@ -189,8 +217,12 @@ export const ChartGridEmbeddableWrapper: FC< resultChangePoints = resultChangePoints.slice(0, maxSeriesToPlot); } + if (onChange) { + onChange(resultChangePoints); + } + return resultChangePoints; - }, [results, maxSeriesToPlot]); + }, [results, maxSeriesToPlot, onChange]); return (
    + ) : emptyState ? ( + emptyState ) : ( )} diff --git a/x-pack/plugins/aiops/public/types.ts b/x-pack/plugins/aiops/public/types.ts index 9c28951c25c99..e0f86c68864bd 100755 --- a/x-pack/plugins/aiops/public/types.ts +++ b/x-pack/plugins/aiops/public/types.ts @@ -17,8 +17,8 @@ import type { UiActionsStart, UiActionsSetup } from '@kbn/ui-actions-plugin/publ import type { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public'; import type { EmbeddableSetup, EmbeddableStart } from '@kbn/embeddable-plugin/public'; import type { CasesUiSetup } from '@kbn/cases-plugin/public'; -import { LicensingPluginSetup } from '@kbn/licensing-plugin/public'; -import type { EmbeddableChangePointChartProps } from './embeddable'; +import type { LicensingPluginSetup } from '@kbn/licensing-plugin/public'; +import type { EmbeddableChangePointChartInput } from './embeddable/embeddable_change_point_chart'; export interface AiopsPluginSetupDeps { embeddable: EmbeddableSetup; @@ -44,5 +44,5 @@ export interface AiopsPluginStartDeps { export type AiopsPluginSetup = void; export interface AiopsPluginStart { - EmbeddableChangePointChart: React.ComponentType; + EmbeddableChangePointChart: React.ComponentType; } diff --git a/x-pack/plugins/observability/public/components/custom_threshold/components/alert_details_app_section.tsx b/x-pack/plugins/observability/public/components/custom_threshold/components/alert_details_app_section.tsx index ecb31f4a49b4b..cf728d73aef4e 100644 --- a/x-pack/plugins/observability/public/components/custom_threshold/components/alert_details_app_section.tsx +++ b/x-pack/plugins/observability/public/components/custom_threshold/components/alert_details_app_section.tsx @@ -213,19 +213,19 @@ export default function AlertDetailsAppSection({ {ruleParams.criteria.map((criterion, criterionIndex) => - criterion.metrics?.map( - (metric, metricIndex) => - dataView && - dataView.id && ( - - ) - ) + criterion.metrics?.map((metric, metricIndex) => { + const id = `embeddableChart-criterion${criterionIndex}-metric${metricIndex}`; + return dataView?.id ? ( + + ) : null; + }) )} From e1a280f6026b1ef69c571d12caec61f2d371b41c Mon Sep 17 00:00:00 2001 From: Khristinin Nikita Date: Fri, 29 Sep 2023 18:54:31 +0200 Subject: [PATCH 6/7] Show old risk scores (#167235) ## Use legacy risk score indices if the new risks engine wasn't installed Legacy risk scores indices: - `ml_user_risk_score_latest_default` - `ml_host_risk_score_latest_default` New risk score indices: - `risk-score.risk-score-latest-default` Which parts use risk score indices? - Entity Analytics dashboard - All host/user risk tab - Single host/user risk tab - Alert enrichment UI - Alert enrichment Backend All these components can use only one risk score data source at a time, a new or legacy one. Previously we started to use the new risk score indices if FF - `['riskScoringPersistence', 'riskScoringRoutesEnabled'] ` was present and there was no possibility for the client to see old risk score data in UI, or use it for alert enrichments This PR, changes the way, that clients will use legacy risk score indices until they specifically choose to upgrade the risk engine. In this video legacy risk transforms are installed, but user risk transforms are not installed. https://github.com/elastic/kibana/assets/7609147/16acf38a-5694-4706-9426-cdea58b70a9b ### Cypress tests I modify those tests in a way that we test that it works still with legacy risk scores, but also with new risk scores. Also, add some tests for upgrade workflow. Also, some risk scores a different in legacy and new indices for the same entities. So we can show in the tests, that they use different indices. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> --- .../common/api/search_strategy/hosts/all.ts | 2 +- .../related_entities/related_hosts.ts | 2 +- .../related_entities/related_users.ts | 2 +- .../common/api/search_strategy/users/all.ts | 2 +- .../risk_score/common/index.ts | 8 +- .../related_entities/related_hosts/index.tsx | 9 +- .../related_entities/related_users/index.tsx | 8 +- .../api/hooks/use_risk_engine_status.ts | 23 +- .../components/risk_score_update_panel.tsx | 28 +- .../public/entity_analytics/translations.ts | 5 +- .../risk_score/enable_risk_score/index.tsx | 24 +- .../risk_details_tab_body/index.tsx | 10 +- .../risk_score_enable_button.tsx | 1 + .../risk_score_no_data_detected.tsx | 6 +- .../risk_score_upgrade_button.test.tsx | 122 ---- .../risk_score_upgrade_button.tsx | 127 ---- .../containers/risk_score/all/index.tsx | 12 +- .../containers/risk_score/kpi/index.tsx | 8 +- .../explore/hosts/containers/hosts/index.tsx | 8 +- .../navigation/host_risk_score_tab_body.tsx | 37 +- .../navigation/all_users_query_tab_body.tsx | 8 +- .../navigation/user_risk_score_tab_body.tsx | 37 +- .../entity_analytics/risk_score/index.tsx | 7 - .../enrichment_by_type/host_risk.ts | 8 +- .../enrichment_by_type/user_risk.ts | 8 +- .../rule_types/utils/enrichments/index.ts | 17 +- .../rule_types/utils/enrichments/types.ts | 4 +- .../factory/hosts/all/__mocks__/index.ts | 2 +- .../factory/hosts/all/index.ts | 10 +- .../related_hosts/__mocks__/index.ts | 2 +- .../related_entities/related_hosts/index.ts | 6 +- .../related_users/__mocks__/index.ts | 2 +- .../related_entities/related_users/index.ts | 6 +- .../factory/users/all/__mocks__/index.ts | 2 +- .../factory/users/all/index.ts | 10 +- .../translations/translations/fr-FR.json | 3 - .../translations/translations/ja-JP.json | 3 - .../translations/translations/zh-CN.json | 3 - .../test/security_solution_cypress/config.ts | 2 + .../e2e/detection_alerts/enrichments.cy.ts | 122 ++-- .../entity_analytics_management_page.cy.ts | 15 +- .../dashboards/enable_risk_score.cy.ts | 125 ---- .../enable_risk_score_redirect.cy.ts | 53 ++ .../explore/dashboards/entity_analytics.cy.ts | 546 +++++++++++++----- .../dashboards/upgrade_risk_score.cy.ts | 208 ++----- .../e2e/explore/host_details/risk_tab.cy.ts | 101 +++- .../e2e/explore/hosts/host_risk_tab.cy.ts | 129 +++-- .../e2e/explore/hosts/hosts_risk_column.cy.ts | 61 +- .../cypress/screens/entity_analytics.ts | 8 + .../screens/entity_analytics_management.ts | 2 +- .../cypress/screens/users/user_risk_score.ts | 3 + .../cypress/tasks/api_calls/risk_engine.ts | 2 +- .../cypress/tasks/entity_analytics.ts | 23 +- .../cypress/tasks/host_risk.ts | 2 +- .../cypress/tasks/risk_scores/index.ts | 12 +- .../cypress/tasks/user_risk.ts | 21 + .../es_archives/query_alert/data.json | 3 + .../es_archives/risk_scores_new/data.json | 485 ++++++++++++++++ .../es_archives/risk_scores_new/mappings.json | 135 +++++ .../risk_scores_new_no_data/data.json | 0 .../risk_scores_new_no_data/mappings.json | 136 +++++ .../risk_scores_new_updated/data.json | 67 +++ .../risk_scores_new_updated/mappings.json | 136 +++++ .../serverless_config.ts | 4 + 64 files changed, 2004 insertions(+), 979 deletions(-) delete mode 100644 x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_upgrade_button.test.tsx delete mode 100644 x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_upgrade_button.tsx delete mode 100644 x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/enable_risk_score.cy.ts create mode 100644 x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/enable_risk_score_redirect.cy.ts create mode 100644 x-pack/test/security_solution_cypress/cypress/tasks/user_risk.ts create mode 100644 x-pack/test/security_solution_cypress/es_archives/risk_scores_new/data.json create mode 100644 x-pack/test/security_solution_cypress/es_archives/risk_scores_new/mappings.json create mode 100644 x-pack/test/security_solution_cypress/es_archives/risk_scores_new_no_data/data.json create mode 100644 x-pack/test/security_solution_cypress/es_archives/risk_scores_new_no_data/mappings.json create mode 100644 x-pack/test/security_solution_cypress/es_archives/risk_scores_new_updated/data.json create mode 100644 x-pack/test/security_solution_cypress/es_archives/risk_scores_new_updated/mappings.json diff --git a/x-pack/plugins/security_solution/common/api/search_strategy/hosts/all.ts b/x-pack/plugins/security_solution/common/api/search_strategy/hosts/all.ts index b79c4b3afe93d..fdc2e992a20a1 100644 --- a/x-pack/plugins/security_solution/common/api/search_strategy/hosts/all.ts +++ b/x-pack/plugins/security_solution/common/api/search_strategy/hosts/all.ts @@ -16,7 +16,7 @@ export const allHostsSchema = requestBasicOptionsSchema.extend({ sort, pagination, timerange, - isNewRiskScoreModuleAvailable: z.boolean().default(false), + isNewRiskScoreModuleInstalled: z.boolean().default(false), factoryQueryType: z.literal(HostsQueries.hosts), }); diff --git a/x-pack/plugins/security_solution/common/api/search_strategy/related_entities/related_hosts.ts b/x-pack/plugins/security_solution/common/api/search_strategy/related_entities/related_hosts.ts index 0db0effe8e3b1..ffb7946f59e47 100644 --- a/x-pack/plugins/security_solution/common/api/search_strategy/related_entities/related_hosts.ts +++ b/x-pack/plugins/security_solution/common/api/search_strategy/related_entities/related_hosts.ts @@ -15,7 +15,7 @@ export const relatedHostsRequestOptionsSchema = requestBasicOptionsSchema.extend skip: z.boolean().optional(), from: z.string(), inspect, - isNewRiskScoreModuleAvailable: z.boolean().default(false), + isNewRiskScoreModuleInstalled: z.boolean().default(false), factoryQueryType: z.literal(RelatedEntitiesQueries.relatedHosts), }); diff --git a/x-pack/plugins/security_solution/common/api/search_strategy/related_entities/related_users.ts b/x-pack/plugins/security_solution/common/api/search_strategy/related_entities/related_users.ts index f1386591836ba..aeeedf0a0eaa0 100644 --- a/x-pack/plugins/security_solution/common/api/search_strategy/related_entities/related_users.ts +++ b/x-pack/plugins/security_solution/common/api/search_strategy/related_entities/related_users.ts @@ -15,7 +15,7 @@ export const relatedUsersRequestOptionsSchema = requestBasicOptionsSchema.extend skip: z.boolean().optional(), from: z.string(), inspect, - isNewRiskScoreModuleAvailable: z.boolean().default(false), + isNewRiskScoreModuleInstalled: z.boolean().default(false), factoryQueryType: z.literal(RelatedEntitiesQueries.relatedUsers), }); diff --git a/x-pack/plugins/security_solution/common/api/search_strategy/users/all.ts b/x-pack/plugins/security_solution/common/api/search_strategy/users/all.ts index 433c0ca7259cc..94ba9de7093cd 100644 --- a/x-pack/plugins/security_solution/common/api/search_strategy/users/all.ts +++ b/x-pack/plugins/security_solution/common/api/search_strategy/users/all.ts @@ -22,7 +22,7 @@ export const usersSchema = requestOptionsPaginatedSchema.extend({ field: z.enum([UsersFields.name, UsersFields.lastSeen]), }), timerange, - isNewRiskScoreModuleAvailable: z.boolean().default(false), + isNewRiskScoreModuleInstalled: z.boolean().default(false), factoryQueryType: z.literal(UsersQueries.users), }); diff --git a/x-pack/plugins/security_solution/common/search_strategy/security_solution/risk_score/common/index.ts b/x-pack/plugins/security_solution/common/search_strategy/security_solution/risk_score/common/index.ts index 1353ec7dd14bd..1bf6ef39097d3 100644 --- a/x-pack/plugins/security_solution/common/search_strategy/security_solution/risk_score/common/index.ts +++ b/x-pack/plugins/security_solution/common/search_strategy/security_solution/risk_score/common/index.ts @@ -17,9 +17,9 @@ export { RiskQueries } from '../../../../api/search_strategy'; export const getHostRiskIndex = ( spaceId: string, onlyLatest: boolean = true, - isNewRiskScoreModuleAvailable: boolean + isNewRiskScoreModuleInstalled: boolean ): string => { - return isNewRiskScoreModuleAvailable + return isNewRiskScoreModuleInstalled ? getRiskScoreLatestIndex(spaceId) : `${RISKY_HOSTS_INDEX_PREFIX}${onlyLatest ? 'latest_' : ''}${spaceId}`; }; @@ -27,9 +27,9 @@ export const getHostRiskIndex = ( export const getUserRiskIndex = ( spaceId: string, onlyLatest: boolean = true, - isNewRiskScoreModuleAvailable: boolean + isNewRiskScoreModuleInstalled: boolean ): string => { - return isNewRiskScoreModuleAvailable + return isNewRiskScoreModuleInstalled ? getRiskScoreLatestIndex(spaceId) : `${RISKY_USERS_INDEX_PREFIX}${onlyLatest ? 'latest_' : ''}${spaceId}`; }; diff --git a/x-pack/plugins/security_solution/public/common/containers/related_entities/related_hosts/index.tsx b/x-pack/plugins/security_solution/public/common/containers/related_entities/related_hosts/index.tsx index 9ad0d13c92d6a..807e8a5d3fdd3 100644 --- a/x-pack/plugins/security_solution/public/common/containers/related_entities/related_hosts/index.tsx +++ b/x-pack/plugins/security_solution/public/common/containers/related_entities/related_hosts/index.tsx @@ -12,7 +12,7 @@ import { RelatedEntitiesQueries } from '../../../../../common/search_strategy/se import type { RelatedHost } from '../../../../../common/search_strategy/security_solution/related_entities/related_hosts'; import { useSearchStrategy } from '../../use_search_strategy'; import { FAIL_RELATED_HOSTS } from './translations'; -import { useIsExperimentalFeatureEnabled } from '../../../hooks/use_experimental_features'; +import { useIsNewRiskScoreModuleInstalled } from '../../../../entity_analytics/api/hooks/use_risk_engine_status'; export interface UseUserRelatedHostsResult { inspect: InspectResponse; @@ -50,7 +50,8 @@ export const useUserRelatedHosts = ({ errorMessage: FAIL_RELATED_HOSTS, abort: skip, }); - const isNewRiskScoreModuleAvailable = useIsExperimentalFeatureEnabled('riskScoringRoutesEnabled'); + + const isNewRiskScoreModuleInstalled = useIsNewRiskScoreModuleInstalled(); const userRelatedHostsResponse = useMemo( () => ({ @@ -69,9 +70,9 @@ export const useUserRelatedHosts = ({ factoryQueryType: RelatedEntitiesQueries.relatedHosts, userName, from, - isNewRiskScoreModuleAvailable, + isNewRiskScoreModuleInstalled, }), - [indexNames, from, userName, isNewRiskScoreModuleAvailable] + [indexNames, from, userName, isNewRiskScoreModuleInstalled] ); useEffect(() => { diff --git a/x-pack/plugins/security_solution/public/common/containers/related_entities/related_users/index.tsx b/x-pack/plugins/security_solution/public/common/containers/related_entities/related_users/index.tsx index 6184f1bebc51c..736839a5c0d1b 100644 --- a/x-pack/plugins/security_solution/public/common/containers/related_entities/related_users/index.tsx +++ b/x-pack/plugins/security_solution/public/common/containers/related_entities/related_users/index.tsx @@ -12,7 +12,7 @@ import { RelatedEntitiesQueries } from '../../../../../common/search_strategy/se import type { RelatedUser } from '../../../../../common/search_strategy/security_solution/related_entities/related_users'; import { useSearchStrategy } from '../../use_search_strategy'; import { FAIL_RELATED_USERS } from './translations'; -import { useIsExperimentalFeatureEnabled } from '../../../hooks/use_experimental_features'; +import { useIsNewRiskScoreModuleInstalled } from '../../../../entity_analytics/api/hooks/use_risk_engine_status'; export interface UseHostRelatedUsersResult { inspect: InspectResponse; @@ -35,7 +35,7 @@ export const useHostRelatedUsers = ({ from, skip = false, }: UseHostRelatedUsersParam): UseHostRelatedUsersResult => { - const isNewRiskScoreModuleAvailable = useIsExperimentalFeatureEnabled('riskScoringRoutesEnabled'); + const isNewRiskScoreModuleInstalled = useIsNewRiskScoreModuleInstalled(); const { loading, result: response, @@ -69,9 +69,9 @@ export const useHostRelatedUsers = ({ factoryQueryType: RelatedEntitiesQueries.relatedUsers, hostName, from, - isNewRiskScoreModuleAvailable, + isNewRiskScoreModuleInstalled, }), - [indexNames, from, hostName, isNewRiskScoreModuleAvailable] + [indexNames, from, hostName, isNewRiskScoreModuleInstalled] ); useEffect(() => { diff --git a/x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_engine_status.ts b/x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_engine_status.ts index 981fc29d8f702..504ed59a40423 100644 --- a/x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_engine_status.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/api/hooks/use_risk_engine_status.ts @@ -21,19 +21,36 @@ export const useInvalidateRiskEngineStatusQuery = () => { }, [queryClient]); }; +export const useIsNewRiskScoreModuleInstalled = () => { + const { data: riskEngineStatus } = useRiskEngineStatus(); + + return riskEngineStatus?.isNewRiskScoreModuleInstalled ?? false; +}; + export const useRiskEngineStatus = () => { - const isRiskEngineEnabled = useIsExperimentalFeatureEnabled('riskScoringRoutesEnabled'); + const isNewRiskScoreModuleAvailable = useIsExperimentalFeatureEnabled('riskScoringRoutesEnabled'); return useQuery(FETCH_RISK_ENGINE_STATUS, async ({ signal }) => { - if (!isRiskEngineEnabled) { - return null; + if (!isNewRiskScoreModuleAvailable) { + return { + isUpdateAvailable: false, + isNewRiskScoreModuleInstalled: false, + isNewRiskScoreModuleAvailable, + risk_engine_status: null, + legacy_risk_engine_status: null, + is_max_amount_of_risk_engines_reached: false, + }; } const response = await fetchRiskEngineStatus({ signal }); const isUpdateAvailable = response?.legacy_risk_engine_status === RiskEngineStatus.ENABLED && response.risk_engine_status === RiskEngineStatus.NOT_INSTALLED; + const isNewRiskScoreModuleInstalled = + response.risk_engine_status !== RiskEngineStatus.NOT_INSTALLED; return { isUpdateAvailable, + isNewRiskScoreModuleInstalled, + isNewRiskScoreModuleAvailable, ...response, }; }); diff --git a/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_update_panel.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_update_panel.tsx index 13668bc595ad8..37baf3c6c97cd 100644 --- a/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_update_panel.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/risk_score_update_panel.tsx @@ -13,18 +13,22 @@ import { SecurityPageName } from '../../../common/constants'; export const RiskScoreUpdatePanel = () => { return ( - - {i18n.UPDATE_PANEL_MESSAGE} + <> + + {i18n.UPDATE_PANEL_MESSAGE} + + + + {i18n.UPDATE_PANEL_GO_TO_MANAGE} + + + - - - {i18n.UPDATE_PANEL_GO_TO_MANAGE} - - - + ); }; diff --git a/x-pack/plugins/security_solution/public/entity_analytics/translations.ts b/x-pack/plugins/security_solution/public/entity_analytics/translations.ts index 837de7ca493fd..5cb9bca580269 100644 --- a/x-pack/plugins/security_solution/public/entity_analytics/translations.ts +++ b/x-pack/plugins/security_solution/public/entity_analytics/translations.ts @@ -170,14 +170,15 @@ export const UPDATE_RISK_ENGINE_MODAL_EXISTING_USER_HOST_2 = i18n.translate( export const UPDATE_RISK_ENGINE_MODAL_EXISTING_DATA_1 = i18n.translate( 'xpack.securitySolution.riskScore.updateRiskEngineModal.existingData_1', { - defaultMessage: 'None of your risk score data will be deleted', + defaultMessage: 'Legacy risk score data will not be deleted', } ); export const UPDATE_RISK_ENGINE_MODAL_EXISTING_DATA_2 = i18n.translate( 'xpack.securitySolution.riskScore.updateRiskEngineModal.existingData_2', { - defaultMessage: ', you will need to remove any old risk score data manually.', + defaultMessage: + ', it will still exist in the index but will no longer be available in the user interface. You will need to remove legacy risk score data manually.', } ); diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/enable_risk_score/index.tsx b/x-pack/plugins/security_solution/public/explore/components/risk_score/enable_risk_score/index.tsx index 864d1458eda86..4f8b12db74c9c 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/enable_risk_score/index.tsx +++ b/x-pack/plugins/security_solution/public/explore/components/risk_score/enable_risk_score/index.tsx @@ -6,7 +6,6 @@ */ import { EuiEmptyPrompt, EuiPanel, EuiToolTip } from '@elastic/eui'; import React from 'react'; -import { RiskScoreUpgradeButton } from '../risk_score_onboarding/risk_score_upgrade_button'; import type { RiskScoreEntity } from '../../../../../common/search_strategy'; import { useCheckSignalIndex } from '../../../../detections/containers/detection_engine/alerts/use_check_signal_index'; import type { inputsModel } from '../../../../common/store'; @@ -64,23 +63,12 @@ const EnableRiskScoreComponent = ({ } actions={ - {isDeprecated ? ( - - ) : ( - - )} + } /> diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_details_tab_body/index.tsx b/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_details_tab_body/index.tsx index cdff32acef9fd..208fd950315e4 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_details_tab_body/index.tsx +++ b/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_details_tab_body/index.tsx @@ -36,7 +36,7 @@ import { useDashboardHref } from '../../../../common/hooks/use_dashboard_href'; import { RiskScoresNoDataDetected } from '../risk_score_onboarding/risk_score_no_data_detected'; import { useRiskEngineStatus } from '../../../../entity_analytics/api/hooks/use_risk_engine_status'; import { RiskScoreUpdatePanel } from '../../../../entity_analytics/components/risk_score_update_panel'; -import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features'; + const StyledEuiFlexGroup = styled(EuiFlexGroup)` margin-top: ${({ theme }) => theme.eui.euiSizeL}; `; @@ -59,7 +59,6 @@ const RiskDetailsTabBodyComponent: React.FC< : UserRiskScoreQueryId.USER_DETAILS_RISK_SCORE, [riskEntity] ); - const isNewRiskScoreModuleAvailable = useIsExperimentalFeatureEnabled('riskScoringRoutesEnabled'); const severitySelectionRedux = useDeepEqualSelector((state: State) => riskEntity === RiskScoreEntity.host @@ -135,10 +134,6 @@ const RiskDetailsTabBodyComponent: React.FC< isDeprecated: isDeprecated && !loading, }; - if (riskScoreEngineStatus?.isUpdateAvailable) { - return ; - } - if (status.isDisabled || status.isDeprecated) { return ( - {isNewRiskScoreModuleAvailable ? ( + {riskScoreEngineStatus?.isUpdateAvailable && } + {riskScoreEngineStatus?.isNewRiskScoreModuleInstalled ? ( {data?.[0] && ( diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_enable_button.tsx b/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_enable_button.tsx index 208d9a2c52a2b..6e84308911edd 100644 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_enable_button.tsx +++ b/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_enable_button.tsx @@ -74,6 +74,7 @@ const RiskScoreEnableButtonComponent = ({ color="primary" fill deepLinkId={SecurityPageName.entityAnalyticsManagement} + data-test-subj={`enable_${riskScoreEntity}_risk_score`} > { - const isNewRiskScoreModuleAvailable = useIsExperimentalFeatureEnabled('riskScoringRoutesEnabled'); + const isNewRiskScoreModuleInstalled = useIsNewRiskScoreModuleInstalled(); const translations = useMemo( () => ({ @@ -51,7 +51,7 @@ const RiskScoresNoDataDetectedComponent = ({ body={translations.body} actions={ <> - {!isNewRiskScoreModuleAvailable && ( + {!isNewRiskScoreModuleInstalled && ( diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_upgrade_button.test.tsx b/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_upgrade_button.test.tsx deleted file mode 100644 index 41032690fdfd0..0000000000000 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_upgrade_button.test.tsx +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ -import { act, render, screen, waitFor } from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; -import React from 'react'; -import { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { TestProviders } from '../../../../common/mock'; -import { RiskScoreUpgradeButton } from './risk_score_upgrade_button'; -import { upgradeHostRiskScoreModule, upgradeUserRiskScoreModule } from './utils'; - -jest.mock('./utils'); - -describe('RiskScoreUpgradeButton', () => { - const mockRefetch = jest.fn(); - const timerange = { - from: 'mockStartDate', - to: 'mockEndDate', - }; - const hostTestProps = { - refetch: mockRefetch, - riskScoreEntity: RiskScoreEntity.host, - timerange, - title: 'upgrade', - }; - const userTestProps = { - refetch: mockRefetch, - riskScoreEntity: RiskScoreEntity.user, - timerange, - title: 'upgrade', - }; - - beforeEach(() => { - jest.clearAllMocks(); - }); - - describe.each([ - [RiskScoreEntity.host, hostTestProps], - [RiskScoreEntity.user, userTestProps], - ])('%s', (riskScoreEntity, testProps) => { - it('Renders expected children', () => { - render( - - - - ); - - expect(screen.getByTestId(`${riskScoreEntity}-risk-score-upgrade`)).toBeInTheDocument(); - expect(screen.getByTestId(`${riskScoreEntity}-risk-score-upgrade`)).toHaveTextContent( - testProps.title - ); - }); - - it('Triggers the confirmation modal before upgrading', async () => { - render( - - - - ); - - await act(async () => { - await userEvent.click(screen.getByTestId(`${riskScoreEntity}-risk-score-upgrade`)); - }); - - expect( - screen.getByTestId(`${riskScoreEntity}-risk-score-upgrade-confirmation-modal`) - ).toBeInTheDocument(); - await act(async () => { - await userEvent.click(screen.getByText('Erase data and Upgrade')); - }); - - expect( - screen.queryByTestId(`${riskScoreEntity}-risk-score-upgrade-confirmation-modal`) - ).not.toBeInTheDocument(); - - if (riskScoreEntity === RiskScoreEntity.user) { - expect(upgradeUserRiskScoreModule).toHaveBeenCalled(); - expect(upgradeHostRiskScoreModule).not.toHaveBeenCalled(); - } else { - expect(upgradeUserRiskScoreModule).not.toHaveBeenCalled(); - expect(upgradeHostRiskScoreModule).toHaveBeenCalled(); - } - }); - - it('Shows doc link in the confirmation modal', async () => { - render( - - - - ); - - await act(async () => { - await userEvent.click(screen.getByTestId(`${riskScoreEntity}-risk-score-upgrade`)); - }); - - expect(screen.getByText('Preserve data')).toHaveProperty( - 'href', - `https://www.elastic.co/guide/en/security/current/${riskScoreEntity}-risk-score.html` - ); - }); - - it('Update button state while upgrading', async () => { - render( - - - - ); - - userEvent.click(screen.getByTestId(`${riskScoreEntity}-risk-score-upgrade`)); - userEvent.click(screen.getByText('Erase data and Upgrade')); - await waitFor(() => { - expect(screen.getByTestId(`${riskScoreEntity}-risk-score-upgrade`)).toHaveProperty( - 'disabled', - true - ); - }); - }); - }); -}); diff --git a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_upgrade_button.tsx b/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_upgrade_button.tsx deleted file mode 100644 index a08710a17ed2d..0000000000000 --- a/x-pack/plugins/security_solution/public/explore/components/risk_score/risk_score_onboarding/risk_score_upgrade_button.tsx +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { EuiButton, EuiConfirmModal } from '@elastic/eui'; -import React, { useCallback, useState } from 'react'; -import { FormattedMessage } from '@kbn/i18n-react'; -import { useSpaceId } from '../../../../common/hooks/use_space_id'; -import { useKibana } from '../../../../common/lib/kibana'; -import type { inputsModel } from '../../../../common/store'; -import { upgradeHostRiskScoreModule, upgradeUserRiskScoreModule } from './utils'; -import { RiskScoreEntity } from '../../../../../common/search_strategy'; -import { useRiskScoreToastContent } from './use_risk_score_toast_content'; -import { REQUEST_NAMES, useFetch } from '../../../../common/hooks/use_fetch'; -import { RiskScoreDocLink } from './risk_score_doc_link'; - -const RiskScoreUpgradeButtonComponent = ({ - disabled, - refetch, - riskScoreEntity, - timerange, - title, -}: { - disabled?: boolean; - refetch: inputsModel.Refetch; - riskScoreEntity: RiskScoreEntity; - timerange: { - from: string; - to: string; - }; - title: string; -}) => { - const spaceId = useSpaceId(); - const { http, notifications, theme, dashboard } = useKibana().services; - const { renderDocLink, renderDashboardLink } = useRiskScoreToastContent(riskScoreEntity); - const { fetch, isLoading } = useFetch( - REQUEST_NAMES.UPGRADE_RISK_SCORE, - riskScoreEntity === RiskScoreEntity.user - ? upgradeUserRiskScoreModule - : upgradeHostRiskScoreModule - ); - const [isModalVisible, setIsModalVisible] = useState(false); - const closeModal = useCallback(() => setIsModalVisible(false), []); - const showModal = useCallback(() => setIsModalVisible(true), []); - const upgradeRiskScore = useCallback(async () => { - closeModal(); - fetch({ - http, - notifications, - spaceId, - timerange, - refetch, - renderDashboardLink, - renderDocLink, - riskScoreEntity, - theme, - dashboard, - }); - }, [ - closeModal, - fetch, - http, - notifications, - spaceId, - timerange, - refetch, - renderDashboardLink, - renderDocLink, - riskScoreEntity, - theme, - dashboard, - ]); - - return ( - <> - - {title} - - {isModalVisible && ( - - } - /> - } - confirmButtonText={ - - } - buttonColor="danger" - defaultFocusedButton="confirm" - > - - - )} - - ); -}; - -export const RiskScoreUpgradeButton = React.memo(RiskScoreUpgradeButtonComponent); -RiskScoreUpgradeButton.displayName = 'RiskScoreUpgradeButton'; diff --git a/x-pack/plugins/security_solution/public/explore/containers/risk_score/all/index.tsx b/x-pack/plugins/security_solution/public/explore/containers/risk_score/all/index.tsx index 13a093090fb86..f49879ecf4754 100644 --- a/x-pack/plugins/security_solution/public/explore/containers/risk_score/all/index.tsx +++ b/x-pack/plugins/security_solution/public/explore/containers/risk_score/all/index.tsx @@ -28,7 +28,7 @@ import { isIndexNotFoundError } from '../../../../common/utils/exceptions'; import type { inputsModel } from '../../../../common/store'; import { useSpaceId } from '../../../../common/hooks/use_space_id'; import { useSearchStrategy } from '../../../../common/containers/use_search_strategy'; -import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features'; +import { useIsNewRiskScoreModuleInstalled } from '../../../../entity_analytics/api/hooks/use_risk_engine_status'; export interface RiskScoreState { data: @@ -84,11 +84,11 @@ export const useRiskScore = ): RiskScoreState => { const spaceId = useSpaceId(); - const isNewRiskScoreModuleAvailable = useIsExperimentalFeatureEnabled('riskScoringRoutesEnabled'); + const isNewRiskScoreModuleInstalled = useIsNewRiskScoreModuleInstalled(); const defaultIndex = spaceId ? riskEntity === RiskScoreEntity.host - ? getHostRiskIndex(spaceId, onlyLatest, isNewRiskScoreModuleAvailable) - : getUserRiskIndex(spaceId, onlyLatest, isNewRiskScoreModuleAvailable) + ? getHostRiskIndex(spaceId, onlyLatest, isNewRiskScoreModuleInstalled) + : getUserRiskIndex(spaceId, onlyLatest, isNewRiskScoreModuleInstalled) : undefined; const factoryQueryType = riskEntity === RiskScoreEntity.host ? RiskQueries.hostsRiskScore : RiskQueries.usersRiskScore; @@ -207,5 +207,7 @@ export const useRiskScore = (null); @@ -145,7 +145,7 @@ export const useAllHost = ({ direction, field: sortField, }, - isNewRiskScoreModuleAvailable, + isNewRiskScoreModuleInstalled, }; if (!deepEqual(prevRequest, myRequest)) { return myRequest; @@ -161,7 +161,7 @@ export const useAllHost = ({ limit, startDate, sortField, - isNewRiskScoreModuleAvailable, + isNewRiskScoreModuleInstalled, ]); useEffect(() => { diff --git a/x-pack/plugins/security_solution/public/explore/hosts/pages/navigation/host_risk_score_tab_body.tsx b/x-pack/plugins/security_solution/public/explore/hosts/pages/navigation/host_risk_score_tab_body.tsx index 055a02d9c072e..7139102bd35a5 100644 --- a/x-pack/plugins/security_solution/public/explore/hosts/pages/navigation/host_risk_score_tab_body.tsx +++ b/x-pack/plugins/security_solution/public/explore/hosts/pages/navigation/host_risk_score_tab_body.tsx @@ -95,10 +95,6 @@ export const HostRiskScoreQueryTabBody = ({ isDeprecated: isDeprecated && !loading, }; - if (riskScoreEngineStatus?.isUpdateAvailable) { - return ; - } - if (status.isDisabled || status.isDeprecated) { return ( @@ -123,21 +119,24 @@ export const HostRiskScoreQueryTabBody = ({ } return ( - + <> + {riskScoreEngineStatus?.isUpdateAvailable && } + + ); }; diff --git a/x-pack/plugins/security_solution/public/explore/users/pages/navigation/all_users_query_tab_body.tsx b/x-pack/plugins/security_solution/public/explore/users/pages/navigation/all_users_query_tab_body.tsx index 47c9002e36a51..286a1b21c735b 100644 --- a/x-pack/plugins/security_solution/public/explore/users/pages/navigation/all_users_query_tab_body.tsx +++ b/x-pack/plugins/security_solution/public/explore/users/pages/navigation/all_users_query_tab_body.tsx @@ -19,7 +19,7 @@ import { generateTablePaginationOptions } from '../../../components/paginated_ta import { useDeepEqualSelector } from '../../../../common/hooks/use_selector'; import { usersSelectors } from '../../store'; import { useQueryToggle } from '../../../../common/containers/query_toggle'; -import { useIsExperimentalFeatureEnabled } from '../../../../common/hooks/use_experimental_features'; +import { useIsNewRiskScoreModuleInstalled } from '../../../../entity_analytics/api/hooks/use_risk_engine_status'; const UsersTableManage = manageQuery(UsersTable); @@ -43,7 +43,7 @@ export const AllUsersQueryTabBody = ({ const getUsersSelector = useMemo(() => usersSelectors.allUsersSelector(), []); const { activePage, limit, sort } = useDeepEqualSelector((state) => getUsersSelector(state)); - const isNewRiskScoreModuleAvailable = useIsExperimentalFeatureEnabled('riskScoringRoutesEnabled'); + const isNewRiskScoreModuleInstalled = useIsNewRiskScoreModuleInstalled(); const { loading, @@ -78,7 +78,7 @@ export const AllUsersQueryTabBody = ({ }, pagination: generateTablePaginationOptions(activePage, limit), sort, - isNewRiskScoreModuleAvailable, + isNewRiskScoreModuleInstalled, }); } }, [ @@ -91,7 +91,7 @@ export const AllUsersQueryTabBody = ({ activePage, limit, sort, - isNewRiskScoreModuleAvailable, + isNewRiskScoreModuleInstalled, ]); return ( diff --git a/x-pack/plugins/security_solution/public/explore/users/pages/navigation/user_risk_score_tab_body.tsx b/x-pack/plugins/security_solution/public/explore/users/pages/navigation/user_risk_score_tab_body.tsx index c1652a49036c2..4097d673f3982 100644 --- a/x-pack/plugins/security_solution/public/explore/users/pages/navigation/user_risk_score_tab_body.tsx +++ b/x-pack/plugins/security_solution/public/explore/users/pages/navigation/user_risk_score_tab_body.tsx @@ -95,10 +95,6 @@ export const UserRiskScoreQueryTabBody = ({ isDeprecated: isDeprecated && !loading, }; - if (riskScoreEngineStatus?.isUpdateAvailable) { - return ; - } - if (status.isDisabled || status.isDeprecated) { return ( + <> + {riskScoreEngineStatus?.isUpdateAvailable && } + + ); }; diff --git a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/index.tsx b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/index.tsx index 57536596e085e..332f5535a1304 100644 --- a/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/index.tsx +++ b/x-pack/plugins/security_solution/public/overview/components/entity_analytics/risk_score/index.tsx @@ -35,7 +35,6 @@ import { useNavigateToAlertsPageWithFilters } from '../../../../common/hooks/use import { getRiskEntityTranslation } from './translations'; import { useKibana } from '../../../../common/lib/kibana'; import { useGlobalFilterQuery } from '../../../../common/hooks/use_global_filter_query'; -import { useRiskEngineStatus } from '../../../../entity_analytics/api/hooks/use_risk_engine_status'; const EntityAnalyticsRiskScoresComponent = ({ riskEntity }: { riskEntity: RiskScoreEntity }) => { const { deleteQuery, setQuery, from, to } = useGlobalTime(); @@ -126,8 +125,6 @@ const EntityAnalyticsRiskScoresComponent = ({ riskEntity }: { riskEntity: RiskSc includeAlertsCount: true, }); - const { data: riskScoreEngineStatus } = useRiskEngineStatus(); - useQueryInspector({ queryId: entity.tableQueryId, loading: isTableLoading, @@ -152,10 +149,6 @@ const EntityAnalyticsRiskScoresComponent = ({ riskEntity }: { riskEntity: RiskSc isDeprecated: isDeprecated && !isTableLoading, }; - if (riskScoreEngineStatus?.isUpdateAvailable) { - return null; - } - if (status.isDisabled || status.isDeprecated) { return ( { const isHostRiskScoreIndexExist = await services.scopedClusterClient.asCurrentUser.indices.exists( { - index: getHostRiskIndex(spaceId, true, isNewRiskScoreModuleAvailable), + index: getHostRiskIndex(spaceId, true, isNewRiskScoreModuleInstalled), } ); @@ -32,11 +32,11 @@ export const createHostRiskEnrichments: CreateRiskEnrichment = async ({ logger, events, spaceId, - isNewRiskScoreModuleAvailable, + isNewRiskScoreModuleInstalled, }) => { return createSingleFieldMatchEnrichment({ name: 'Host Risk', - index: [getHostRiskIndex(spaceId, true, isNewRiskScoreModuleAvailable)], + index: [getHostRiskIndex(spaceId, true, isNewRiskScoreModuleInstalled)], services, logger, events, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/utils/enrichments/enrichment_by_type/user_risk.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/utils/enrichments/enrichment_by_type/user_risk.ts index 9fdb5e85b391b..b0e8d87f3019f 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/utils/enrichments/enrichment_by_type/user_risk.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/utils/enrichments/enrichment_by_type/user_risk.ts @@ -15,11 +15,11 @@ import { getFieldValue } from '../utils/events'; export const getIsUserRiskScoreAvailable: GetIsRiskScoreAvailable = async ({ services, spaceId, - isNewRiskScoreModuleAvailable, + isNewRiskScoreModuleInstalled, }) => { const isUserRiskScoreIndexExist = await services.scopedClusterClient.asCurrentUser.indices.exists( { - index: getUserRiskIndex(spaceId, true, isNewRiskScoreModuleAvailable), + index: getUserRiskIndex(spaceId, true, isNewRiskScoreModuleInstalled), } ); @@ -31,11 +31,11 @@ export const createUserRiskEnrichments: CreateRiskEnrichment = async ({ logger, events, spaceId, - isNewRiskScoreModuleAvailable, + isNewRiskScoreModuleInstalled, }) => { return createSingleFieldMatchEnrichment({ name: 'User Risk', - index: [getUserRiskIndex(spaceId, true, isNewRiskScoreModuleAvailable)], + index: [getUserRiskIndex(spaceId, true, isNewRiskScoreModuleInstalled)], services, logger, events, diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/utils/enrichments/index.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/utils/enrichments/index.ts index 3f6015929e3ce..a27cc55801820 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/utils/enrichments/index.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/utils/enrichments/index.ts @@ -34,9 +34,18 @@ export const enrichEvents: EnrichEventsFunction = async ({ logger.debug('Alert enrichments started'); const isNewRiskScoreModuleAvailable = experimentalFeatures?.riskScoringRoutesEnabled ?? false; + let isNewRiskScoreModuleInstalled = false; + if (isNewRiskScoreModuleAvailable) { + isNewRiskScoreModuleInstalled = await getIsHostRiskScoreAvailable({ + spaceId, + services, + isNewRiskScoreModuleInstalled: true, + }); + } + const [isHostRiskScoreIndexExist, isUserRiskScoreIndexExist] = await Promise.all([ - getIsHostRiskScoreAvailable({ spaceId, services, isNewRiskScoreModuleAvailable }), - getIsUserRiskScoreAvailable({ spaceId, services, isNewRiskScoreModuleAvailable }), + getIsHostRiskScoreAvailable({ spaceId, services, isNewRiskScoreModuleInstalled }), + getIsUserRiskScoreAvailable({ spaceId, services, isNewRiskScoreModuleInstalled }), ]); if (isHostRiskScoreIndexExist) { @@ -46,7 +55,7 @@ export const enrichEvents: EnrichEventsFunction = async ({ logger, events, spaceId, - isNewRiskScoreModuleAvailable, + isNewRiskScoreModuleInstalled, }) ); } @@ -58,7 +67,7 @@ export const enrichEvents: EnrichEventsFunction = async ({ logger, events, spaceId, - isNewRiskScoreModuleAvailable, + isNewRiskScoreModuleInstalled, }) ); } diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/utils/enrichments/types.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/utils/enrichments/types.ts index 352cb4ffc18ae..73c703235edca 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/utils/enrichments/types.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/utils/enrichments/types.ts @@ -76,13 +76,13 @@ export type SearchEnrichments = (params: { export type GetIsRiskScoreAvailable = (params: { spaceId: string; services: RuleServices; - isNewRiskScoreModuleAvailable: boolean; + isNewRiskScoreModuleInstalled: boolean; }) => Promise; export type CreateRiskEnrichment = ( params: BasedEnrichParamters & { spaceId: string; - isNewRiskScoreModuleAvailable: boolean; + isNewRiskScoreModuleInstalled: boolean; } ) => Promise; diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/hosts/all/__mocks__/index.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/hosts/all/__mocks__/index.ts index 3db8573a6a606..11868b86f2530 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/hosts/all/__mocks__/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/hosts/all/__mocks__/index.ts @@ -31,7 +31,7 @@ export const mockOptions: HostsRequestOptions = { pagination: { activePage: 0, cursorStart: 0, fakePossibleCount: 50, querySize: 10 }, timerange: { interval: '12h', from: '2020-09-03T09:15:21.415Z', to: '2020-09-04T09:15:21.415Z' }, sort: { direction: Direction.desc, field: HostsFields.lastSeen }, - isNewRiskScoreModuleAvailable: false, + isNewRiskScoreModuleInstalled: false, }; export const mockSearchStrategyResponse: IEsSearchResponse = { diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/hosts/all/index.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/hosts/all/index.ts index 0131f5417d0d5..f3cd1eb0cf100 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/hosts/all/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/hosts/all/index.ts @@ -72,7 +72,7 @@ export const allHosts: SecuritySolutionFactory = { hostNames, deps.spaceId, deps.esClient, - options.isNewRiskScoreModuleAvailable + options.isNewRiskScoreModuleInstalled ) : edges; @@ -95,13 +95,13 @@ async function enhanceEdges( hostNames: string[], spaceId: string, esClient: IScopedClusterClient, - isNewRiskScoreModuleAvailable: boolean + isNewRiskScoreModuleInstalled: boolean ): Promise { const hostRiskData = await getHostRiskData( esClient, spaceId, hostNames, - isNewRiskScoreModuleAvailable + isNewRiskScoreModuleInstalled ); const hostsRiskByHostName: Record | undefined = hostRiskData?.hits.hits.reduce( (acc, hit) => ({ @@ -126,12 +126,12 @@ export async function getHostRiskData( esClient: IScopedClusterClient, spaceId: string, hostNames: string[], - isNewRiskScoreModuleAvailable: boolean + isNewRiskScoreModuleInstalled: boolean ) { try { const hostRiskResponse = await esClient.asCurrentUser.search( buildRiskScoreQuery({ - defaultIndex: [getHostRiskIndex(spaceId, true, isNewRiskScoreModuleAvailable)], + defaultIndex: [getHostRiskIndex(spaceId, true, isNewRiskScoreModuleInstalled)], filterQuery: buildHostNamesFilter(hostNames), riskScoreEntity: RiskScoreEntity.host, factoryQueryType: RiskQueries.hostsRiskScore, diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/related_entities/related_hosts/__mocks__/index.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/related_entities/related_hosts/__mocks__/index.ts index 979f80440d44e..6a9e3ae82aa05 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/related_entities/related_hosts/__mocks__/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/related_entities/related_hosts/__mocks__/index.ts @@ -21,7 +21,7 @@ export const mockOptions: RelatedHostsRequestOptions = { factoryQueryType: RelatedEntitiesQueries.relatedHosts, userName: 'user1', from: '2020-09-02T15:17:13.678Z', - isNewRiskScoreModuleAvailable: false, + isNewRiskScoreModuleInstalled: false, }; export const mockSearchStrategyResponse: IEsSearchResponse = { diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/related_entities/related_hosts/index.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/related_entities/related_hosts/index.ts index ee4787c83c912..19da422fbf3ae 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/related_entities/related_hosts/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/related_entities/related_hosts/index.ts @@ -61,7 +61,7 @@ export const usersRelatedHosts: SecuritySolutionFactory { const hostNames = relatedHosts.map((item) => item.host); const hostRiskData = await getHostRiskData( esClient, spaceId, hostNames, - isNewRiskScoreModuleAvailable + isNewRiskScoreModuleInstalled ); const hostsRiskByHostName: Record | undefined = hostRiskData?.hits.hits.reduce( diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/related_entities/related_users/__mocks__/index.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/related_entities/related_users/__mocks__/index.ts index c503928861472..a7c6d3501c0f0 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/related_entities/related_users/__mocks__/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/related_entities/related_users/__mocks__/index.ts @@ -21,7 +21,7 @@ export const mockOptions: RelatedUsersRequestOptions = { factoryQueryType: RelatedEntitiesQueries.relatedUsers, hostName: 'host1', from: '2020-09-02T15:17:13.678Z', - isNewRiskScoreModuleAvailable: false, + isNewRiskScoreModuleInstalled: false, }; export const mockSearchStrategyResponse: IEsSearchResponse = { diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/related_entities/related_users/index.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/related_entities/related_users/index.ts index abe95325ebce1..371083a01e42c 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/related_entities/related_users/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/related_entities/related_users/index.ts @@ -60,7 +60,7 @@ export const hostsRelatedUsers: SecuritySolutionFactory { const userNames = relatedUsers.map((item) => item.user); const userRiskData = await getUserRiskData( esClient, spaceId, userNames, - isNewRiskScoreModuleAvailable + isNewRiskScoreModuleInstalled ); const usersRiskByUserName: Record | undefined = userRiskData?.hits.hits.reduce( diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/__mocks__/index.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/__mocks__/index.ts index 2670f2d5b9b65..0e5a7c88851dd 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/__mocks__/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/__mocks__/index.ts @@ -33,7 +33,7 @@ export const mockOptions: UsersRequestOptions = { querySize: 10, }, sort: { field: UsersFields.name, direction: Direction.asc }, - isNewRiskScoreModuleAvailable: false, + isNewRiskScoreModuleInstalled: false, }; export const mockSearchStrategyResponse: IEsSearchResponse = { diff --git a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/index.ts b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/index.ts index 8f1836e8a05dc..a8eab4d4b92db 100644 --- a/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/index.ts +++ b/x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users/all/index.ts @@ -78,7 +78,7 @@ export const allUsers: SecuritySolutionFactory = { userNames, deps.spaceId, deps.esClient, - options.isNewRiskScoreModuleAvailable + options.isNewRiskScoreModuleInstalled ) : edges; @@ -101,13 +101,13 @@ async function enhanceEdges( userNames: string[], spaceId: string, esClient: IScopedClusterClient, - isNewRiskScoreModuleAvailable: boolean + isNewRiskScoreModuleInstalled: boolean ): Promise { const userRiskData = await getUserRiskData( esClient, spaceId, userNames, - isNewRiskScoreModuleAvailable + isNewRiskScoreModuleInstalled ); const usersRiskByUserName: Record | undefined = userRiskData?.hits.hits.reduce( @@ -132,12 +132,12 @@ export async function getUserRiskData( esClient: IScopedClusterClient, spaceId: string, userNames: string[], - isNewRiskScoreModuleAvailable: boolean + isNewRiskScoreModuleInstalled: boolean ) { try { const userRiskResponse = await esClient.asCurrentUser.search( buildRiskScoreQuery({ - defaultIndex: [getUserRiskIndex(spaceId, true, isNewRiskScoreModuleAvailable)], + defaultIndex: [getUserRiskIndex(spaceId, true, isNewRiskScoreModuleInstalled)], filterQuery: buildUserNamesFilter(userNames), riskScoreEntity: RiskScoreEntity.user, factoryQueryType: RiskQueries.usersRiskScore, diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 15a96b01726c2..13adc0fb66fb9 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -33622,9 +33622,6 @@ "xpack.securitySolution.riskScore.savedObjects.bulkDeleteFailureTitle": "Impossible de supprimer les objets enregistrés", "xpack.securitySolution.riskScore.technicalPreviewLabel": "Version d'évaluation technique", "xpack.securitySolution.riskScore.uninstall.errorMessageTitle": "Erreur de désinstallation", - "xpack.securitySolution.riskScore.upgradeConfirmation.cancel": "Conserver les données", - "xpack.securitySolution.riskScore.upgradeConfirmation.confirm": "Effacer et mettre à niveau", - "xpack.securitySolution.riskScore.upgradeConfirmation.content": "La mise à niveau supprimera les scores de risque existants de votre environnement. Vous pouvez conserver les données de risque existantes avant de mettre à niveau le package Score de risque. Voulez-vous effectuer la mise à niveau ?", "xpack.securitySolution.riskScore.userRiskScoresEnabledTitle": "Scores de risque de l'utilisateur activés", "xpack.securitySolution.riskScore.usersDashboardRestartTooltip": "Le calcul du score de risque pourra prendre un certain temps à se lancer. Cependant, en appuyant sur Redémarrer, vous pouvez le forcer à s'exécuter immédiatement.", "xpack.securitySolution.riskScore.usersDashboardWarningPanelBody": "Nous n’avons pas trouvé de données de score de risque de l’utilisateur. Vérifiez si vous avez des filtres globaux dans la barre de recherche KQL globale. Si vous venez d’activer le module de risque de l’utilisateur, le moteur de risque peut mettre une heure à générer les données de score de risque de l’utilisateur et à les afficher dans ce panneau.", diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 9ddbc69b1fcc3..65ac82de93183 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -33621,9 +33621,6 @@ "xpack.securitySolution.riskScore.savedObjects.bulkDeleteFailureTitle": "保存されたオブジェクトを削除できませんでした", "xpack.securitySolution.riskScore.technicalPreviewLabel": "テクニカルプレビュー", "xpack.securitySolution.riskScore.uninstall.errorMessageTitle": "アンインストールエラー", - "xpack.securitySolution.riskScore.upgradeConfirmation.cancel": "データの保持", - "xpack.securitySolution.riskScore.upgradeConfirmation.confirm": "データを消去してアップグレード", - "xpack.securitySolution.riskScore.upgradeConfirmation.content": "アップグレードを実行すると、既存のリスクスコアが環境から削除されます。既存のリスクデータを保持するには、リスクスコアパッケージをアップグレードしてください。アップグレードしますか?", "xpack.securitySolution.riskScore.userRiskScoresEnabledTitle": "ユーザーリスクスコア有効", "xpack.securitySolution.riskScore.usersDashboardRestartTooltip": "リスクスコア計算の実行には少し時間がかかる場合があります。ただし、再起動を押すと、すぐに強制的に実行できます。", "xpack.securitySolution.riskScore.usersDashboardWarningPanelBody": "ユーザーリスクスコアデータが見つかりません。グローバルKQL検索バーにグローバルフィルターがあるかどうかを確認してください。ユーザーリスクモジュールを有効にしたばかりの場合は、リスクエンジンがユーザーリスクスコアデータを生成し、このパネルに表示するまでに1時間かかることがあります。", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 17bfa24a3b450..71efc0fb21069 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -33617,9 +33617,6 @@ "xpack.securitySolution.riskScore.savedObjects.bulkDeleteFailureTitle": "无法删除已保存对象", "xpack.securitySolution.riskScore.technicalPreviewLabel": "技术预览", "xpack.securitySolution.riskScore.uninstall.errorMessageTitle": "卸载错误", - "xpack.securitySolution.riskScore.upgradeConfirmation.cancel": "保留数据", - "xpack.securitySolution.riskScore.upgradeConfirmation.confirm": "擦除数据并升级", - "xpack.securitySolution.riskScore.upgradeConfirmation.content": "升级会从您的环境中删除现有风险分数。您可以先保留现有风险数据,然后再升级风险分数软件包。是否升级?", "xpack.securitySolution.riskScore.userRiskScoresEnabledTitle": "已启用用户风险分数", "xpack.securitySolution.riskScore.usersDashboardRestartTooltip": "风险分数计算可能需要一段时间运行。但是,通过按“重新启动”,您可以立即强制运行该计算。", "xpack.securitySolution.riskScore.usersDashboardWarningPanelBody": "找不到任何用户风险分数数据。检查全局 KQL 搜索栏中是否具有任何全局筛选。如果刚刚启用了用户风险模块,风险引擎可能需要一小时才能生成并在此面板中显示用户风险分数数据。", diff --git a/x-pack/test/security_solution_cypress/config.ts b/x-pack/test/security_solution_cypress/config.ts index 21259c2d289e2..ece8ee522917c 100644 --- a/x-pack/test/security_solution_cypress/config.ts +++ b/x-pack/test/security_solution_cypress/config.ts @@ -48,6 +48,8 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { 'alertDetailsPageEnabled', 'chartEmbeddablesEnabled', 'discoverInTimeline', + 'riskScoringRoutesEnabled', + 'riskScoringPersistence', ])}`, // mock cloud to enable the guided onboarding tour in e2e tests '--xpack.cloud.id=test', diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/detection_alerts/enrichments.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/detection_alerts/enrichments.cy.ts index 38a16a8225445..4432a1c6c90a7 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/detection_alerts/enrichments.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/detection_alerts/enrichments.cy.ts @@ -30,11 +30,18 @@ import { login } from '../../tasks/login'; import { visitWithTimeRange } from '../../tasks/navigation'; import { ALERTS_URL } from '../../urls/navigation'; +import { deleteRiskEngineConfiguration } from '../../tasks/api_calls/risk_engine'; +import { enableRiskEngine } from '../../tasks/entity_analytics'; + +const CURRENT_HOST_RISK_CLASIFICATION = 'Current host risk classification'; +const ORIGINAL_HOST_RISK_CLASIFICATION = 'Original host risk classification'; // TODO: https://github.com/elastic/kibana/issues/161539 describe('Enrichment', { tags: ['@ess', '@serverless', '@brokenInServerless'] }, () => { before(() => { cleanKibana(); + cy.task('esArchiverUnload', 'risk_scores_new'); + cy.task('esArchiverUnload', 'risk_scores_new_updated'); cy.task('esArchiverLoad', { archiveName: 'risk_users' }); }); @@ -43,44 +50,91 @@ describe('Enrichment', { tags: ['@ess', '@serverless', '@brokenInServerless'] }, }); describe('Custom query rule', () => { - beforeEach(() => { - disableExpandableFlyout(); - cy.task('esArchiverLoad', { archiveName: 'risk_hosts' }); - deleteAlertsAndRules(); - createRule(getNewRule({ rule_id: 'rule1' })); - login(); - visitWithTimeRange(ALERTS_URL); - waitForAlertsToPopulate(); - }); + describe('from legacy risk scores', () => { + beforeEach(() => { + disableExpandableFlyout(); + cy.task('esArchiverLoad', { archiveName: 'risk_hosts' }); + deleteAlertsAndRules(); + createRule(getNewRule({ rule_id: 'rule1' })); + login(); + deleteRiskEngineConfiguration(); + visitWithTimeRange(ALERTS_URL); + waitForAlertsToPopulate(); + }); + + afterEach(() => { + cy.task('esArchiverUnload', 'risk_hosts'); + cy.task('esArchiverUnload', 'risk_hosts_updated'); + }); - afterEach(() => { - cy.task('esArchiverUnload', 'risk_hosts'); - cy.task('esArchiverUnload', 'risk_hosts_updated'); + it('Should has enrichment fields from legacy risk', function () { + cy.get(ALERTS_COUNT) + .invoke('text') + .should('match', /^[1-9].+$/); // Any number of alerts + cy.get(HOST_RISK_HEADER_COLIMN).contains('host.risk.calculated_level'); + cy.get(USER_RISK_HEADER_COLIMN).contains('user.risk.calculated_level'); + scrollAlertTableColumnIntoView(HOST_RISK_COLUMN); + cy.get(HOST_RISK_COLUMN).contains('Low'); + scrollAlertTableColumnIntoView(USER_RISK_COLUMN); + cy.get(USER_RISK_COLUMN).contains('Low'); + scrollAlertTableColumnIntoView(ACTION_COLUMN); + expandFirstAlert(); + cy.get(ENRICHED_DATA_ROW).contains('Low'); + cy.get(ENRICHED_DATA_ROW).contains(CURRENT_HOST_RISK_CLASIFICATION); + cy.get(ENRICHED_DATA_ROW).contains('Critical').should('not.exist'); + cy.get(ENRICHED_DATA_ROW).contains(ORIGINAL_HOST_RISK_CLASIFICATION).should('not.exist'); + + closeAlertFlyout(); + cy.task('esArchiverUnload', 'risk_hosts'); + cy.task('esArchiverLoad', { archiveName: 'risk_hosts_updated' }); + expandFirstAlert(); + cy.get(ENRICHED_DATA_ROW).contains('Critical'); + cy.get(ENRICHED_DATA_ROW).contains(ORIGINAL_HOST_RISK_CLASIFICATION); + }); }); - it('Should has enrichment fields', function () { - cy.get(ALERTS_COUNT) - .invoke('text') - .should('match', /^[1-9].+$/); // Any number of alerts - cy.get(HOST_RISK_HEADER_COLIMN).contains('host.risk.calculated_level'); - cy.get(USER_RISK_HEADER_COLIMN).contains('user.risk.calculated_level'); - scrollAlertTableColumnIntoView(HOST_RISK_COLUMN); - cy.get(HOST_RISK_COLUMN).contains('Low'); - scrollAlertTableColumnIntoView(USER_RISK_COLUMN); - cy.get(USER_RISK_COLUMN).contains('Low'); - scrollAlertTableColumnIntoView(ACTION_COLUMN); - expandFirstAlert(); - cy.get(ENRICHED_DATA_ROW).contains('Low'); - cy.get(ENRICHED_DATA_ROW).contains('Current host risk classification'); - cy.get(ENRICHED_DATA_ROW).contains('Critical').should('not.exist'); - cy.get(ENRICHED_DATA_ROW).contains('Original host risk classification').should('not.exist'); + describe('from new risk scores', () => { + beforeEach(() => { + disableExpandableFlyout(); + cy.task('esArchiverLoad', { archiveName: 'risk_scores_new' }); + deleteAlertsAndRules(); + createRule(getNewRule({ rule_id: 'rule1' })); + login(); + enableRiskEngine(); + visitWithTimeRange(ALERTS_URL); + waitForAlertsToPopulate(); + }); + + afterEach(() => { + cy.task('esArchiverUnload', 'risk_scores_new'); + cy.task('esArchiverUnload', 'risk_scores_new_updated'); + deleteRiskEngineConfiguration(); + }); + + it('Should has enrichment fields from legacy risk', function () { + cy.get(ALERTS_COUNT) + .invoke('text') + .should('match', /^[1-9].+$/); // Any number of alerts + cy.get(HOST_RISK_HEADER_COLIMN).contains('host.risk.calculated_level'); + cy.get(USER_RISK_HEADER_COLIMN).contains('user.risk.calculated_level'); + scrollAlertTableColumnIntoView(HOST_RISK_COLUMN); + cy.get(HOST_RISK_COLUMN).contains('Critical'); + scrollAlertTableColumnIntoView(USER_RISK_COLUMN); + cy.get(USER_RISK_COLUMN).contains('High'); + scrollAlertTableColumnIntoView(ACTION_COLUMN); + expandFirstAlert(); + cy.get(ENRICHED_DATA_ROW).contains('Critical'); + cy.get(ENRICHED_DATA_ROW).contains(CURRENT_HOST_RISK_CLASIFICATION); + cy.get(ENRICHED_DATA_ROW).contains('Low').should('not.exist'); + cy.get(ENRICHED_DATA_ROW).contains(ORIGINAL_HOST_RISK_CLASIFICATION).should('not.exist'); - closeAlertFlyout(); - cy.task('esArchiverUnload', 'risk_hosts'); - cy.task('esArchiverLoad', { archiveName: 'risk_hosts_updated' }); - expandFirstAlert(); - cy.get(ENRICHED_DATA_ROW).contains('Critical'); - cy.get(ENRICHED_DATA_ROW).contains('Original host risk classification'); + closeAlertFlyout(); + cy.task('esArchiverUnload', 'risk_scores_new'); + cy.task('esArchiverLoad', { archiveName: 'risk_scores_new_updated' }); + expandFirstAlert(); + cy.get(ENRICHED_DATA_ROW).contains('Low'); + cy.get(ENRICHED_DATA_ROW).contains(ORIGINAL_HOST_RISK_CLASIFICATION); + }); }); }); }); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/entity_analytics_management_page.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/entity_analytics_management_page.cy.ts index 272a548bee666..86168a7798948 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/entity_analytics_management_page.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/entity_analytics/entity_analytics_management_page.cy.ts @@ -26,7 +26,7 @@ import { ENTITY_ANALYTICS_MANAGEMENT_URL } from '../../urls/navigation'; import { getNewRule } from '../../objects/rule'; import { createRule } from '../../tasks/api_calls/rules'; import { - deleteConfiguration, + deleteRiskEngineConfiguration, interceptRiskPreviewError, interceptRiskPreviewSuccess, interceptRiskInitError, @@ -35,8 +35,7 @@ import { updateDateRangeInLocalDatePickers } from '../../tasks/date_picker'; import { fillLocalSearchBar, submitLocalSearch } from '../../tasks/search_bar'; import { riskEngineStatusChange, - updateRiskEngine, - updateRiskEngineConfirm, + upgradeRiskEngine, previewErrorButtonClick, } from '../../tasks/entity_analytics'; @@ -44,9 +43,6 @@ import { describe( 'Entity analytics management page', { - env: { - ftrConfig: { enableExperimental: ['riskScoringRoutesEnabled', 'riskScoringPersistence'] }, - }, tags: ['@ess', '@serverless', '@brokenInServerless'], }, () => { @@ -58,7 +54,7 @@ describe( beforeEach(() => { login(); createRule(getNewRule({ query: 'user.name:* or host.name:*', risk_score: 70 })); - deleteConfiguration(); + deleteRiskEngineConfiguration(); visit(ENTITY_ANALYTICS_MANAGEMENT_URL); }); @@ -147,10 +143,7 @@ describe( cy.get(RISK_SCORE_STATUS).should('not.exist'); - updateRiskEngine(); - updateRiskEngineConfirm(); - - cy.get(RISK_SCORE_STATUS).should('have.text', 'On'); + upgradeRiskEngine(); deleteRiskScore({ riskScoreEntity: RiskScoreEntity.host, spaceId: 'default' }); }); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/enable_risk_score.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/enable_risk_score.cy.ts deleted file mode 100644 index 18dce59372d0e..0000000000000 --- a/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/enable_risk_score.cy.ts +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { getNewRule } from '../../../objects/rule'; -import { - ENABLE_HOST_RISK_SCORE_BUTTON, - ENABLE_USER_RISK_SCORE_BUTTON, - RISK_SCORE_DASHBOARDS_INSTALLATION_SUCCESS_TOAST, - RISK_SCORE_INSTALLATION_SUCCESS_TOAST, -} from '../../../screens/entity_analytics'; -import { - deleteRiskScore, - interceptInstallRiskScoreModule, - waitForInstallRiskScoreModule, -} from '../../../tasks/api_calls/risk_scores'; -import { findSavedObjects } from '../../../tasks/api_calls/risk_scores/saved_objects'; -import { createRule } from '../../../tasks/api_calls/rules'; -import { cleanKibana } from '../../../tasks/common'; -import { login } from '../../../tasks/login'; -import { visitWithTimeRange } from '../../../tasks/navigation'; -import { clickEnableRiskScore } from '../../../tasks/risk_scores'; -import { RiskScoreEntity } from '../../../tasks/risk_scores/common'; -import { - getRiskScoreLatestTransformId, - getRiskScorePivotTransformId, - getTransformState, -} from '../../../tasks/risk_scores/transforms'; -import { ENTITY_ANALYTICS_URL } from '../../../urls/navigation'; - -const spaceId = 'default'; - -// FLAKY: https://github.com/elastic/kibana/issues/165644 -describe('Enable risk scores', { tags: ['@ess', '@serverless', '@brokenInServerless'] }, () => { - before(() => { - cleanKibana(); - login(); - createRule(getNewRule({ rule_id: 'rule1' })); - }); - - beforeEach(() => { - login(); - deleteRiskScore({ riskScoreEntity: RiskScoreEntity.host, spaceId }); - deleteRiskScore({ riskScoreEntity: RiskScoreEntity.user, spaceId }); - visitWithTimeRange(ENTITY_ANALYTICS_URL); - }); - - afterEach(() => { - deleteRiskScore({ riskScoreEntity: RiskScoreEntity.host, spaceId }); - deleteRiskScore({ riskScoreEntity: RiskScoreEntity.user, spaceId }); - }); - - it('shows enable host risk button', () => { - cy.get(ENABLE_HOST_RISK_SCORE_BUTTON).should('exist'); - }); - - it('should install host risk score successfully', { tags: ['@brokenInServerless'] }, () => { - interceptInstallRiskScoreModule(); - clickEnableRiskScore(RiskScoreEntity.host); - waitForInstallRiskScoreModule(); - - cy.get(ENABLE_HOST_RISK_SCORE_BUTTON).should('be.disabled'); - - cy.get(RISK_SCORE_INSTALLATION_SUCCESS_TOAST(RiskScoreEntity.host)).should('exist'); - cy.get(RISK_SCORE_DASHBOARDS_INSTALLATION_SUCCESS_TOAST(RiskScoreEntity.host)).should('exist'); - cy.get(ENABLE_HOST_RISK_SCORE_BUTTON).should('not.exist'); - getTransformState(getRiskScorePivotTransformId(RiskScoreEntity.host, spaceId)).then((res) => { - expect(res.status).to.eq(200); - expect(res.body.transforms[0].id).to.eq( - getRiskScorePivotTransformId(RiskScoreEntity.host, spaceId) - ); - expect(res.body.transforms[0].state).to.eq('started'); - }); - getTransformState(getRiskScoreLatestTransformId(RiskScoreEntity.host, spaceId)).then((res) => { - expect(res.status).to.eq(200); - expect(res.body.transforms[0].id).to.eq( - getRiskScoreLatestTransformId(RiskScoreEntity.host, spaceId) - ); - expect(res.body.transforms[0].state).to.eq('started'); - }); - findSavedObjects(RiskScoreEntity.host, spaceId).then((res) => { - expect(res.status).to.eq(200); - expect(res.body.saved_objects.length).to.eq(11); - }); - }); - - it('shows enable user risk button', () => { - cy.get(ENABLE_USER_RISK_SCORE_BUTTON).should('exist'); - }); - - it('should install user risk score successfully', { tags: ['@brokenInServerless'] }, () => { - interceptInstallRiskScoreModule(); - clickEnableRiskScore(RiskScoreEntity.user); - waitForInstallRiskScoreModule(); - - cy.get(ENABLE_USER_RISK_SCORE_BUTTON).should('be.disabled'); - - cy.get(RISK_SCORE_INSTALLATION_SUCCESS_TOAST(RiskScoreEntity.user)).should('exist'); - - cy.get(RISK_SCORE_DASHBOARDS_INSTALLATION_SUCCESS_TOAST(RiskScoreEntity.user)).should('exist'); - cy.get(ENABLE_USER_RISK_SCORE_BUTTON).should('not.exist'); - getTransformState(getRiskScorePivotTransformId(RiskScoreEntity.user, spaceId)).then((res) => { - expect(res.status).to.eq(200); - expect(res.body.transforms[0].id).to.eq( - getRiskScorePivotTransformId(RiskScoreEntity.user, spaceId) - ); - expect(res.body.transforms[0].state).to.eq('started'); - }); - getTransformState(getRiskScoreLatestTransformId(RiskScoreEntity.user, spaceId)).then((res) => { - expect(res.status).to.eq(200); - expect(res.body.transforms[0].id).to.eq( - getRiskScoreLatestTransformId(RiskScoreEntity.user, spaceId) - ); - expect(res.body.transforms[0].state).to.eq('started'); - }); - - findSavedObjects(RiskScoreEntity.user, spaceId).then((res) => { - expect(res.status).to.eq(200); - expect(res.body.saved_objects.length).to.eq(11); - }); - }); -}); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/enable_risk_score_redirect.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/enable_risk_score_redirect.cy.ts new file mode 100644 index 0000000000000..a684968bf8b33 --- /dev/null +++ b/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/enable_risk_score_redirect.cy.ts @@ -0,0 +1,53 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { + ENABLE_HOST_RISK_SCORE_BUTTON, + ENABLE_USER_RISK_SCORE_BUTTON, +} from '../../../screens/entity_analytics'; + +import { cleanKibana } from '../../../tasks/common'; +import { login } from '../../../tasks/login'; +import { visit } from '../../../tasks/navigation'; +import { clickEnableRiskScore } from '../../../tasks/risk_scores'; +import { RiskScoreEntity } from '../../../tasks/risk_scores/common'; + +import { ENTITY_ANALYTICS_URL } from '../../../urls/navigation'; +import { PAGE_TITLE } from '../../../screens/entity_analytics_management'; + +// FLAKY: https://github.com/elastic/kibana/issues/165644 +describe( + 'Enable risk scores from dashboard', + { tags: ['@ess', '@serverless', '@brokenInServerless'] }, + () => { + before(() => { + cleanKibana(); + login(); + }); + + beforeEach(() => { + login(); + visit(ENTITY_ANALYTICS_URL); + }); + + it('host risk enable button should redirect to entity management page', () => { + cy.get(ENABLE_HOST_RISK_SCORE_BUTTON).should('exist'); + + clickEnableRiskScore(RiskScoreEntity.host); + + cy.get(PAGE_TITLE).should('have.text', 'Entity Risk Score'); + }); + + it('user risk enable button should redirect to entity management page', () => { + cy.get(ENABLE_USER_RISK_SCORE_BUTTON).should('exist'); + + clickEnableRiskScore(RiskScoreEntity.user); + + cy.get(PAGE_TITLE).should('have.text', 'Entity Risk Score'); + }); + } +); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/entity_analytics.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/entity_analytics.cy.ts index 77557f3b3b311..39d8e1476a6cd 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/entity_analytics.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/entity_analytics.cy.ts @@ -20,8 +20,6 @@ import { HOSTS_DONUT_CHART, HOSTS_TABLE_ROWS, HOST_RISK_SCORE_NO_DATA_DETECTED, - UPGRADE_HOST_RISK_SCORE_BUTTON, - UPGRADE_USER_RISK_SCORE_BUTTON, USERS_DONUT_CHART, USERS_TABLE, USERS_TABLE_ROWS, @@ -35,7 +33,13 @@ import { import { openRiskTableFilterAndSelectTheLowOption, removeLowFilterAndCloseRiskTableFilter, + openRiskTableFilterAndSelectTheCriticalOption, + removeCriticalFilterAndCloseRiskTableFilter, } from '../../../tasks/host_risk'; +import { + removeLowFilterAndCloseUserRiskTableFilter, + openUserRiskTableFilterAndSelectTheLowOption, +} from '../../../tasks/user_risk'; import { createRule } from '../../../tasks/api_calls/rules'; import { waitForAlertsToPopulate } from '../../../tasks/create_new_rule'; import { getNewRule } from '../../../objects/rule'; @@ -49,6 +53,8 @@ import { navigateToNextPage, waitForAnomaliesToBeLoaded, } from '../../../tasks/entity_analytics'; +import { deleteRiskEngineConfiguration } from '../../../tasks/api_calls/risk_engine'; +import { enableRiskEngine } from '../../../tasks/entity_analytics'; const TEST_USER_ALERTS = 2; const TEST_USER_NAME = 'test'; @@ -59,246 +65,476 @@ const END_DATE = 'Jan 19, 2019 @ 20:33:29.186'; describe('Entity Analytics Dashboard', { tags: ['@ess', '@brokenInServerless'] }, () => { before(() => { cleanKibana(); + login(); + deleteRiskEngineConfiguration(); }); - describe('Without data', () => { - beforeEach(() => { - login(); - visitWithTimeRange(ENTITY_ANALYTICS_URL); - }); + describe('legcay risk score', () => { + describe('Without data', () => { + beforeEach(() => { + login(); + visitWithTimeRange(ENTITY_ANALYTICS_URL); + }); - it('shows enable host risk button', () => { - cy.get(ENABLE_HOST_RISK_SCORE_BUTTON).should('be.visible'); - }); + it('shows enable host risk button', () => { + cy.get(ENABLE_HOST_RISK_SCORE_BUTTON).should('be.visible'); + }); - it('shows enable user risk button', () => { - cy.get(ENABLE_USER_RISK_SCORE_BUTTON).should('be.visible'); + it('shows enable user risk button', () => { + cy.get(ENABLE_USER_RISK_SCORE_BUTTON).should('be.visible'); + }); }); - }); - describe('Risk Score enabled but still no data', () => { - before(() => { - cy.task('esArchiverLoad', { archiveName: 'risk_hosts_no_data' }); - cy.task('esArchiverLoad', { archiveName: 'risk_users_no_data' }); - }); + describe('Risk Score enabled but still no data', () => { + before(() => { + cy.task('esArchiverLoad', { archiveName: 'risk_hosts_no_data' }); + cy.task('esArchiverLoad', { archiveName: 'risk_users_no_data' }); + }); - beforeEach(() => { - login(); - visitWithTimeRange(ENTITY_ANALYTICS_URL); - }); + beforeEach(() => { + login(); + visitWithTimeRange(ENTITY_ANALYTICS_URL); + }); - after(() => { - cy.task('esArchiverUnload', 'risk_hosts_no_data'); - cy.task('esArchiverUnload', 'risk_users_no_data'); - }); + after(() => { + cy.task('esArchiverUnload', 'risk_hosts_no_data'); + cy.task('esArchiverUnload', 'risk_users_no_data'); + }); - it('shows no data detected prompt for host risk score module', () => { - cy.get(HOST_RISK_SCORE_NO_DATA_DETECTED).should('be.visible'); - }); + it('shows no data detected prompt for host risk score module', () => { + cy.get(HOST_RISK_SCORE_NO_DATA_DETECTED).should('be.visible'); + }); - it('shows no data detected prompt for user risk score module', () => { - cy.get(USER_RISK_SCORE_NO_DATA_DETECTED).should('be.visible'); + it('shows no data detected prompt for user risk score module', () => { + cy.get(USER_RISK_SCORE_NO_DATA_DETECTED).should('be.visible'); + }); }); - }); - describe('With Legacy data', () => { - before(() => { - cy.task('esArchiverLoad', { archiveName: 'risk_hosts_legacy_data' }); - cy.task('esArchiverLoad', { archiveName: 'risk_users_legacy_data' }); - }); + describe('With Legacy data', () => { + before(() => { + cy.task('esArchiverLoad', { archiveName: 'risk_hosts_legacy_data' }); + cy.task('esArchiverLoad', { archiveName: 'risk_users_legacy_data' }); + }); - beforeEach(() => { - login(); - visitWithTimeRange(ENTITY_ANALYTICS_URL); - }); + beforeEach(() => { + login(); + visitWithTimeRange(ENTITY_ANALYTICS_URL); + }); - after(() => { - cy.task('esArchiverUnload', 'risk_hosts_legacy_data'); - cy.task('esArchiverUnload', 'risk_users_legacy_data'); - }); + after(() => { + cy.task('esArchiverUnload', 'risk_hosts_legacy_data'); + cy.task('esArchiverUnload', 'risk_users_legacy_data'); + }); - it('shows upgrade host risk button', () => { - cy.get(UPGRADE_HOST_RISK_SCORE_BUTTON).should('be.visible'); - }); + it('shows enable host risk button', () => { + cy.get(ENABLE_HOST_RISK_SCORE_BUTTON).should('be.visible'); + }); - it('shows upgrade user risk button', () => { - cy.get(UPGRADE_USER_RISK_SCORE_BUTTON).should('be.visible'); + it('shows enable user risk button', () => { + cy.get(ENABLE_USER_RISK_SCORE_BUTTON).should('be.visible'); + }); }); - }); - describe('With host risk data', () => { - before(() => { - cy.task('esArchiverLoad', { archiveName: 'risk_hosts' }); - }); + describe('With host risk data', () => { + before(() => { + cy.task('esArchiverLoad', { archiveName: 'risk_hosts' }); + }); - beforeEach(() => { - login(); - visitWithTimeRange(ENTITY_ANALYTICS_URL); - }); + beforeEach(() => { + login(); + visitWithTimeRange(ENTITY_ANALYTICS_URL); + }); - after(() => { - cy.task('esArchiverUnload', 'risk_hosts'); - }); + after(() => { + cy.task('esArchiverUnload', 'risk_hosts'); + }); - it('renders donut chart', () => { - cy.get(HOSTS_DONUT_CHART).should('include.text', '6Total'); - }); + it('renders donut chart', () => { + cy.get(HOSTS_DONUT_CHART).should('include.text', '6Total'); + }); - it('renders table', () => { - cy.get(HOSTS_TABLE).should('be.visible'); - cy.get(HOSTS_TABLE_ROWS).should('have.length', 5); - }); + it('renders table', () => { + cy.get(HOSTS_TABLE).should('be.visible'); + cy.get(HOSTS_TABLE_ROWS).should('have.length', 5); + }); - it('renders alerts column', () => { - cy.get(HOSTS_TABLE_ALERT_CELL).should('have.length', 5); - }); + it('renders alerts column', () => { + cy.get(HOSTS_TABLE_ALERT_CELL).should('have.length', 5); + }); - it('filters by risk classification', () => { - openRiskTableFilterAndSelectTheLowOption(); + it('filters by risk classification', () => { + openRiskTableFilterAndSelectTheLowOption(); - cy.get(HOSTS_DONUT_CHART).should('include.text', '1Total'); - cy.get(HOSTS_TABLE_ROWS).should('have.length', 1); + cy.get(HOSTS_DONUT_CHART).should('include.text', '1Total'); + cy.get(HOSTS_TABLE_ROWS).should('have.length', 1); - removeLowFilterAndCloseRiskTableFilter(); - }); + removeLowFilterAndCloseRiskTableFilter(); + }); + + it('filters the host risk table with KQL search bar query', () => { + kqlSearch(`host.name : ${SIEM_KIBANA_HOST_NAME}{enter}`); - it('filters the host risk table with KQL search bar query', () => { - kqlSearch(`host.name : ${SIEM_KIBANA_HOST_NAME}{enter}`); + cy.get(HOSTS_DONUT_CHART).should('include.text', '1Total'); + cy.get(HOSTS_TABLE_ROWS).should('have.length', 1); - cy.get(HOSTS_DONUT_CHART).should('include.text', '1Total'); - cy.get(HOSTS_TABLE_ROWS).should('have.length', 1); + clearSearchBar(); + }); - clearSearchBar(); + describe('With alerts data', () => { + before(() => { + createRule(getNewRule()); + }); + + beforeEach(() => { + login(); + visitWithTimeRange(ALERTS_URL); + waitForAlertsToPopulate(); + visitWithTimeRange(ENTITY_ANALYTICS_URL); + }); + + after(() => { + deleteAlertsAndRules(); + }); + + it('populates alerts column', () => { + cy.get(HOSTS_TABLE_ALERT_CELL).first().should('include.text', SIEM_KIBANA_HOST_ALERTS); + }); + + it('filters the alerts count with time range', () => { + setEndDate(END_DATE); + updateDates(); + + cy.get(HOSTS_TABLE_ALERT_CELL).first().should('include.text', 0); + + // CLEAR DATES + setEndDateNow(); + updateDates(); + }); + + it('opens alerts page when alerts count is clicked', () => { + clickOnFirstHostsAlerts(); + cy.url().should('include', ALERTS_URL); + + cy.get(OPTION_LIST_LABELS).eq(0).should('include.text', 'Status'); + cy.get(OPTION_LIST_VALUES(0)).should('include.text', 'open'); + cy.get(OPTION_LIST_LABELS).eq(1).should('include.text', 'Host'); + cy.get(OPTION_LIST_VALUES(1)).should('include.text', SIEM_KIBANA_HOST_NAME); + }); + }); }); - describe('With alerts data', () => { + describe('With user risk data', () => { before(() => { - createRule(getNewRule()); + cy.task('esArchiverLoad', { archiveName: 'risk_users' }); }); beforeEach(() => { login(); - visitWithTimeRange(ALERTS_URL); - waitForAlertsToPopulate(); visitWithTimeRange(ENTITY_ANALYTICS_URL); }); after(() => { - deleteAlertsAndRules(); + cy.task('esArchiverUnload', 'risk_users'); + }); + + it('renders donut chart', () => { + cy.get(USERS_DONUT_CHART).should('include.text', '7Total'); + }); + + it('renders table', () => { + cy.get(USERS_TABLE).should('be.visible'); + cy.get(USERS_TABLE_ROWS).should('have.length', 5); }); - it('populates alerts column', () => { - cy.get(HOSTS_TABLE_ALERT_CELL).first().should('include.text', SIEM_KIBANA_HOST_ALERTS); + it('renders alerts column', () => { + cy.get(USERS_TABLE_ALERT_CELL).should('have.length', 5); }); - it('filters the alerts count with time range', () => { - setEndDate(END_DATE); - updateDates(); + it('filters by risk classification', () => { + openRiskTableFilterAndSelectTheLowOption(); - cy.get(HOSTS_TABLE_ALERT_CELL).first().should('include.text', 0); + cy.get(USERS_DONUT_CHART).should('include.text', '2Total'); + cy.get(USERS_TABLE_ROWS).should('have.length', 2); - // CLEAR DATES - setEndDateNow(); - updateDates(); + removeLowFilterAndCloseRiskTableFilter(); }); - it('opens alerts page when alerts count is clicked', () => { - clickOnFirstHostsAlerts(); - cy.url().should('include', ALERTS_URL); + it('filters the host risk table with KQL search bar query', () => { + kqlSearch(`user.name : ${TEST_USER_NAME}{enter}`); + + cy.get(USERS_DONUT_CHART).should('include.text', '1Total'); + cy.get(USERS_TABLE_ROWS).should('have.length', 1); - cy.get(OPTION_LIST_LABELS).eq(0).should('include.text', 'Status'); - cy.get(OPTION_LIST_VALUES(0)).should('include.text', 'open'); - cy.get(OPTION_LIST_LABELS).eq(1).should('include.text', 'Host'); - cy.get(OPTION_LIST_VALUES(1)).should('include.text', SIEM_KIBANA_HOST_NAME); + clearSearchBar(); + }); + + describe('With alerts data', () => { + before(() => { + createRule(getNewRule()); + }); + + beforeEach(() => { + login(); + visitWithTimeRange(ALERTS_URL); + waitForAlertsToPopulate(); + visitWithTimeRange(ENTITY_ANALYTICS_URL); + }); + + after(() => { + deleteAlertsAndRules(); + }); + + it('populates alerts column', () => { + cy.get(USERS_TABLE_ALERT_CELL).first().should('include.text', TEST_USER_ALERTS); + }); + + it('filters the alerts count with time range', () => { + setEndDate(END_DATE); + updateDates(); + + cy.get(USERS_TABLE_ALERT_CELL).first().should('include.text', 0); + + // CLEAR DATES + setEndDateNow(); + updateDates(); + }); + + it('opens alerts page when alerts count is clicked', () => { + clickOnFirstUsersAlerts(); + + cy.url().should('include', ALERTS_URL); + + cy.get(OPTION_LIST_LABELS).eq(0).should('include.text', 'Status'); + cy.get(OPTION_LIST_VALUES(0)).should('include.text', 'open'); + cy.get(OPTION_LIST_LABELS).eq(1).should('include.text', 'User'); + cy.get(OPTION_LIST_VALUES(1)).should('include.text', TEST_USER_NAME); + }); }); }); }); - describe('With user risk data', () => { - before(() => { - cy.task('esArchiverLoad', { archiveName: 'risk_users' }); - }); + describe('new risk score', () => { + describe('Without data', () => { + beforeEach(() => { + login(); + visitWithTimeRange(ENTITY_ANALYTICS_URL); + }); - beforeEach(() => { - login(); - visitWithTimeRange(ENTITY_ANALYTICS_URL); - }); + it('shows enable host and user risk button', () => { + cy.get(ENABLE_HOST_RISK_SCORE_BUTTON).should('be.visible'); - after(() => { - cy.task('esArchiverUnload', 'risk_users'); + cy.get(ENABLE_USER_RISK_SCORE_BUTTON).should('be.visible'); + }); }); - it('renders donut chart', () => { - cy.get(USERS_DONUT_CHART).should('include.text', '7Total'); - }); + describe('Risk Score enabled but still no data', () => { + before(() => { + cy.task('esArchiverLoad', { archiveName: 'risk_scores_new_no_data' }); + }); - it('renders table', () => { - cy.get(USERS_TABLE).should('be.visible'); - cy.get(USERS_TABLE_ROWS).should('have.length', 5); - }); + beforeEach(() => { + login(); + enableRiskEngine(); + visitWithTimeRange(ENTITY_ANALYTICS_URL); + }); + + afterEach(() => { + deleteRiskEngineConfiguration(); + }); + + after(() => { + cy.task('esArchiverUnload', 'risk_scores_new_no_data'); + }); - it('renders alerts column', () => { - cy.get(USERS_TABLE_ALERT_CELL).should('have.length', 5); + it('shows no data detected prompt for host and user risk scores', () => { + cy.get(HOST_RISK_SCORE_NO_DATA_DETECTED).should('be.visible'); + cy.get(USER_RISK_SCORE_NO_DATA_DETECTED).should('be.visible'); + }); }); - it('filters by risk classification', () => { - openRiskTableFilterAndSelectTheLowOption(); + describe('With host risk data', () => { + before(() => { + cy.task('esArchiverLoad', { archiveName: 'risk_scores_new' }); + login(); + enableRiskEngine(); + }); + + beforeEach(() => { + login(); + visitWithTimeRange(ENTITY_ANALYTICS_URL); + }); - cy.get(USERS_DONUT_CHART).should('include.text', '2Total'); - cy.get(USERS_TABLE_ROWS).should('have.length', 2); + after(() => { + cy.task('esArchiverUnload', 'risk_scores_new'); + deleteRiskEngineConfiguration(); + }); - removeLowFilterAndCloseRiskTableFilter(); - }); + it('renders donut chart', () => { + cy.get(HOSTS_DONUT_CHART).should('include.text', '6Total'); + }); + + it('renders table', () => { + cy.get(HOSTS_TABLE).should('be.visible'); + cy.get(HOSTS_TABLE_ROWS).should('have.length', 5); + }); - it('filters the host risk table with KQL search bar query', () => { - kqlSearch(`user.name : ${TEST_USER_NAME}{enter}`); + it('renders alerts column', () => { + cy.get(HOSTS_TABLE_ALERT_CELL).should('have.length', 5); + }); - cy.get(USERS_DONUT_CHART).should('include.text', '1Total'); - cy.get(USERS_TABLE_ROWS).should('have.length', 1); + it('filters by risk classification', () => { + cy.get(HOSTS_DONUT_CHART).should('include.text', '6Total'); + openRiskTableFilterAndSelectTheCriticalOption(); + + cy.get(HOSTS_DONUT_CHART).should('include.text', '1Total'); + cy.get(HOSTS_TABLE_ROWS).should('have.length', 1); + + removeCriticalFilterAndCloseRiskTableFilter(); + }); + + it('filters the host risk table with KQL search bar query', () => { + kqlSearch(`host.name : ${SIEM_KIBANA_HOST_NAME}{enter}`); + + cy.get(HOSTS_DONUT_CHART).should('include.text', '1Total'); + cy.get(HOSTS_TABLE_ROWS).should('have.length', 1); + + clearSearchBar(); + }); + + describe('With alerts data', () => { + before(() => { + createRule(getNewRule()); + }); - clearSearchBar(); + beforeEach(() => { + login(); + visitWithTimeRange(ALERTS_URL); + waitForAlertsToPopulate(); + visitWithTimeRange(ENTITY_ANALYTICS_URL); + }); + + after(() => { + deleteAlertsAndRules(); + }); + + it('populates alerts column', () => { + cy.get(HOSTS_TABLE_ALERT_CELL).first().should('include.text', SIEM_KIBANA_HOST_ALERTS); + }); + + it('filters the alerts count with time range', () => { + setEndDate(END_DATE); + updateDates(); + + cy.get(HOSTS_TABLE_ALERT_CELL).first().should('include.text', 0); + + // CLEAR DATES + setEndDateNow(); + updateDates(); + }); + + it('opens alerts page when alerts count is clicked', () => { + clickOnFirstHostsAlerts(); + cy.url().should('include', ALERTS_URL); + + cy.get(OPTION_LIST_LABELS).eq(0).should('include.text', 'Status'); + cy.get(OPTION_LIST_VALUES(0)).should('include.text', 'open'); + cy.get(OPTION_LIST_LABELS).eq(1).should('include.text', 'Host'); + cy.get(OPTION_LIST_VALUES(1)).should('include.text', SIEM_KIBANA_HOST_NAME); + }); + }); }); - describe('With alerts data', () => { + describe('With user risk data', () => { before(() => { - createRule(getNewRule()); + cy.task('esArchiverLoad', { archiveName: 'risk_scores_new' }); + login(); + enableRiskEngine(); }); beforeEach(() => { login(); - visitWithTimeRange(ALERTS_URL); - waitForAlertsToPopulate(); visitWithTimeRange(ENTITY_ANALYTICS_URL); }); after(() => { - deleteAlertsAndRules(); + cy.task('esArchiverUnload', 'risk_scores_new'); + deleteRiskEngineConfiguration(); + }); + + it('renders donut chart', () => { + cy.get(USERS_DONUT_CHART).should('include.text', '7Total'); + }); + + it('renders table', () => { + cy.get(USERS_TABLE).should('be.visible'); + cy.get(USERS_TABLE_ROWS).should('have.length', 5); }); - it('populates alerts column', () => { - cy.get(USERS_TABLE_ALERT_CELL).first().should('include.text', TEST_USER_ALERTS); + it('renders alerts column', () => { + cy.get(USERS_TABLE_ALERT_CELL).should('have.length', 5); }); - it('filters the alerts count with time range', () => { - setEndDate(END_DATE); - updateDates(); + it('filters by risk classification', () => { + cy.get(USERS_DONUT_CHART).should('include.text', '7Total'); - cy.get(USERS_TABLE_ALERT_CELL).first().should('include.text', 0); + openUserRiskTableFilterAndSelectTheLowOption(1); - // CLEAR DATES - setEndDateNow(); - updateDates(); + cy.get(USERS_DONUT_CHART).should('include.text', '1Total'); + cy.get(USERS_TABLE_ROWS).should('have.length', 1); + + removeLowFilterAndCloseUserRiskTableFilter(); + }); + + it('filters the host risk table with KQL search bar query', () => { + kqlSearch(`user.name : ${TEST_USER_NAME}{enter}`); + + cy.get(USERS_DONUT_CHART).should('include.text', '1Total'); + cy.get(USERS_TABLE_ROWS).should('have.length', 1); + + clearSearchBar(); }); - it('opens alerts page when alerts count is clicked', () => { - clickOnFirstUsersAlerts(); + describe('With alerts data', () => { + before(() => { + createRule(getNewRule()); + }); + + beforeEach(() => { + login(); + visitWithTimeRange(ALERTS_URL); + waitForAlertsToPopulate(); + visitWithTimeRange(ENTITY_ANALYTICS_URL); + }); + + after(() => { + deleteAlertsAndRules(); + }); + + it('populates alerts column', () => { + cy.get(USERS_TABLE_ALERT_CELL).first().should('include.text', TEST_USER_ALERTS); + }); + + it('filters the alerts count with time range', () => { + setEndDate(END_DATE); + updateDates(); + + cy.get(USERS_TABLE_ALERT_CELL).first().should('include.text', 0); + + // CLEAR DATES + setEndDateNow(); + updateDates(); + }); + + it('opens alerts page when alerts count is clicked', () => { + clickOnFirstUsersAlerts(); - cy.url().should('include', ALERTS_URL); + cy.url().should('include', ALERTS_URL); - cy.get(OPTION_LIST_LABELS).eq(0).should('include.text', 'Status'); - cy.get(OPTION_LIST_VALUES(0)).should('include.text', 'open'); - cy.get(OPTION_LIST_LABELS).eq(1).should('include.text', 'User'); - cy.get(OPTION_LIST_VALUES(1)).should('include.text', TEST_USER_NAME); + cy.get(OPTION_LIST_LABELS).eq(0).should('include.text', 'Status'); + cy.get(OPTION_LIST_VALUES(0)).should('include.text', 'open'); + cy.get(OPTION_LIST_LABELS).eq(1).should('include.text', 'User'); + cy.get(OPTION_LIST_VALUES(1)).should('include.text', TEST_USER_NAME); + }); }); }); }); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/upgrade_risk_score.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/upgrade_risk_score.cy.ts index c67d12bf2ad9a..e815e9eaa6cb4 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/upgrade_risk_score.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/explore/dashboards/upgrade_risk_score.cy.ts @@ -7,35 +7,32 @@ import { getNewRule } from '../../../objects/rule'; import { - RISK_SCORE_INSTALLATION_SUCCESS_TOAST, - UPGRADE_HOST_RISK_SCORE_BUTTON, - UPGRADE_USER_RISK_SCORE_BUTTON, - UPGRADE_CANCELLATION_BUTTON, - UPGRADE_CONFIRMATION_MODAL, - RISK_SCORE_DASHBOARDS_INSTALLATION_SUCCESS_TOAST, + UPGRADE_RISK_SCORE_BUTTON, + USERS_TABLE, + HOSTS_TABLE_ROWS, + HOSTS_TABLE, + USERS_TABLE_ROWS, + HOST_RISK_SCORE_NO_DATA_DETECTED, + USER_RISK_SCORE_NO_DATA_DETECTED, } from '../../../screens/entity_analytics'; +import { PAGE_TITLE } from '../../../screens/entity_analytics_management'; import { deleteRiskScore, installLegacyRiskScoreModule, + installRiskScoreModule, } from '../../../tasks/api_calls/risk_scores'; -import { findSavedObjects } from '../../../tasks/api_calls/risk_scores/saved_objects'; +import { clickUpgradeRiskScore } from '../../../tasks/risk_scores'; + import { createRule } from '../../../tasks/api_calls/rules'; import { cleanKibana } from '../../../tasks/common'; import { login } from '../../../tasks/login'; import { visitWithTimeRange } from '../../../tasks/navigation'; -import { - clickUpgradeRiskScore, - clickUpgradeRiskScoreConfirmed, - interceptUpgradeRiskScoreModule, - waitForUpgradeRiskScoreModule, -} from '../../../tasks/risk_scores'; + import { RiskScoreEntity } from '../../../tasks/risk_scores/common'; -import { - getRiskScoreLatestTransformId, - getRiskScorePivotTransformId, - getTransformState, -} from '../../../tasks/risk_scores/transforms'; + import { ENTITY_ANALYTICS_URL } from '../../../urls/navigation'; +import { upgradeRiskEngine } from '../../../tasks/entity_analytics'; +import { deleteRiskEngineConfiguration } from '../../../tasks/api_calls/risk_engine'; const spaceId = 'default'; @@ -44,152 +41,69 @@ describe('Upgrade risk scores', { tags: ['@ess', '@serverless', '@brokenInServer before(() => { cleanKibana(); login(); + deleteRiskEngineConfiguration(); createRule(getNewRule({ rule_id: 'rule1' })); }); - beforeEach(() => { - login(); - deleteRiskScore({ riskScoreEntity: RiskScoreEntity.host, spaceId }); - deleteRiskScore({ riskScoreEntity: RiskScoreEntity.user, spaceId }); - installLegacyRiskScoreModule(RiskScoreEntity.host, spaceId); - installLegacyRiskScoreModule(RiskScoreEntity.user, spaceId); - visitWithTimeRange(ENTITY_ANALYTICS_URL); - }); + describe('show upgrade risk button', () => { + beforeEach(() => { + login(); + deleteRiskScore({ riskScoreEntity: RiskScoreEntity.host, spaceId }); + deleteRiskScore({ riskScoreEntity: RiskScoreEntity.user, spaceId }); + installLegacyRiskScoreModule(RiskScoreEntity.host, spaceId); + installLegacyRiskScoreModule(RiskScoreEntity.user, spaceId); + visitWithTimeRange(ENTITY_ANALYTICS_URL); + }); - it('shows upgrade risk button for host and user', () => { - cy.get(UPGRADE_HOST_RISK_SCORE_BUTTON).should('be.visible'); - cy.get(UPGRADE_USER_RISK_SCORE_BUTTON).should('be.visible'); - }); + afterEach(() => { + deleteRiskScore({ riskScoreEntity: RiskScoreEntity.host, spaceId }); + deleteRiskScore({ riskScoreEntity: RiskScoreEntity.user, spaceId }); + cy.task('esArchiverUnload', 'risk_hosts'); + cy.task('esArchiverUnload', 'risk_users'); + }); - it( - 'should show a confirmation modal for upgrading host risk score and display a link to host risk score Elastic doc', - { tags: ['@brokenInServerless'] }, - () => { - clickUpgradeRiskScore(RiskScoreEntity.host); - cy.get(UPGRADE_CONFIRMATION_MODAL(RiskScoreEntity.host)).should('exist'); - - cy.get(UPGRADE_CANCELLATION_BUTTON) - .get(`${UPGRADE_CONFIRMATION_MODAL(RiskScoreEntity.host)} a`) - .then((link) => { - expect(link.prop('href')).to.eql( - `https://www.elastic.co/guide/en/security/current/${RiskScoreEntity.host}-risk-score.html` - ); - }); - } - ); - - it( - 'should show a confirmation modal for upgrading user risk score and display a link to user risk score Elastic doc', - { tags: ['@brokenInServerless'] }, - () => { - clickUpgradeRiskScore(RiskScoreEntity.user); - cy.get(UPGRADE_CONFIRMATION_MODAL(RiskScoreEntity.user)).should('exist'); - - cy.get(UPGRADE_CANCELLATION_BUTTON) - .get(`${UPGRADE_CONFIRMATION_MODAL(RiskScoreEntity.user)} a`) - .then((link) => { - expect(link.prop('href')).to.eql( - `https://www.elastic.co/guide/en/security/current/${RiskScoreEntity.user}-risk-score.html` - ); - }); - } - ); -}); + it('shows upgrade panel', () => { + cy.get(UPGRADE_RISK_SCORE_BUTTON).should('be.visible'); + + clickUpgradeRiskScore(); + + cy.get(PAGE_TITLE).should('have.text', 'Entity Risk Score'); + }); + }); -const versions: Array<'8.3' | '8.4'> = ['8.3', '8.4']; -versions.forEach((version) => - describe(`handles version ${version} upgrades`, () => { + describe('upgrade risk engine', () => { before(() => { - cleanKibana(); + cy.task('esArchiverLoad', { archiveName: 'risk_hosts' }); + cy.task('esArchiverLoad', { archiveName: 'risk_users' }); }); beforeEach(() => { login(); - createRule(getNewRule({ rule_id: 'rule1' })); - deleteRiskScore({ riskScoreEntity: RiskScoreEntity.host, spaceId }); - deleteRiskScore({ riskScoreEntity: RiskScoreEntity.user, spaceId }); - installLegacyRiskScoreModule(RiskScoreEntity.host, spaceId, version); - installLegacyRiskScoreModule(RiskScoreEntity.user, spaceId, version); + installRiskScoreModule(); visitWithTimeRange(ENTITY_ANALYTICS_URL); }); - afterEach(() => { + after(() => { + cy.task('esArchiverUnload', 'risk_hosts'); + cy.task('esArchiverUnload', 'risk_users'); deleteRiskScore({ riskScoreEntity: RiskScoreEntity.host, spaceId }); deleteRiskScore({ riskScoreEntity: RiskScoreEntity.user, spaceId }); + deleteRiskEngineConfiguration(); }); - it('should upgrade host risk score successfully', () => { - clickUpgradeRiskScore(RiskScoreEntity.host); - - interceptUpgradeRiskScoreModule(RiskScoreEntity.host, version); - - clickUpgradeRiskScoreConfirmed(); - waitForUpgradeRiskScoreModule(); - - cy.get(UPGRADE_HOST_RISK_SCORE_BUTTON).should('be.disabled'); - - cy.get(RISK_SCORE_INSTALLATION_SUCCESS_TOAST(RiskScoreEntity.host)).should('exist'); - cy.get(RISK_SCORE_DASHBOARDS_INSTALLATION_SUCCESS_TOAST(RiskScoreEntity.host)).should( - 'exist' - ); - - cy.get(UPGRADE_HOST_RISK_SCORE_BUTTON).should('not.exist'); - getTransformState(getRiskScorePivotTransformId(RiskScoreEntity.host, spaceId)).then((res) => { - expect(res.status).to.eq(200); - expect(res.body.transforms[0].id).to.eq( - getRiskScorePivotTransformId(RiskScoreEntity.host, spaceId) - ); - expect(res.body.transforms[0].state).to.eq('started'); - }); - getTransformState(getRiskScoreLatestTransformId(RiskScoreEntity.host, spaceId)).then( - (res) => { - expect(res.status).to.eq(200); - expect(res.body.transforms[0].id).to.eq( - getRiskScoreLatestTransformId(RiskScoreEntity.host, spaceId) - ); - expect(res.body.transforms[0].state).to.eq('started'); - } - ); - findSavedObjects(RiskScoreEntity.host, spaceId).then((res) => { - expect(res.status).to.eq(200); - expect(res.body.saved_objects.length).to.eq(11); - }); - }); + it('show old risk score data before upgrade, and hide after', () => { + cy.get(HOSTS_TABLE).should('be.visible'); + cy.get(HOSTS_TABLE_ROWS).should('have.length', 5); + + cy.get(USERS_TABLE).should('be.visible'); + cy.get(USERS_TABLE_ROWS).should('have.length', 5); + + upgradeRiskEngine(); - it('should upgrade user risk score successfully', () => { - clickUpgradeRiskScore(RiskScoreEntity.user); - interceptUpgradeRiskScoreModule(RiskScoreEntity.user); - clickUpgradeRiskScoreConfirmed(); - waitForUpgradeRiskScoreModule(); - cy.get(UPGRADE_USER_RISK_SCORE_BUTTON).should('be.disabled'); - - cy.get(RISK_SCORE_INSTALLATION_SUCCESS_TOAST(RiskScoreEntity.user)).should('exist'); - cy.get(RISK_SCORE_DASHBOARDS_INSTALLATION_SUCCESS_TOAST(RiskScoreEntity.user)).should( - 'exist' - ); - - cy.get(UPGRADE_USER_RISK_SCORE_BUTTON).should('not.exist'); - getTransformState(getRiskScorePivotTransformId(RiskScoreEntity.user, spaceId)).then((res) => { - expect(res.status).to.eq(200); - expect(res.body.transforms[0].id).to.eq( - getRiskScorePivotTransformId(RiskScoreEntity.user, spaceId) - ); - expect(res.body.transforms[0].state).to.eq('started'); - }); - getTransformState(getRiskScoreLatestTransformId(RiskScoreEntity.user, spaceId)).then( - (res) => { - expect(res.status).to.eq(200); - expect(res.body.transforms[0].id).to.eq( - getRiskScoreLatestTransformId(RiskScoreEntity.user, spaceId) - ); - expect(res.body.transforms[0].state).to.eq('started'); - } - ); - - findSavedObjects(RiskScoreEntity.user, spaceId).then((res) => { - expect(res.status).to.eq(200); - expect(res.body.saved_objects.length).to.eq(11); - }); + visitWithTimeRange(ENTITY_ANALYTICS_URL); + + cy.get(HOST_RISK_SCORE_NO_DATA_DETECTED).should('be.visible'); + cy.get(USER_RISK_SCORE_NO_DATA_DETECTED).should('be.visible'); }); - }) -); + }); +}); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/explore/host_details/risk_tab.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/explore/host_details/risk_tab.cy.ts index 5eb5c172f0517..2ef24ae0df1ee 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/explore/host_details/risk_tab.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/explore/host_details/risk_tab.cy.ts @@ -10,43 +10,88 @@ import { visitHostDetailsPage } from '../../../tasks/navigation'; import { cleanKibana, waitForTableToLoad } from '../../../tasks/common'; import { TABLE_CELL, TABLE_ROWS } from '../../../screens/alerts_details'; +import { deleteRiskEngineConfiguration } from '../../../tasks/api_calls/risk_engine'; +import { openRiskInformationFlyout, enableRiskEngine } from '../../../tasks/entity_analytics'; +import { ALERTS_COUNT, ALERT_GRID_CELL } from '../../../screens/alerts'; +import { RISK_INFORMATION_FLYOUT_HEADER } from '../../../screens/entity_analytics'; +import { navigateToHostRiskDetailTab } from '../../../tasks/host_risk'; describe('risk tab', { tags: ['@ess', '@serverless', '@brokenInServerless'] }, () => { - before(() => { - cleanKibana(); - // illegal_argument_exception: unknown setting [index.lifecycle.rollover_alias] - cy.task('esArchiverLoad', { archiveName: 'risk_hosts' }); - }); + describe('with legacy risk score', () => { + before(() => { + cleanKibana(); + // illegal_argument_exception: unknown setting [index.lifecycle.rollover_alias] + cy.task('esArchiverLoad', { archiveName: 'risk_hosts' }); + }); - beforeEach(() => { - login(); - }); + beforeEach(() => { + login(); + deleteRiskEngineConfiguration(); + }); - after(() => { - cy.task('esArchiverUnload', 'risk_hosts'); - }); + after(() => { + cy.task('esArchiverUnload', 'risk_hosts'); + }); + + it('renders risk tab', () => { + visitHostDetailsPage('siem-kibana'); + navigateToHostRiskDetailTab(); + waitForTableToLoad(); + + cy.get('[data-test-subj="topRiskScoreContributors"]') + .find(TABLE_ROWS) + .within(() => { + cy.get(TABLE_CELL).contains('Unusual Linux Username'); + }); + }); + + it('shows risk information overlay when button is clicked', () => { + visitHostDetailsPage('siem-kibana'); + navigateToHostRiskDetailTab(); + waitForTableToLoad(); - it('renders risk tab', () => { - visitHostDetailsPage('siem-kibana'); - cy.get('[data-test-subj="navigation-hostRisk"]').click(); - waitForTableToLoad(); + openRiskInformationFlyout(); - cy.get('[data-test-subj="topRiskScoreContributors"]') - .find(TABLE_ROWS) - .within(() => { - cy.get(TABLE_CELL).contains('Unusual Linux Username'); - }); + cy.get(RISK_INFORMATION_FLYOUT_HEADER).contains('How is host risk calculated?'); + }); }); - it('shows risk information overlay when button is clicked', () => { - visitHostDetailsPage('siem-kibana'); - cy.get('[data-test-subj="navigation-hostRisk"]').click(); - waitForTableToLoad(); + describe('with new risk score', () => { + before(() => { + cleanKibana(); + cy.task('esArchiverLoad', { archiveName: 'risk_scores_new' }); + cy.task('esArchiverLoad', { archiveName: 'query_alert' }); + login(); + enableRiskEngine(); + }); + + beforeEach(() => { + login(); + }); + + after(() => { + cy.task('esArchiverUnload', 'risk_scores_new'); + cy.task('esArchiverUnload', 'query_alert'); + deleteRiskEngineConfiguration(); + }); + + it('renders risk tab', () => { + visitHostDetailsPage('Host-fwarau82er'); + navigateToHostRiskDetailTab(); + waitForTableToLoad(); + + cy.get(ALERTS_COUNT).should('have.text', '1 alert'); + cy.get(ALERT_GRID_CELL).contains('Endpoint Security'); + }); + + it('shows risk information overlay when button is clicked', () => { + visitHostDetailsPage('siem-kibana'); + navigateToHostRiskDetailTab(); + waitForTableToLoad(); - cy.get('[data-test-subj="open-risk-information-flyout-trigger"]').click(); + openRiskInformationFlyout(); - cy.get('[data-test-subj="open-risk-information-flyout"] .euiFlyoutHeader').contains( - 'How is host risk calculated?' - ); + cy.get(RISK_INFORMATION_FLYOUT_HEADER).contains('How is host risk calculated?'); + }); }); }); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/explore/hosts/host_risk_tab.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/explore/hosts/host_risk_tab.cy.ts index 0c76cdc804997..695f261c599d0 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/explore/hosts/host_risk_tab.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/explore/hosts/host_risk_tab.cy.ts @@ -18,53 +18,114 @@ import { HOST_BY_RISK_TABLE_NEXT_PAGE_BUTTON, } from '../../../screens/hosts/host_risk'; import { login } from '../../../tasks/login'; -import { visit } from '../../../tasks/navigation'; +import { visitWithTimeRange } from '../../../tasks/navigation'; import { hostsUrl } from '../../../urls/navigation'; import { clearSearchBar, kqlSearch } from '../../../tasks/security_header'; +import { deleteRiskEngineConfiguration } from '../../../tasks/api_calls/risk_engine'; +import { enableRiskEngine } from '../../../tasks/entity_analytics'; // Tracked by https://github.com/elastic/security-team/issues/7696 -describe.skip('risk tab', { tags: ['@ess', '@brokenInServerless'] }, () => { - before(() => { - cleanKibana(); - cy.task('esArchiverLoad', { archiveName: 'risk_hosts' }); - }); +describe('risk tab', { tags: ['@ess', '@brokenInServerless'] }, () => { + describe('with legacy risk score', () => { + before(() => { + cleanKibana(); + login(); + deleteRiskEngineConfiguration(); + cy.task('esArchiverLoad', { archiveName: 'risk_hosts' }); + }); - beforeEach(() => { - login(); - visit(hostsUrl('allHosts')); - navigateToHostRiskDetailTab(); - }); + beforeEach(() => { + login(); + visitWithTimeRange(hostsUrl('allHosts')); + // by some reason after navigate to host risk, page is sometimes is reload or go to all host tab + // this fix wait until we fave host in all host table, and then we go to risk tab + cy.contains('siem-kibana'); + navigateToHostRiskDetailTab(); + }); - after(() => { - cy.task('esArchiverUnload', 'risk_hosts'); - }); + after(() => { + cy.task('esArchiverUnload', 'risk_hosts'); + }); - it('renders the table', () => { - kqlSearch('host.name: "siem-kibana" {enter}'); - cy.get(HOST_BY_RISK_TABLE_CELL).eq(3).should('have.text', 'siem-kibana'); - cy.get(HOST_BY_RISK_TABLE_CELL).eq(4).should('have.text', '21'); - cy.get(HOST_BY_RISK_TABLE_CELL).eq(5).should('have.text', 'Low'); - clearSearchBar(); - }); + it('renders the table', () => { + kqlSearch('host.name: "siem-kibana" {enter}'); + cy.get(HOST_BY_RISK_TABLE_CELL).eq(3).should('have.text', 'siem-kibana'); + cy.get(HOST_BY_RISK_TABLE_CELL).eq(4).should('have.text', '21'); + cy.get(HOST_BY_RISK_TABLE_CELL).eq(5).should('have.text', 'Low'); + clearSearchBar(); + }); - it.skip('filters the table', () => { - openRiskTableFilterAndSelectTheCriticalOption(); + it.skip('filters the table', () => { + openRiskTableFilterAndSelectTheCriticalOption(); - cy.get(HOST_BY_RISK_TABLE_CELL).eq(3).should('not.have.text', 'siem-kibana'); + cy.get(HOST_BY_RISK_TABLE_CELL).eq(3).should('not.have.text', 'siem-kibana'); - removeCriticalFilterAndCloseRiskTableFilter(); - }); + removeCriticalFilterAndCloseRiskTableFilter(); + }); + + // Flaky + it.skip('should be able to change items count per page', () => { + selectFiveItemsPerPageOption(); - // Flaky - it.skip('should be able to change items count per page', () => { - selectFiveItemsPerPageOption(); + cy.get(HOST_BY_RISK_TABLE_HOSTNAME_CELL).should('have.length', 5); + }); - cy.get(HOST_BY_RISK_TABLE_HOSTNAME_CELL).should('have.length', 5); + it('should not allow page change when page is empty', () => { + kqlSearch('host.name: "nonexistent_host" {enter}'); + cy.get(HOST_BY_RISK_TABLE_NEXT_PAGE_BUTTON).should(`not.exist`); + clearSearchBar(); + }); }); - it('should not allow page change when page is empty', () => { - kqlSearch('host.name: "nonexistent_host" {enter}'); - cy.get(HOST_BY_RISK_TABLE_NEXT_PAGE_BUTTON).should(`not.exist`); - clearSearchBar(); + describe('with new risk score', () => { + before(() => { + cleanKibana(); + cy.task('esArchiverLoad', { archiveName: 'risk_scores_new' }); + login(); + enableRiskEngine(); + }); + + beforeEach(() => { + login(); + visitWithTimeRange(hostsUrl('allHosts')); + // by some reason after navigate to host risk, page is sometimes is reload or go to all host tab + // this fix wait until we fave host in all host table, and then we go to risk tab + cy.contains('siem-kibana'); + navigateToHostRiskDetailTab(); + }); + + after(() => { + cy.task('esArchiverUnload', 'risk_scores_new'); + deleteRiskEngineConfiguration(); + }); + + it('renders the table', () => { + kqlSearch('host.name: "siem-kibana" {enter}'); + cy.get(HOST_BY_RISK_TABLE_CELL).eq(3).should('have.text', 'siem-kibana'); + cy.get(HOST_BY_RISK_TABLE_CELL).eq(4).should('have.text', '90'); + cy.get(HOST_BY_RISK_TABLE_CELL).eq(5).should('have.text', 'Critical'); + clearSearchBar(); + }); + + it.skip('filters the table', () => { + openRiskTableFilterAndSelectTheCriticalOption(); + + cy.get(HOST_BY_RISK_TABLE_CELL).eq(3).should('not.have.text', 'siem-kibana'); + + removeCriticalFilterAndCloseRiskTableFilter(); + }); + + // Flaky + it.skip('should be able to change items count per page', () => { + selectFiveItemsPerPageOption(); + + cy.get(HOST_BY_RISK_TABLE_HOSTNAME_CELL).should('have.length', 5); + }); + + it('should not allow page change when page is empty', () => { + kqlSearch('host.name: "nonexistent_host" {enter}'); + cy.get(HOST_BY_RISK_TABLE_NEXT_PAGE_BUTTON).should(`not.exist`); + clearSearchBar(); + }); }); }); diff --git a/x-pack/test/security_solution_cypress/cypress/e2e/explore/hosts/hosts_risk_column.cy.ts b/x-pack/test/security_solution_cypress/cypress/e2e/explore/hosts/hosts_risk_column.cy.ts index 41a0bf4fe0fff..a1bdff9a35072 100644 --- a/x-pack/test/security_solution_cypress/cypress/e2e/explore/hosts/hosts_risk_column.cy.ts +++ b/x-pack/test/security_solution_cypress/cypress/e2e/explore/hosts/hosts_risk_column.cy.ts @@ -12,27 +12,58 @@ import { hostsUrl } from '../../../urls/navigation'; import { cleanKibana } from '../../../tasks/common'; import { TABLE_CELL } from '../../../screens/alerts_details'; import { kqlSearch } from '../../../tasks/security_header'; +import { deleteRiskEngineConfiguration } from '../../../tasks/api_calls/risk_engine'; +import { enableRiskEngine } from '../../../tasks/entity_analytics'; describe('All hosts table', { tags: ['@ess', '@serverless', '@brokenInServerless'] }, () => { - before(() => { - cleanKibana(); - // illegal_argument_exception: unknown setting [index.lifecycle.name] - cy.task('esArchiverLoad', { archiveName: 'risk_hosts' }); - }); + describe('with legacy risk score', () => { + before(() => { + cleanKibana(); + // illegal_argument_exception: unknown setting [index.lifecycle.name] + cy.task('esArchiverLoad', { archiveName: 'risk_hosts' }); + }); - beforeEach(() => { - login(); - }); + beforeEach(() => { + login(); + deleteRiskEngineConfiguration(); + }); + + after(() => { + cy.task('esArchiverUnload', 'risk_hosts'); + }); + + it('it renders risk column', () => { + visitWithTimeRange(hostsUrl('allHosts')); + kqlSearch('host.name: "siem-kibana" {enter}'); - after(() => { - cy.task('esArchiverUnload', 'risk_hosts'); + cy.get('[data-test-subj="tableHeaderCell_node.risk_4"]').should('exist'); + cy.get(`${TABLE_CELL} .euiTableCellContent`).eq(4).should('have.text', 'Low'); + }); }); - it('it renders risk column', () => { - visitWithTimeRange(hostsUrl('allHosts')); - kqlSearch('host.name: "siem-kibana" {enter}'); + describe('with new risk score', () => { + before(() => { + cleanKibana(); + // illegal_argument_exception: unknown setting [index.lifecycle.name] + cy.task('esArchiverLoad', { archiveName: 'risk_scores_new' }); + }); + + beforeEach(() => { + login(); + enableRiskEngine(); + }); + + after(() => { + cy.task('esArchiverUnload', 'risk_scores_new'); + deleteRiskEngineConfiguration(); + }); + + it('it renders risk column', () => { + visitWithTimeRange(hostsUrl('allHosts')); + kqlSearch('host.name: "siem-kibana" {enter}'); - cy.get('[data-test-subj="tableHeaderCell_node.risk_4"]').should('exist'); - cy.get(`${TABLE_CELL} .euiTableCellContent`).eq(4).should('have.text', 'Low'); + cy.get('[data-test-subj="tableHeaderCell_node.risk_4"]').should('exist'); + cy.get(`${TABLE_CELL} .euiTableCellContent`).eq(4).should('have.text', 'Critical'); + }); }); }); diff --git a/x-pack/test/security_solution_cypress/cypress/screens/entity_analytics.ts b/x-pack/test/security_solution_cypress/cypress/screens/entity_analytics.ts index f41ae2a175f05..dccef9c6cfccd 100644 --- a/x-pack/test/security_solution_cypress/cypress/screens/entity_analytics.ts +++ b/x-pack/test/security_solution_cypress/cypress/screens/entity_analytics.ts @@ -13,6 +13,8 @@ export const UPGRADE_HOST_RISK_SCORE_BUTTON = '[data-test-subj="host-risk-score- export const UPGRADE_USER_RISK_SCORE_BUTTON = '[data-test-subj="user-risk-score-upgrade"]'; +export const UPGRADE_RISK_SCORE_BUTTON = '[data-test-subj="update-risk-score-button"]'; + export const HOST_RISK_SCORE_NO_DATA_DETECTED = '[data-test-subj="host-risk-score-no-data-detected"]'; @@ -68,3 +70,9 @@ export const USERS_TABLE_ALERT_CELL = export const HOSTS_TABLE_ALERT_CELL = '[data-test-subj="entity_analytics_hosts"] [data-test-subj="risk-score-alerts"]'; + +export const OPEN_RISK_INFORMATION_FLYOUT_BUTTON = + '[data-test-subj="open-risk-information-flyout-trigger"]'; + +export const RISK_INFORMATION_FLYOUT_HEADER = + '[data-test-subj="open-risk-information-flyout"] .euiFlyoutHeader'; diff --git a/x-pack/test/security_solution_cypress/cypress/screens/entity_analytics_management.ts b/x-pack/test/security_solution_cypress/cypress/screens/entity_analytics_management.ts index 00bac740fe3c5..e7b67db8399b7 100644 --- a/x-pack/test/security_solution_cypress/cypress/screens/entity_analytics_management.ts +++ b/x-pack/test/security_solution_cypress/cypress/screens/entity_analytics_management.ts @@ -29,7 +29,7 @@ export const RISK_SCORE_UPDATE_CANCEL = '[data-test-subj="risk-score-update-canc export const RISK_SCORE_UPDATE_CONFIRM = '[data-test-subj="risk-score-update-confirm"]'; -export const RISK_SCORE_UDATE_BUTTON = '[data-test-subj="risk-score-update-button"]'; +export const RISK_SCORE_UPDATE_BUTTON = '[data-test-subj="risk-score-update-button"]'; export const RISK_SCORE_STATUS = '[data-test-subj="risk-score-status"]'; diff --git a/x-pack/test/security_solution_cypress/cypress/screens/users/user_risk_score.ts b/x-pack/test/security_solution_cypress/cypress/screens/users/user_risk_score.ts index 816334d7fc197..f16c6e0d6b3b1 100644 --- a/x-pack/test/security_solution_cypress/cypress/screens/users/user_risk_score.ts +++ b/x-pack/test/security_solution_cypress/cypress/screens/users/user_risk_score.ts @@ -7,3 +7,6 @@ export const RISK_SCORE_TAB = '[data-test-subj="navigation-userRisk"]'; export const RISK_SCORE_TAB_CONTENT = '[data-test-subj="table-userRisk-loading-false"]'; + +export const USER_BY_RISK_TABLE_FILTER = '[data-test-subj="risk-filter-button"]'; +export const USER_BY_RISK_TABLE_FILTER_LOW = '[data-test-subj="risk-filter-item-Low"]'; diff --git a/x-pack/test/security_solution_cypress/cypress/tasks/api_calls/risk_engine.ts b/x-pack/test/security_solution_cypress/cypress/tasks/api_calls/risk_engine.ts index 7305bef6f0b88..a8b15aa5e010b 100644 --- a/x-pack/test/security_solution_cypress/cypress/tasks/api_calls/risk_engine.ts +++ b/x-pack/test/security_solution_cypress/cypress/tasks/api_calls/risk_engine.ts @@ -5,7 +5,7 @@ * 2.0. */ -export const deleteConfiguration = () => { +export const deleteRiskEngineConfiguration = () => { cy.request({ method: 'GET', url: `/api/saved_objects/_find?type=risk-engine-configuration`, diff --git a/x-pack/test/security_solution_cypress/cypress/tasks/entity_analytics.ts b/x-pack/test/security_solution_cypress/cypress/tasks/entity_analytics.ts index 2d8582198c4e0..31a2ffb2afb5a 100644 --- a/x-pack/test/security_solution_cypress/cypress/tasks/entity_analytics.ts +++ b/x-pack/test/security_solution_cypress/cypress/tasks/entity_analytics.ts @@ -10,11 +10,13 @@ import { ANOMALIES_TABLE_ROWS, ANOMALIES_TABLE_ENABLE_JOB_BUTTON, ANOMALIES_TABLE_NEXT_PAGE_BUTTON, + OPEN_RISK_INFORMATION_FLYOUT_BUTTON, } from '../screens/entity_analytics'; -import { ENTITY_ANALYTICS_URL } from '../urls/navigation'; +import { RISK_SCORE_STATUS } from '../screens/entity_analytics_management'; +import { ENTITY_ANALYTICS_URL, ENTITY_ANALYTICS_MANAGEMENT_URL } from '../urls/navigation'; import { RISK_SCORE_UPDATE_CONFIRM, - RISK_SCORE_UDATE_BUTTON, + RISK_SCORE_UPDATE_BUTTON, RISK_SCORE_SWITCH, RISK_PREVIEW_ERROR_BUTTON, } from '../screens/entity_analytics_management'; @@ -42,8 +44,14 @@ export const riskEngineStatusChange = () => { cy.get(RISK_SCORE_SWITCH).click(); }; +export const enableRiskEngine = () => { + cy.visit(ENTITY_ANALYTICS_MANAGEMENT_URL); + cy.get(RISK_SCORE_STATUS).should('have.text', 'Off'); + riskEngineStatusChange(); +}; + export const updateRiskEngine = () => { - cy.get(RISK_SCORE_UDATE_BUTTON).click(); + cy.get(RISK_SCORE_UPDATE_BUTTON).click(); }; export const updateRiskEngineConfirm = () => { @@ -53,3 +61,12 @@ export const updateRiskEngineConfirm = () => { export const previewErrorButtonClick = () => { cy.get(RISK_PREVIEW_ERROR_BUTTON).click(); }; + +export const openRiskInformationFlyout = () => cy.get(OPEN_RISK_INFORMATION_FLYOUT_BUTTON).click(); + +export const upgradeRiskEngine = () => { + visitWithTimeRange(ENTITY_ANALYTICS_MANAGEMENT_URL); + updateRiskEngine(); + updateRiskEngineConfirm(); + cy.get(RISK_SCORE_STATUS).should('have.text', 'On'); +}; diff --git a/x-pack/test/security_solution_cypress/cypress/tasks/host_risk.ts b/x-pack/test/security_solution_cypress/cypress/tasks/host_risk.ts index 2bb3c97db95bc..ebf95a1d6aeca 100644 --- a/x-pack/test/security_solution_cypress/cypress/tasks/host_risk.ts +++ b/x-pack/test/security_solution_cypress/cypress/tasks/host_risk.ts @@ -21,7 +21,7 @@ export const navigateToHostRiskDetailTab = () => { }; export const openRiskTableFilterAndSelectTheCriticalOption = () => { - cy.get(HOST_BY_RISK_TABLE_FILTER).click(); + cy.get(HOST_BY_RISK_TABLE_FILTER).first().click(); cy.get(HOST_BY_RISK_TABLE_FILTER_CRITICAL).click(); }; diff --git a/x-pack/test/security_solution_cypress/cypress/tasks/risk_scores/index.ts b/x-pack/test/security_solution_cypress/cypress/tasks/risk_scores/index.ts index d48a23c4f7471..6634eab16ec79 100644 --- a/x-pack/test/security_solution_cypress/cypress/tasks/risk_scores/index.ts +++ b/x-pack/test/security_solution_cypress/cypress/tasks/risk_scores/index.ts @@ -10,8 +10,7 @@ import { ENABLE_USER_RISK_SCORE_BUTTON, HOSTS_TABLE_ALERT_CELL, UPGRADE_CONFIRMATION_BUTTON, - UPGRADE_HOST_RISK_SCORE_BUTTON, - UPGRADE_USER_RISK_SCORE_BUTTON, + UPGRADE_RISK_SCORE_BUTTON, USERS_TABLE_ALERT_CELL, } from '../../screens/entity_analytics'; import { @@ -68,13 +67,8 @@ export const clickEnableRiskScore = (riskScoreEntity: RiskScoreEntity) => { cy.get(button).click(); }; -export const clickUpgradeRiskScore = (riskScoreEntity: RiskScoreEntity) => { - const button = - riskScoreEntity === RiskScoreEntity.user - ? UPGRADE_USER_RISK_SCORE_BUTTON - : UPGRADE_HOST_RISK_SCORE_BUTTON; - - cy.get(button).click(); +export const clickUpgradeRiskScore = () => { + cy.get(UPGRADE_RISK_SCORE_BUTTON).click(); }; export const clickUpgradeRiskScoreConfirmed = () => { diff --git a/x-pack/test/security_solution_cypress/cypress/tasks/user_risk.ts b/x-pack/test/security_solution_cypress/cypress/tasks/user_risk.ts new file mode 100644 index 0000000000000..dd1150b36faff --- /dev/null +++ b/x-pack/test/security_solution_cypress/cypress/tasks/user_risk.ts @@ -0,0 +1,21 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License + * 2.0; you may not use this file except in compliance with the Elastic License + * 2.0. + */ + +import { + USER_BY_RISK_TABLE_FILTER, + USER_BY_RISK_TABLE_FILTER_LOW, +} from '../screens/users/user_risk_score'; + +export const openUserRiskTableFilterAndSelectTheLowOption = (eq = 0) => { + cy.get(USER_BY_RISK_TABLE_FILTER).eq(eq).click(); + cy.get(USER_BY_RISK_TABLE_FILTER_LOW).click(); +}; + +export const removeLowFilterAndCloseUserRiskTableFilter = () => { + cy.get(USER_BY_RISK_TABLE_FILTER_LOW).click(); + cy.get(USER_BY_RISK_TABLE_FILTER).first().click(); +}; diff --git a/x-pack/test/security_solution_cypress/es_archives/query_alert/data.json b/x-pack/test/security_solution_cypress/es_archives/query_alert/data.json index 94328064bd5e4..dc677dd5bf812 100644 --- a/x-pack/test/security_solution_cypress/es_archives/query_alert/data.json +++ b/x-pack/test/security_solution_cypress/es_archives/query_alert/data.json @@ -119,6 +119,9 @@ "path": "C:/fake_malware.exe", "size": 3456 }, + "user": { + "name": "user1" + }, "host": { "architecture": "wtnozeqvub", "hostname": "Host-fwarau82er", diff --git a/x-pack/test/security_solution_cypress/es_archives/risk_scores_new/data.json b/x-pack/test/security_solution_cypress/es_archives/risk_scores_new/data.json new file mode 100644 index 0000000000000..53d13ea650ec2 --- /dev/null +++ b/x-pack/test/security_solution_cypress/es_archives/risk_scores_new/data.json @@ -0,0 +1,485 @@ +{ + "type": "doc", + "value": { + "id": "a4cf452c1e0375c3d4412cb550ad1783358468a3b3b777da4829d72c7d6fb74f", + "index": "risk-score.risk-score-latest-default", + "source": { + "@timestamp": "2021-03-10T14:51:05.766Z", + "host": { + "name": "siem-kibana", + "risk": { + "calculated_level": "Critical", + "calculated_score_norm": 90, + "id_field": "host.name", + "id_value": "siem-kibana", + "calculated_score": 150, + "category_1_score": 150, + "category_1_count": 1, + "notes": [], + "inputs": [ + { + "id": "62895f54816047b9bf82929a61a6c571f41de9c2361670f6ef0136360e006f58", + "index": ".internal.alerts-security.alerts-default-000001", + "description": "New Rule Test", + "category": "category_1", + "risk_score": 70, + "timestamp": "2023-08-14T09:08:18.664Z" + }, + { + "id": "e5bf3da3c855486ac7b40fa1aa33e19cf1380e413b79ed76bddf728f8fec4462", + "index": ".internal.alerts-security.alerts-default-000001", + "description": "New Rule Test", + "category": "category_1", + "risk_score": 70, + "timestamp": "2023-08-14T09:08:18.664Z" + } + ] + } + } + } + } +} + +{ + "type": "doc", + "value": { + "id": "a2cf452c1e0375c3d4412cb550bd1783358468a3b3b777da4829d72c7d6fb71f", + "index": "risk-score.risk-score-latest-default", + "source": { + "@timestamp": "2021-03-10T14:51:05.766Z", + "host": { + "name": "fake-1", + "risk": { + "calculated_level": "Moderate", + "calculated_score_norm": 50, + "id_field": "host.name", + "id_value": "fake-1", + "calculated_score": 200, + "category_1_score": 200, + "category_1_count": 1, + "notes": [], + "inputs": [ + { + "id": "2e17f189-d77d-4537-8d84-592e29334493", + "index": ".internal.alerts-security.alerts-default-000001", + "description": "Alert from Rule: Rule 2", + "category": "category_1", + "risk_score": 70, + "timestamp": "2023-08-14T09:08:18.664Z" + } + ] + } + } + } + } +} + + +{ + "type": "doc", + "value": { + "id": "a2cf452c1e0375c3d4412cb550bd1283358468a3b3b777da4829d72c7d6fb72f", + "index": "risk-score.risk-score-latest-default", + "source": { + "@timestamp": "2021-03-10T14:51:05.766Z", + "host": { + "name": "fake-2", + "risk": { + "calculated_level": "Moderate", + "calculated_score_norm": 50, + "id_field": "host.name", + "id_value": "fake-2", + "calculated_score": 220, + "category_1_score": 200, + "category_1_count": 1, + "notes": [], + "inputs": [ + { + "id": "2e17f189-d77d-4537-8d84-592e29334493", + "index": ".internal.alerts-security.alerts-default-000001", + "description": "Alert from Rule: Rule 2", + "category": "category_1", + "risk_score": 70, + "timestamp": "2023-08-14T09:08:18.664Z" + } + ] + } + } + } + } +} + +{ + "type": "doc", + "value": { + "id": "a2cf452c1e0375c3d4412cb550bd1782358468a3b3b777da4829d72c7d6fb73f", + "index": "risk-score.risk-score-latest-default", + "source": { + "@timestamp": "2021-03-10T14:51:05.766Z", + "host": { + "name": "fake-3", + "risk": { + "calculated_level": "Moderate", + "calculated_score_norm": 50, + "id_field": "host.name", + "id_value": "fake-3", + "calculated_score": 220, + "category_1_score": 220, + "category_1_count": 1, + "notes": [], + "inputs": [ + { + "id": "2e17f189-d77d-4537-8d84-592e29334493", + "index": ".internal.alerts-security.alerts-default-000001", + "description": "Alert from Rule: Rule 2", + "category": "category_1", + "risk_score": 70, + "timestamp": "2023-08-14T09:08:18.664Z" + } + ] + } + } + } + } +} + +{ + "type": "doc", + "value": { + "id": "a2cf452c1e0375c3d4412cb550bd1783358468a3b3b777da4829d72c7d6fb745", + "index": "risk-score.risk-score-latest-default", + "source": { + "@timestamp": "2021-03-10T14:51:05.766Z", + "host": { + "name": "fake-4", + "risk": { + "calculated_level": "Moderate", + "calculated_score_norm": 50, + "id_field": "host.name", + "id_value": "fake-4", + "calculated_score": 220, + "category_1_score": 200, + "category_1_count": 1, + "notes": [], + "inputs": [ + { + "id": "2e17f189-d77d-4537-8d84-592e29334493", + "index": ".internal.alerts-security.alerts-default-000001", + "description": "Alert from Rule: Rule 2", + "category": "category_1", + "risk_score": 70, + "timestamp": "2023-08-14T09:08:18.664Z" + } + ] + } + } + } + } +} + +{ + "type": "doc", + "value": { + "id": "a2cf452c1e0375c3d4412cb550bd1783358468a3b3b777da4829d72c7d6fb752", + "index": "risk-score.risk-score-latest-default", + "source": { + "@timestamp": "2021-03-10T14:51:05.766Z", + "host": { + "name": "fake-5", + "risk": { + "calculated_level": "Moderate", + "calculated_score_norm": 50, + "id_field": "host.name", + "id_value": "fake-5", + "calculated_score": 220, + "category_1_score": 220, + "category_1_count": 1, + "notes": [], + "inputs": [ + { + "id": "2e17f189-d77d-4537-8d84-592e29334493", + "index": ".internal.alerts-security.alerts-default-000001", + "description": "Alert from Rule: Rule 2", + "category": "category_1", + "risk_score": 70, + "timestamp": "2023-08-14T09:08:18.664Z" + } + ] + } + } + } + } +} + +{ + "type": "doc", + "value": { + "id": "a2cf452c1e0375c3d4412cb550bd1783358468a3b3b777da4829d72c7d6fb752", + "index": "risk-score.risk-score-latest-default", + "source": { + "@timestamp": "2021-03-10T14:51:05.766Z", + "host": { + "name": "Host-fwarau82er", + "risk": { + "calculated_level": "Moderate", + "calculated_score_norm": 50, + "id_field": "host.name", + "id_value": "Host-fwarau82er", + "calculated_score": 220, + "category_1_score": 220, + "category_1_count": 1, + "notes": [], + "inputs": [ + { + "id": "eabbdefc23da981f2b74ab58b82622a97bb9878caa11bc914e2adfacc94780f1", + "index": ".internal.alerts-security.alerts-default-000001", + "description": "Endpoint Security", + "category": "category_1", + "risk_score": 70, + "timestamp": "2023-08-14T09:08:18.664Z" + } + ] + } + } + } + } +} + + +{ + "type": "doc", + "value": { + "id": "a2cf452c1e0375c3d4412cb550bd1783358468a3b3b777da4829d72c7d2fb74f", + "index": "risk-score.risk-score-latest-default", + "source": { + "@timestamp": "2021-03-10T14:51:05.766Z", + "user": { + "name": "user2", + "risk": { + "calculated_score_norm": 50, + "calculated_level": "Moderate", + "id_field": "user.name", + "id_value": "user2", + "calculated_score": 150, + "category_1_score": 150, + "category_1_count": 1, + "notes": [], + "inputs": [ + { + "id": "2e17f189-d77d-4537-8d84-592e29334493", + "index": ".internal.alerts-security.alerts-default-000001", + "description": "Alert from Rule: Rule 2", + "category": "category_1", + "risk_score": 70, + "timestamp": "2023-08-14T09:08:18.664Z" + } + ] + } + } + } + } +} + +{ + "type": "doc", + "value": { + "id": "a2cf452c1e0375c3d4412cb550bd1783358468a3b3b777da4829d72c7d6fb72f", + "index": "risk-score.risk-score-latest-default", + "source": { + "@timestamp": "2021-03-10T14:51:05.766Z", + "user": { + "name": "user3", + "risk": { + "calculated_score_norm": 50, + "calculated_level": "Moderate", + "id_field": "user.name", + "id_value": "user3", + "calculated_score": 150, + "category_1_score": 150, + "category_1_count": 1, + "notes": [], + "inputs": [ + { + "id": "2e17f189-d77d-4537-8d84-592e29334493", + "index": ".internal.alerts-security.alerts-default-000001", + "description": "Alert from Rule: Rule 2", + "category": "category_1", + "risk_score": 70, + "timestamp": "2023-08-14T09:08:18.664Z" + } + ] + } + } + } + } +} + +{ + "type": "doc", + "value": { + "id": "a2cf452c1e0375c3d4412cb550bd1783358468a3b3b777da4829d72c7d6fb73f", + "index": "risk-score.risk-score-latest-default", + "source": { + "@timestamp": "2021-03-10T14:51:05.766Z", + "user": { + "name": "user4", + "risk": { + "calculated_score_norm": 50, + "calculated_level": "Moderate", + "id_field": "user.name", + "id_value": "user4", + "calculated_score": 150, + "category_1_score": 150, + "category_1_count": 1, + "notes": [], + "inputs": [ + { + "id": "2e17f189-d77d-4537-8d84-592e29334493", + "index": ".internal.alerts-security.alerts-default-000001", + "description": "Alert from Rule: Rule 2", + "category": "category_1", + "risk_score": 70, + "timestamp": "2023-08-14T09:08:18.664Z" + } + ] + } + } + } + } +} + +{ + "type": "doc", + "value": { + "id": "a2cf452c1e0375c3d4412cb550bd1783358468a3b3b777da4829d72c7d6fb74f", + "index": "risk-score.risk-score-latest-default", + "source": { + "@timestamp": "2021-03-10T14:51:05.766Z", + "user": { + "name": "user5", + "risk": { + "calculated_score_norm": 50, + "calculated_level": "Moderate", + "id_field": "user.name", + "id_value": "user6", + "calculated_score": 150, + "category_1_score": 150, + "category_1_count": 1, + "notes": [], + "inputs": [ + { + "id": "2e17f189-d77d-4537-8d84-592e29334493", + "index": ".internal.alerts-security.alerts-default-000001", + "description": "Alert from Rule: Rule 2", + "category": "category_1", + "risk_score": 70, + "timestamp": "2023-08-14T09:08:18.664Z" + } + ] + } + } + } + } +} + +{ + "type": "doc", + "value": { + "id": "a2cf452c1e0375c3d4412cb550bd1783358468a3b3b777da4829d72c7d6fb75f", + "index": "risk-score.risk-score-latest-default", + "source": { + "@timestamp": "2021-03-10T14:51:05.766Z", + "user": { + "name": "user6", + "risk": { + "calculated_score_norm": 50, + "calculated_level": "Moderate", + "id_field": "user.name", + "id_value": "user6", + "calculated_score": 220, + "category_1_score": 220, + "category_1_count": 1, + "notes": [], + "inputs": [ + { + "id": "2e17f189-d77d-4537-8d84-592e29334493", + "index": ".internal.alerts-security.alerts-default-000001", + "description": "Alert from Rule: Rule 2", + "category": "category_1", + "risk_score": 70, + "timestamp": "2023-08-14T09:08:18.664Z" + } + ] + } + } + } + } +} + +{ + "type": "doc", + "value": { + "id": "a4cf452c1e0375c3d4412cb550bd1783358468b3b3b777da4829d72c7d6fb74f", + "index": "risk-score.risk-score-latest-default", + "source": { + "@timestamp": "2021-03-10T14:51:05.766Z", + "user": { + "name": "user1", + "risk": { + "calculated_score_norm": 21, + "calculated_level": "Low", + "id_field": "user.name", + "id_value": "user1", + "calculated_score": 150, + "category_1_score": 150, + "category_1_count": 1, + "notes": [], + "inputs": [ + { + "id": "eabbdefc23da981f2b74ab58b82622a97bb9878caa11bc914e2adfacc94780f1", + "index": ".internal.alerts-security.alerts-default-000001", + "description": "Endpoint Security", + "category": "category_1", + "risk_score": 70, + "timestamp": "2023-08-14T09:08:18.664Z" + } + ] + } + } + } + } +} + +{ + "type": "doc", + "value": { + "id": "a4cf452c1e0375c3d4412cb550bd1783358468b3123314829d72c7df6fb74", + "index": "risk-score.risk-score-latest-default", + "source": { + "@timestamp": "2021-03-10T14:52:05.766Z", + "user": { + "name": "test", + "risk": { + "calculated_score_norm": 60, + "calculated_level": "High", + "id_field": "user.name", + "id_value": "test", + "calculated_score": 150, + "category_1_score": 150, + "category_1_count": 1, + "notes": [], + "inputs": [ + { + "id": "eabbdefc23da981f2b74ab58b82622a97bb9878caa11bc914e2adfacc94780f1-d77d-4537-8d84-592e29334493", + "index": ".internal.alerts-security.alerts-default-000001", + "description": "Alert from Rule: Rule 2", + "category": "category_1", + "risk_score": 70, + "timestamp": "2023-08-14T09:08:18.664Z" + } + ] + } + } + } + } +} diff --git a/x-pack/test/security_solution_cypress/es_archives/risk_scores_new/mappings.json b/x-pack/test/security_solution_cypress/es_archives/risk_scores_new/mappings.json new file mode 100644 index 0000000000000..0549fb1c08ced --- /dev/null +++ b/x-pack/test/security_solution_cypress/es_archives/risk_scores_new/mappings.json @@ -0,0 +1,135 @@ +{ + "type": "index", + "value": { + "index": "risk-score.risk-score-latest-default", + "mappings": { + "dynamic": "strict", + "properties": { + "@timestamp": { + "type": "date" + }, + "host": { + "properties": { + "name": { + "type": "keyword" + }, + "risk": { + "properties": { + "calculated_level": { + "type": "keyword" + }, + "calculated_score": { + "type": "float" + }, + "calculated_score_norm": { + "type": "float" + }, + "category_1_count": { + "type": "long" + }, + "category_1_score": { + "type": "float" + }, + "id_field": { + "type": "keyword" + }, + "id_value": { + "type": "keyword" + }, + "inputs": { + "properties": { + "category": { + "type": "keyword" + }, + "description": { + "type": "keyword" + }, + "id": { + "type": "keyword" + }, + "index": { + "type": "keyword" + }, + "risk_score": { + "type": "float" + }, + "timestamp": { + "type": "date" + } + } + }, + "notes": { + "type": "keyword" + } + } + } + } + }, + "user": { + "properties": { + "name": { + "type": "keyword" + }, + "risk": { + "properties": { + "calculated_level": { + "type": "keyword" + }, + "calculated_score": { + "type": "float" + }, + "calculated_score_norm": { + "type": "float" + }, + "category_1_count": { + "type": "long" + }, + "category_1_score": { + "type": "float" + }, + "id_field": { + "type": "keyword" + }, + "id_value": { + "type": "keyword" + }, + "inputs": { + "properties": { + "category": { + "type": "keyword" + }, + "description": { + "type": "keyword" + }, + "id": { + "type": "keyword" + }, + "index": { + "type": "keyword" + }, + "risk_score": { + "type": "float" + }, + "timestamp": { + "type": "date" + } + } + }, + "notes": { + "type": "keyword" + } + } + } + } + } + } + }, + "settings": { + "index": { + "auto_expand_replicas": "0-1", + "number_of_replicas": "0", + "number_of_shards": "1" + } + } + } + } diff --git a/x-pack/test/security_solution_cypress/es_archives/risk_scores_new_no_data/data.json b/x-pack/test/security_solution_cypress/es_archives/risk_scores_new_no_data/data.json new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/x-pack/test/security_solution_cypress/es_archives/risk_scores_new_no_data/mappings.json b/x-pack/test/security_solution_cypress/es_archives/risk_scores_new_no_data/mappings.json new file mode 100644 index 0000000000000..35cb0031894d7 --- /dev/null +++ b/x-pack/test/security_solution_cypress/es_archives/risk_scores_new_no_data/mappings.json @@ -0,0 +1,136 @@ +{ + + "type": "index", + "value": { + "index": "risk-score.risk-score-latest-default", + "mappings": { + "dynamic": "strict", + "properties": { + "@timestamp": { + "type": "date" + }, + "host": { + "properties": { + "name": { + "type": "keyword" + }, + "risk": { + "properties": { + "calculated_level": { + "type": "keyword" + }, + "calculated_score": { + "type": "float" + }, + "calculated_score_norm": { + "type": "float" + }, + "category_1_count": { + "type": "long" + }, + "category_1_score": { + "type": "float" + }, + "id_field": { + "type": "keyword" + }, + "id_value": { + "type": "keyword" + }, + "inputs": { + "properties": { + "category": { + "type": "keyword" + }, + "description": { + "type": "keyword" + }, + "id": { + "type": "keyword" + }, + "index": { + "type": "keyword" + }, + "risk_score": { + "type": "float" + }, + "timestamp": { + "type": "date" + } + } + }, + "notes": { + "type": "keyword" + } + } + } + } + }, + "user": { + "properties": { + "name": { + "type": "keyword" + }, + "risk": { + "properties": { + "calculated_level": { + "type": "keyword" + }, + "calculated_score": { + "type": "float" + }, + "calculated_score_norm": { + "type": "float" + }, + "category_1_count": { + "type": "long" + }, + "category_1_score": { + "type": "float" + }, + "id_field": { + "type": "keyword" + }, + "id_value": { + "type": "keyword" + }, + "inputs": { + "properties": { + "category": { + "type": "keyword" + }, + "description": { + "type": "keyword" + }, + "id": { + "type": "keyword" + }, + "index": { + "type": "keyword" + }, + "risk_score": { + "type": "float" + }, + "timestamp": { + "type": "date" + } + } + }, + "notes": { + "type": "keyword" + } + } + } + } + } + } + }, + "settings": { + "index": { + "auto_expand_replicas": "0-1", + "number_of_replicas": "0", + "number_of_shards": "1" + } + } + } + } \ No newline at end of file diff --git a/x-pack/test/security_solution_cypress/es_archives/risk_scores_new_updated/data.json b/x-pack/test/security_solution_cypress/es_archives/risk_scores_new_updated/data.json new file mode 100644 index 0000000000000..058c081b3ee6d --- /dev/null +++ b/x-pack/test/security_solution_cypress/es_archives/risk_scores_new_updated/data.json @@ -0,0 +1,67 @@ +{ + "type": "doc", + "value": { + "id": "a4cf452c1e0375c3d4412cb550bd1783358468a3b3b777da4829d72c7d6fb74f", + "index": "risk-score.risk-score-latest-default", + "source": { + "@timestamp": "2021-03-10T14:51:05.766Z", + "host": { + "name": "siem-kibana", + "risk": { + "calculated_level": "Low", + "calculated_score_norm": 20, + "id_field": "host.name", + "id_value": "siem-kibana", + "calculated_score": 150, + "category_1_score": 150, + "category_1_count": 1, + "notes": [], + "inputs": [ + { + "id": "2e17f189-d77d-4537-8d84-592e29334493", + "index": ".internal.alerts-security.alerts-default-000001", + "description": "Alert from Rule: Rule 2", + "category": "category_1", + "risk_score": 70, + "timestamp": "2023-08-14T09:08:18.664Z" + } + ] + } + } + } + } +} + +{ + "type": "doc", + "value": { + "id": "a4cf452c1e0375c3d4412cb550bd1783358468b3123314829d72c7df6fb74", + "index": "risk-score.risk-score-latest-default", + "source": { + "@timestamp": "2021-03-10T14:52:05.766Z", + "user": { + "name": "test", + "risk": { + "calculated_score_norm": 60, + "calculated_level": "High", + "id_field": "user.name", + "id_value": "test", + "calculated_score": 150, + "category_1_score": 150, + "category_1_count": 1, + "notes": [], + "inputs": [ + { + "id": "eabbdefc23da981f2b74ab58b82622a97bb9878caa11bc914e2adfacc94780f1-d77d-4537-8d84-592e29334493", + "index": ".internal.alerts-security.alerts-default-000001", + "description": "Alert from Rule: Rule 2", + "category": "category_1", + "risk_score": 70, + "timestamp": "2023-08-14T09:08:18.664Z" + } + ] + } + } + } + } +} \ No newline at end of file diff --git a/x-pack/test/security_solution_cypress/es_archives/risk_scores_new_updated/mappings.json b/x-pack/test/security_solution_cypress/es_archives/risk_scores_new_updated/mappings.json new file mode 100644 index 0000000000000..35cb0031894d7 --- /dev/null +++ b/x-pack/test/security_solution_cypress/es_archives/risk_scores_new_updated/mappings.json @@ -0,0 +1,136 @@ +{ + + "type": "index", + "value": { + "index": "risk-score.risk-score-latest-default", + "mappings": { + "dynamic": "strict", + "properties": { + "@timestamp": { + "type": "date" + }, + "host": { + "properties": { + "name": { + "type": "keyword" + }, + "risk": { + "properties": { + "calculated_level": { + "type": "keyword" + }, + "calculated_score": { + "type": "float" + }, + "calculated_score_norm": { + "type": "float" + }, + "category_1_count": { + "type": "long" + }, + "category_1_score": { + "type": "float" + }, + "id_field": { + "type": "keyword" + }, + "id_value": { + "type": "keyword" + }, + "inputs": { + "properties": { + "category": { + "type": "keyword" + }, + "description": { + "type": "keyword" + }, + "id": { + "type": "keyword" + }, + "index": { + "type": "keyword" + }, + "risk_score": { + "type": "float" + }, + "timestamp": { + "type": "date" + } + } + }, + "notes": { + "type": "keyword" + } + } + } + } + }, + "user": { + "properties": { + "name": { + "type": "keyword" + }, + "risk": { + "properties": { + "calculated_level": { + "type": "keyword" + }, + "calculated_score": { + "type": "float" + }, + "calculated_score_norm": { + "type": "float" + }, + "category_1_count": { + "type": "long" + }, + "category_1_score": { + "type": "float" + }, + "id_field": { + "type": "keyword" + }, + "id_value": { + "type": "keyword" + }, + "inputs": { + "properties": { + "category": { + "type": "keyword" + }, + "description": { + "type": "keyword" + }, + "id": { + "type": "keyword" + }, + "index": { + "type": "keyword" + }, + "risk_score": { + "type": "float" + }, + "timestamp": { + "type": "date" + } + } + }, + "notes": { + "type": "keyword" + } + } + } + } + } + } + }, + "settings": { + "index": { + "auto_expand_replicas": "0-1", + "number_of_replicas": "0", + "number_of_shards": "1" + } + } + } + } \ No newline at end of file diff --git a/x-pack/test/security_solution_cypress/serverless_config.ts b/x-pack/test/security_solution_cypress/serverless_config.ts index d0ee1613f6e4c..366e963d1b4eb 100644 --- a/x-pack/test/security_solution_cypress/serverless_config.ts +++ b/x-pack/test/security_solution_cypress/serverless_config.ts @@ -29,6 +29,10 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { ...svlSharedConfig.get('kbnTestServer.serverArgs'), '--serverless=security', '--xpack.encryptedSavedObjects.encryptionKey="abcdefghijklmnopqrstuvwxyz123456"', + `--xpack.securitySolution.enableExperimental=${JSON.stringify([ + 'riskScoringRoutesEnabled', + 'riskScoringPersistence', + ])}`, `--xpack.securitySolutionServerless.productTypes=${JSON.stringify([ { product_line: 'security', product_tier: 'complete' }, { product_line: 'endpoint', product_tier: 'complete' }, From b888ecb45c460ac8976947ad37f7029360ceb237 Mon Sep 17 00:00:00 2001 From: Steph Milovic Date: Fri, 29 Sep 2023 10:54:55 -0600 Subject: [PATCH 7/7] [Security solution] Rename Generative AI connector to OpenAI (#167677) [Redo this PR](https://github.com/elastic/kibana/pull/167220) because [this PR](https://github.com/elastic/kibana/pull/167220) merged shortly before broke it and I had to fix an import --------- Co-authored-by: lcawl --- .github/CODEOWNERS | 6 +- api_docs/actions.devdocs.json | 16 ++--- .../connector-apis-passthru.asciidoc | 14 ++--- docs/management/action-types.asciidoc | 2 +- .../{gen-ai.asciidoc => openai.asciidoc} | 24 +++---- docs/management/connectors/index.asciidoc | 2 +- .../pre-configured-connectors.asciidoc | 8 +-- docs/redirects.asciidoc | 5 ++ docs/settings/alert-action-settings.asciidoc | 8 +-- .../README.md | 4 +- .../public/components/list_connector.tsx | 2 +- .../public/components/setup_connector.tsx | 6 +- .../gen_ai_streaming_response_example.tsx | 2 +- .../public/plugin.tsx | 7 +-- .../server/plugin.ts | 2 +- .../impl/assistant/assistant_header/index.tsx | 2 +- .../conversation_selector/index.tsx | 2 +- .../conversation_selector_settings/index.tsx | 2 +- .../impl/assistant/index.tsx | 2 +- .../assistant/settings/assistant_settings.tsx | 2 +- .../settings/assistant_settings_button.tsx | 2 +- .../impl/assistant_context/types.tsx | 2 +- .../connectorland/connector_button/index.tsx | 4 +- .../impl/connectorland/helpers.tsx | 4 +- .../use_load_action_types/index.tsx | 7 ++- .../content/prompts/welcome/translations.ts | 2 +- .../impl/mock/conversation.ts | 2 +- .../common/connector_feature_config.test.ts | 10 ++- .../common/connector_feature_config.ts | 18 +++--- x-pack/plugins/actions/common/types.ts | 2 +- .../plugins/actions/docs/openapi/bundled.json | 10 +-- .../plugins/actions/docs/openapi/bundled.yaml | 12 ++-- .../schemas/config_properties_genai.yaml | 4 +- .../connector_response_properties_genai.yaml | 2 +- .../create_connector_request_genai.yaml | 6 +- .../schemas/secrets_properties_genai.yaml | 4 +- .../update_connector_request_genai.yaml | 4 +- .../server/lib/action_executor.test.ts | 2 +- .../actions/server/lib/action_executor.ts | 6 +- .../server/routes/evaluate/utils.ts | 2 +- .../observability_ai_assistant/README.md | 2 +- .../components/chat/initial_setup_panel.tsx | 6 +- .../common/{gen_ai => openai}/constants.ts | 4 +- .../common/{gen_ai => openai}/schema.ts | 0 .../common/{gen_ai => openai}/types.ts | 0 .../stack_connectors/public/common/index.ts | 6 +- .../connector_types/d3security/d3security.tsx | 2 +- .../public/connector_types/index.ts | 4 +- .../{gen_ai => openai}/api.test.ts | 2 +- .../connector_types/{gen_ai => openai}/api.ts | 2 +- .../{gen_ai => openai}/connector.test.tsx | 62 ++++--------------- .../{gen_ai => openai}/connector.tsx | 9 +-- .../{gen_ai => openai}/constants.tsx | 10 +-- .../{gen_ai => openai}/index.ts | 2 +- .../{gen_ai => openai}/logo.tsx | 0 .../openai.test.tsx} | 6 +- .../{gen_ai/gen_ai.tsx => openai/openai.tsx} | 16 ++--- .../{gen_ai => openai}/params.test.tsx | 14 ++--- .../{gen_ai => openai}/params.tsx | 14 ++--- .../{gen_ai => openai}/translations.ts | 4 +- .../{gen_ai => openai}/types.ts | 21 +++---- .../use_get_dashboard.test.ts | 2 +- .../{gen_ai => openai}/use_get_dashboard.ts | 0 .../server/connector_types/bedrock/index.ts | 4 +- .../server/connector_types/index.ts | 4 +- .../create_dashboard.test.ts | 0 .../{gen_ai => openai}/create_dashboard.ts | 0 .../{gen_ai => openai}/dashboard.ts | 12 ++-- .../{gen_ai => openai}/index.test.ts | 16 ++--- .../{gen_ai => openai}/index.ts | 24 +++---- .../lib/azure_openai_utils.test.ts | 2 +- .../lib/azure_openai_utils.ts | 2 +- .../lib/openai_utils.test.ts | 2 +- .../{gen_ai => openai}/lib/openai_utils.ts | 2 +- .../{gen_ai => openai}/lib/utils.test.ts | 2 +- .../{gen_ai => openai}/lib/utils.ts | 2 +- .../gen_ai.test.ts => openai/openai.test.ts} | 22 +++---- .../{gen_ai/gen_ai.ts => openai/openai.ts} | 12 ++-- .../{gen_ai => openai}/render.test.ts | 2 +- .../{gen_ai => openai}/render.ts | 2 +- .../translations/translations/fr-FR.json | 3 +- .../translations/translations/ja-JP.json | 3 +- .../translations/translations/zh-CN.json | 3 +- ..._ai_simulation.ts => openai_simulation.ts} | 6 +- .../connector_types/{gen_ai.ts => openai.ts} | 18 +++--- .../group2/tests/actions/index.ts | 2 +- .../generative_ai_connector.ts | 4 +- .../stack_connectors/xmatters_connector.ts | 2 +- 88 files changed, 258 insertions(+), 304 deletions(-) rename docs/management/connectors/action-types/{gen-ai.asciidoc => openai.asciidoc} (65%) rename x-pack/plugins/stack_connectors/common/{gen_ai => openai}/constants.ts (93%) rename x-pack/plugins/stack_connectors/common/{gen_ai => openai}/schema.ts (100%) rename x-pack/plugins/stack_connectors/common/{gen_ai => openai}/types.ts (100%) rename x-pack/plugins/stack_connectors/public/connector_types/{gen_ai => openai}/api.test.ts (95%) rename x-pack/plugins/stack_connectors/public/connector_types/{gen_ai => openai}/api.ts (94%) rename x-pack/plugins/stack_connectors/public/connector_types/{gen_ai => openai}/connector.test.tsx (81%) rename x-pack/plugins/stack_connectors/public/connector_types/{gen_ai => openai}/connector.tsx (93%) rename x-pack/plugins/stack_connectors/public/connector_types/{gen_ai => openai}/constants.tsx (96%) rename x-pack/plugins/stack_connectors/public/connector_types/{gen_ai => openai}/index.ts (76%) rename x-pack/plugins/stack_connectors/public/connector_types/{gen_ai => openai}/logo.tsx (100%) rename x-pack/plugins/stack_connectors/public/connector_types/{gen_ai/gen_ai.test.tsx => openai/openai.test.tsx} (94%) rename x-pack/plugins/stack_connectors/public/connector_types/{gen_ai/gen_ai.tsx => openai/openai.tsx} (80%) rename x-pack/plugins/stack_connectors/public/connector_types/{gen_ai => openai}/params.test.tsx (94%) rename x-pack/plugins/stack_connectors/public/connector_types/{gen_ai => openai}/params.tsx (86%) rename x-pack/plugins/stack_connectors/public/connector_types/{gen_ai => openai}/translations.ts (94%) rename x-pack/plugins/stack_connectors/public/connector_types/{gen_ai => openai}/types.ts (59%) rename x-pack/plugins/stack_connectors/public/connector_types/{gen_ai => openai}/use_get_dashboard.test.ts (98%) rename x-pack/plugins/stack_connectors/public/connector_types/{gen_ai => openai}/use_get_dashboard.ts (100%) rename x-pack/plugins/stack_connectors/server/connector_types/{gen_ai => openai}/create_dashboard.test.ts (100%) rename x-pack/plugins/stack_connectors/server/connector_types/{gen_ai => openai}/create_dashboard.ts (100%) rename x-pack/plugins/stack_connectors/server/connector_types/{gen_ai => openai}/dashboard.ts (97%) rename x-pack/plugins/stack_connectors/server/connector_types/{gen_ai => openai}/index.test.ts (85%) rename x-pack/plugins/stack_connectors/server/connector_types/{gen_ai => openai}/index.ts (76%) rename x-pack/plugins/stack_connectors/server/connector_types/{gen_ai => openai}/lib/azure_openai_utils.test.ts (99%) rename x-pack/plugins/stack_connectors/server/connector_types/{gen_ai => openai}/lib/azure_openai_utils.ts (97%) rename x-pack/plugins/stack_connectors/server/connector_types/{gen_ai => openai}/lib/openai_utils.test.ts (99%) rename x-pack/plugins/stack_connectors/server/connector_types/{gen_ai => openai}/lib/openai_utils.ts (97%) rename x-pack/plugins/stack_connectors/server/connector_types/{gen_ai => openai}/lib/utils.test.ts (99%) rename x-pack/plugins/stack_connectors/server/connector_types/{gen_ai => openai}/lib/utils.ts (97%) rename x-pack/plugins/stack_connectors/server/connector_types/{gen_ai/gen_ai.test.ts => openai/openai.test.ts} (97%) rename x-pack/plugins/stack_connectors/server/connector_types/{gen_ai/gen_ai.ts => openai/openai.ts} (96%) rename x-pack/plugins/stack_connectors/server/connector_types/{gen_ai => openai}/render.test.ts (96%) rename x-pack/plugins/stack_connectors/server/connector_types/{gen_ai => openai}/render.ts (93%) rename x-pack/test/alerting_api_integration/common/plugins/actions_simulators/server/{gen_ai_simulation.ts => openai_simulation.ts} (91%) rename x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/{gen_ai.ts => openai.ts} (96%) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 9de177e16947e..c0ba6f69d592a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1212,9 +1212,9 @@ x-pack/plugins/cloud_integrations/cloud_full_story/server/config.ts @elastic/kib /x-pack/plugins/security_solution/server/search_strategy/security_solution/factory/users @elastic/security-threat-hunting-explore ## Explore owner connectors -/x-pack/plugins/stack_connectors/public/connector_types/gen_ai @elastic/security-threat-hunting-explore -/x-pack/plugins/stack_connectors/server/connector_types/gen_ai @elastic/security-threat-hunting-explore -/x-pack/plugins/stack_connectors/common/gen_ai @elastic/security-threat-hunting-explore +/x-pack/plugins/stack_connectors/public/connector_types/openai @elastic/security-threat-hunting-explore +/x-pack/plugins/stack_connectors/server/connector_types/openai @elastic/security-threat-hunting-explore +/x-pack/plugins/stack_connectors/common/openai @elastic/security-threat-hunting-explore ## Defend Workflows owner connectors /x-pack/plugins/stack_connectors/public/connector_types/sentinelone @elastic/security-defend-workflows diff --git a/api_docs/actions.devdocs.json b/api_docs/actions.devdocs.json index 4e648524c704d..247840029729f 100644 --- a/api_docs/actions.devdocs.json +++ b/api_docs/actions.devdocs.json @@ -5273,10 +5273,10 @@ }, { "parentPluginId": "actions", - "id": "def-common.GeneralConnectorFeatureId", + "id": "def-common.GenerativeAIConnectorFeatureId", "type": "string", "tags": [], - "label": "GeneralConnectorFeatureId", + "label": "GenerativeAIConnectorFeatureId", "description": [], "signature": [ "\"general\"" @@ -5613,10 +5613,10 @@ }, { "parentPluginId": "actions", - "id": "def-common.GeneralFeature", + "id": "def-common.GenerativeAIFeature", "type": "Object", "tags": [], - "label": "GeneralFeature", + "label": "GenerativeAIFeature", "description": [], "path": "x-pack/plugins/actions/common/connector_feature_config.ts", "deprecated": false, @@ -5624,7 +5624,7 @@ "children": [ { "parentPluginId": "actions", - "id": "def-common.GeneralFeature.id", + "id": "def-common.GenerativeAIFeature.id", "type": "string", "tags": [], "label": "id", @@ -5635,7 +5635,7 @@ }, { "parentPluginId": "actions", - "id": "def-common.GeneralFeature.name", + "id": "def-common.GenerativeAIFeature.name", "type": "string", "tags": [], "label": "name", @@ -5646,7 +5646,7 @@ }, { "parentPluginId": "actions", - "id": "def-common.GeneralFeature.compatibility", + "id": "def-common.GenerativeAIFeature.compatibility", "type": "string", "tags": [], "label": "compatibility", @@ -5769,4 +5769,4 @@ } ] } -} \ No newline at end of file +} diff --git a/docs/api-generated/connectors/connector-apis-passthru.asciidoc b/docs/api-generated/connectors/connector-apis-passthru.asciidoc index fb1a9b87dbcda..d3495cecf9edf 100644 --- a/docs/api-generated/connectors/connector-apis-passthru.asciidoc +++ b/docs/api-generated/connectors/connector-apis-passthru.asciidoc @@ -1004,7 +1004,7 @@ Any modifications made to this file will be overwritten.
  • config_properties_cases_webhook - Connector request properties for Webhook - Case Management connector
  • config_properties_d3security - Connector request properties for a D3 Security connector
  • config_properties_email - Connector request properties for an email connector
  • -
  • config_properties_genai - Connector request properties for a generative AI connector
  • +
  • config_properties_genai - Connector request properties for an OpenAI connector
  • config_properties_genai_oneOf -
  • config_properties_genai_oneOf_1 -
  • config_properties_index - Connector request properties for an index connector
  • @@ -1044,7 +1044,7 @@ Any modifications made to this file will be overwritten.
  • create_connector_request_cases_webhook - Create Webhook - Case Managment connector request
  • create_connector_request_d3security - Create D3 Security connector request
  • create_connector_request_email - Create email connector request
  • -
  • create_connector_request_genai - Create generative AI connector request
  • +
  • create_connector_request_genai - Create OpenAI connector request
  • create_connector_request_index - Create index connector request
  • create_connector_request_jira - Create Jira connector request
  • create_connector_request_opsgenie - Create Opsgenie connector request
  • @@ -1100,7 +1100,7 @@ Any modifications made to this file will be overwritten.
  • secrets_properties_cases_webhook - Connector secrets properties for Webhook - Case Management connector
  • secrets_properties_d3security - Connector secrets properties for a D3 Security connector
  • secrets_properties_email - Connector secrets properties for an email connector
  • -
  • secrets_properties_genai - Connector secrets properties for a generative AI connector
  • +
  • secrets_properties_genai - Connector secrets properties for an OpenAI connector
  • secrets_properties_jira - Connector secrets properties for a Jira connector
  • secrets_properties_opsgenie - Connector secrets properties for an Opsgenie connector
  • secrets_properties_pagerduty - Connector secrets properties for a PagerDuty connector
  • @@ -1432,7 +1432,7 @@ Any modifications made to this file will be overwritten.
    -

    config_properties_genai - Connector request properties for a generative AI connector Up

    +

    config_properties_genai - Connector request properties for an OpenAI connector Up

    Defines properties for connectors when type is .gen-ai.
    apiProvider
    String The OpenAI API provider.
    @@ -1958,8 +1958,8 @@ Any modifications made to this file will be overwritten.
    -

    create_connector_request_genai - Create generative AI connector request Up

    -
    The generative AI connector uses axios to send a POST request to either OpenAI or Azure OpenAPI.
    +

    create_connector_request_genai - Create OpenAI connector request Up

    +
    The OpenAI connector uses axios to send a POST request to either OpenAI or Azure OpenAPI.
    config
    connector_type_id
    String The type of connector.
    @@ -2535,7 +2535,7 @@ Any modifications made to this file will be overwritten.
    -

    secrets_properties_genai - Connector secrets properties for a generative AI connector Up

    +

    secrets_properties_genai - Connector secrets properties for an OpenAI connector Up

    Defines secrets for connectors when type is .gen-ai.
    apiKey (optional)
    String The OpenAI API key.
    diff --git a/docs/management/action-types.asciidoc b/docs/management/action-types.asciidoc index 67dd4e3fd0019..357d0e5de50ea 100644 --- a/docs/management/action-types.asciidoc +++ b/docs/management/action-types.asciidoc @@ -35,7 +35,7 @@ a| <> | Send a message to a Microsoft Teams channel. -a| <> +a| <> | Send a request to OpenAI. diff --git a/docs/management/connectors/action-types/gen-ai.asciidoc b/docs/management/connectors/action-types/openai.asciidoc similarity index 65% rename from docs/management/connectors/action-types/gen-ai.asciidoc rename to docs/management/connectors/action-types/openai.asciidoc index 6388a483e7fc3..49033b92cd740 100644 --- a/docs/management/connectors/action-types/gen-ai.asciidoc +++ b/docs/management/connectors/action-types/openai.asciidoc @@ -1,7 +1,7 @@ -[[gen-ai-action-type]] -== Generative AI connector and action +[[openai-action-type]] +== OpenAI connector and action ++++ -Generative AI +OpenAI ++++ :frontmatter-description: Add a connector that can send requests to an OpenAI provider. :frontmatter-tags-products: [kibana] @@ -9,7 +9,7 @@ :frontmatter-tags-user-goals: [configure] -The Generative AI connector uses https://github.com/axios/axios[axios] to send a POST request to an OpenAI provider, either OpenAI or Azure OpenAI. The connector uses the <> to send the request. +The OpenAI connector uses https://github.com/axios/axios[axios] to send a POST request to an OpenAI provider, either OpenAI or Azure OpenAI. The connector uses the <> to send the request. [float] [[define-gen-ai-ui]] @@ -18,14 +18,14 @@ The Generative AI connector uses https://github.com/axios/axios[axios] to send a You can create connectors in *{stack-manage-app} > {connectors-ui}*. For example: [role="screenshot"] -image::management/connectors/images/gen-ai-connector.png[Generative AI connector] +image::management/connectors/images/gen-ai-connector.png[OpenAI connector] // NOTE: This is an autogenerated screenshot. Do not edit it directly. [float] -[[gen-ai-connector-configuration]] +[[openai-connector-configuration]] ==== Connector configuration -Generative AI connectors have the following configuration properties: +OpenAI connectors have the following configuration properties: Name:: The name of the connector. OpenAI provider:: The OpenAI API provider, either OpenAI or Azure OpenAI. @@ -41,10 +41,10 @@ You can test connectors with the <> or as you're creating or editing the connector in {kib}. For example: [role="screenshot"] -image::management/connectors/images/gen-ai-params-test.png[Generative AI params test] +image::management/connectors/images/gen-ai-params-test.png[OpenAI params test] // NOTE: This is an autogenerated screenshot. Do not edit it directly. -The Generative AI actions have the following configuration properties. +The OpenAI actions have the following configuration properties. Body:: A JSON payload sent to the OpenAI API URL. For example: + @@ -61,15 +61,15 @@ Body:: A JSON payload sent to the OpenAI API URL. For example: } -- [float] -[[gen-ai-connector-networking-configuration]] +[[openai-connector-networking-configuration]] === Connector networking configuration Use the <> to customize connector networking configurations, such as proxies, certificates, or TLS settings. You can set configurations that apply to all your connectors or use `xpack.actions.customHostSettings` to set per-host configurations. [float] -[[gen-ai-connector-token-dashboard]] +[[openai-connector-token-dashboard]] === Token usage dashboard -Once you've created a Generative AI connector, you can monitor its token usage using the *Generative AI Token Usage* dashboard. Select the connector in *{stack-manage-app}* > *{connectors-ui}* to view its details, then click the *View OpenAI Usage Dashboard for "__" Connector* link to open the dashboard. +Once you've created a OpenAI connector, you can monitor its token usage using the *OpenAI Token Usage* dashboard. Select the connector in *{stack-manage-app}* > *{connectors-ui}* to view its details, then click the *View OpenAI Usage Dashboard for "__" Connector* link to open the dashboard. NOTE: To view the dashboard, you need at least `read` and `view_index_metadata` privileges for the `.kibana-event-log-*` index and the `Read` feature privilege for {kib}. You can set up a role with these minimum privileges and assign it to non-admin users who need to view this dashboard. diff --git a/docs/management/connectors/index.asciidoc b/docs/management/connectors/index.asciidoc index e7ef07ba4f737..14cfd57fd3c80 100644 --- a/docs/management/connectors/index.asciidoc +++ b/docs/management/connectors/index.asciidoc @@ -1,11 +1,11 @@ include::action-types/bedrock.asciidoc[leveloffset=+1] include::action-types/d3security.asciidoc[leveloffset=+1] include::action-types/email.asciidoc[leveloffset=+1] -include::action-types/gen-ai.asciidoc[leveloffset=+1] include::action-types/resilient.asciidoc[leveloffset=+1] include::action-types/index.asciidoc[leveloffset=+1] include::action-types/jira.asciidoc[leveloffset=+1] include::action-types/teams.asciidoc[leveloffset=+1] +include::action-types/openai.asciidoc[leveloffset=+1] include::action-types/opsgenie.asciidoc[leveloffset=+1] include::action-types/pagerduty.asciidoc[leveloffset=+1] include::action-types/server-log.asciidoc[leveloffset=+1] diff --git a/docs/management/connectors/pre-configured-connectors.asciidoc b/docs/management/connectors/pre-configured-connectors.asciidoc index 8f40554d5bbf3..79b4e331fa19a 100644 --- a/docs/management/connectors/pre-configured-connectors.asciidoc +++ b/docs/management/connectors/pre-configured-connectors.asciidoc @@ -282,15 +282,15 @@ secrets: [float] [[preconfigured-gen-ai-configuration]] -==== Generative AI connectors +==== OpenAI connectors -The following example creates a <>: +The following example creates a <>: [source,text] -- xpack.actions.preconfigured: - my-gen-ai: - name: preconfigured-gen-ai-connector-type + my-open-ai: + name: preconfigured-openai-connector-type actionTypeId: .gen-ai config: apiUrl: https://api.openai.com/v1/chat/completions <1> diff --git a/docs/redirects.asciidoc b/docs/redirects.asciidoc index f4ac0f11739b0..eac4ff0c800d8 100644 --- a/docs/redirects.asciidoc +++ b/docs/redirects.asciidoc @@ -422,3 +422,8 @@ This page has been deleted. Refer to <>. == Enhancements and bug fixes for 8.10.0 This content has moved. Refer to <> for 8.10.0. + +[role="exclude",id="gen-ai-action-type"] +== Generative AI connector and action + +This connector was renamed. Refer to <>. \ No newline at end of file diff --git a/docs/settings/alert-action-settings.asciidoc b/docs/settings/alert-action-settings.asciidoc index fff867cc65a2a..76b1ebadc98d1 100644 --- a/docs/settings/alert-action-settings.asciidoc +++ b/docs/settings/alert-action-settings.asciidoc @@ -261,13 +261,13 @@ For example: `.email`, `.index`, `.opsgenie`, `.server-log`, `.resilient`, `.sla The configuration details, which are specific to the type of preconfigured connector. `xpack.actions.preconfigured..config.apiProvider`:: -For a <>, specifies the OpenAI API provider, either `OpenAI` or `Azure OpenAI`. +For a <>, specifies the OpenAI API provider, either `OpenAI` or `Azure OpenAI`. `xpack.actions.preconfigured..config.apiUrl`:: A configuration URL that varies by connector: + -- -* For a <>, specifies the OpenAI request URL. +* For a <>, specifies the OpenAI request URL. * For a <>, specifies the {ibm-r} instance URL. * For a <>, specifies the Jira instance URL. * For an <>, specifies the {opsgenie} URL. For example, `https://api.opsgenie.com` or `https://api.eu.opsgenie.com`. @@ -321,7 +321,7 @@ NOTE: If you are using the `xpack.actions.allowedHosts` setting, make sure the h For a <>, specifies a string from the response body of the create case method that corresponds to the external service identifier. `xpack.actions.preconfigured..config.defaultModel`:: -For a <>, specifies the default model to use for requests. It is optional and applicable only when `xpack.actions.preconfigured..config.apiProvider` is `OpenAI`. +For a <>, specifies the default model to use for requests. It is optional and applicable only when `xpack.actions.preconfigured..config.apiProvider` is `OpenAI`. `xpack.actions.preconfigured..config.executionTimeField`:: For an <>, a field that indicates when the document was indexed. @@ -448,7 +448,7 @@ TIP: Sensitive properties, such as passwords, should be stored in the <>, specifies the OpenAI or Azure OpenAI API key for authentication. +* For a <>, specifies the OpenAI or Azure OpenAI API key for authentication. * For an <>, specifies the {opsgenie} API authentication key for HTTP basic authentication. -- diff --git a/x-pack/examples/gen_ai_streaming_response_example/README.md b/x-pack/examples/gen_ai_streaming_response_example/README.md index 30d9b35009304..7bac7351af235 100644 --- a/x-pack/examples/gen_ai_streaming_response_example/README.md +++ b/x-pack/examples/gen_ai_streaming_response_example/README.md @@ -1,5 +1,5 @@ -## Generative AI Connector Streaming Response Example +## OpenAI Connector Streaming Response Example -This example plugin shows you how to stream a response from a Generative AI connector. +This example plugin shows you how to stream a response from a OpenAI connector. To run this example, use the command `yarn start --run-examples`. \ No newline at end of file diff --git a/x-pack/examples/gen_ai_streaming_response_example/public/components/list_connector.tsx b/x-pack/examples/gen_ai_streaming_response_example/public/components/list_connector.tsx index 119a2ddb90d51..06e33429892c1 100644 --- a/x-pack/examples/gen_ai_streaming_response_example/public/components/list_connector.tsx +++ b/x-pack/examples/gen_ai_streaming_response_example/public/components/list_connector.tsx @@ -52,7 +52,7 @@ export const ListConnectors = ({ label={i18n.translate( 'genAiStreamingResponseExample.app.component.selectConnectorLabel', { - defaultMessage: 'Select a Generative AI Connector', + defaultMessage: 'Select an OpenAI Connector', } )} labelAppend={ diff --git a/x-pack/examples/gen_ai_streaming_response_example/public/components/setup_connector.tsx b/x-pack/examples/gen_ai_streaming_response_example/public/components/setup_connector.tsx index 518a0d9ceb3c3..2aafcf1a79031 100644 --- a/x-pack/examples/gen_ai_streaming_response_example/public/components/setup_connector.tsx +++ b/x-pack/examples/gen_ai_streaming_response_example/public/components/setup_connector.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { GenAiLogo } from '@kbn/stack-connectors-plugin/public/common'; +import { OpenAILogo } from '@kbn/stack-connectors-plugin/public/common'; import { EuiFlexGroup, EuiCard, EuiFlexItem, EuiIcon } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; @@ -20,11 +20,11 @@ export const SetupConnector = ({ setIsConnectorModalVisible }: SetupConnectorPro } + icon={} title={i18n.translate( 'genAiStreamingResponseExample.app.component.addConnectorCardTitle', { - defaultMessage: 'Add Generative AI Connector', + defaultMessage: 'Add OpenAI Connector', } )} description={i18n.translate( diff --git a/x-pack/examples/gen_ai_streaming_response_example/public/gen_ai_streaming_response_example.tsx b/x-pack/examples/gen_ai_streaming_response_example/public/gen_ai_streaming_response_example.tsx index 8e671338c1bdb..2f300c49a992d 100644 --- a/x-pack/examples/gen_ai_streaming_response_example/public/gen_ai_streaming_response_example.tsx +++ b/x-pack/examples/gen_ai_streaming_response_example/public/gen_ai_streaming_response_example.tsx @@ -65,7 +65,7 @@ export const GenAiStreamingResponseExampleApp = ({ minimumLicenseRequired: 'platinum', supportedFeatureIds: ['general'], id: '.gen-ai', - name: 'Generative AI', + name: 'OpenAI', enabled: true, }); const [loading, setLoading] = useState(true); diff --git a/x-pack/examples/gen_ai_streaming_response_example/public/plugin.tsx b/x-pack/examples/gen_ai_streaming_response_example/public/plugin.tsx index ccf4fe8aa06b0..23cd797a61d06 100644 --- a/x-pack/examples/gen_ai_streaming_response_example/public/plugin.tsx +++ b/x-pack/examples/gen_ai_streaming_response_example/public/plugin.tsx @@ -37,7 +37,7 @@ export class GenAiStreamingResponseExamplePlugin ) { core.application.register({ id: 'GenAiStreamingResponseExample', - title: 'Generative AI Streaming Response Example', + title: 'OpenAI Streaming Response Example', navLinkStatus: AppNavLinkStatus.hidden, async mount(params: AppMountParameters) { const [coreStart, depsStart] = await core.getStartServices(); @@ -48,9 +48,8 @@ export class GenAiStreamingResponseExamplePlugin developerExamples.register({ appId: 'GenAiStreamingResponseExample', - title: 'Generative AI Streaming Response Example', - description: - 'This example demonstrates how to stream a response from a Generative AI connector', + title: 'OpenAI Streaming Response Example', + description: 'This example demonstrates how to stream a response from an OpenAI connector', }); } diff --git a/x-pack/examples/gen_ai_streaming_response_example/server/plugin.ts b/x-pack/examples/gen_ai_streaming_response_example/server/plugin.ts index 3d4dc4bcf33ab..05f9612bcf73d 100644 --- a/x-pack/examples/gen_ai_streaming_response_example/server/plugin.ts +++ b/x-pack/examples/gen_ai_streaming_response_example/server/plugin.ts @@ -87,7 +87,7 @@ export class GenAiStreamingResponseExamplePlugin implements Plugin { }; } else { throw Boom.badRequest( - `Invalid generative AI connector selected - ${connector.config?.apiProvider} is not a valid provider` + `Invalid OpenAI connector selected - ${connector.config?.apiProvider} is not a valid provider` ); } diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant/assistant_header/index.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant/assistant_header/index.tsx index 65c3c267e9a8e..e4c4454859d34 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant/assistant_header/index.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant/assistant_header/index.tsx @@ -17,7 +17,7 @@ import { } from '@elastic/eui'; import { css } from '@emotion/react'; import { DocLinksStart } from '@kbn/core-doc-links-browser'; -import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants'; +import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants'; import { Conversation } from '../../..'; import { AssistantTitle } from '../assistant_title'; import { ConversationSelector } from '../conversations/conversation_selector'; diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant/conversations/conversation_selector/index.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant/conversations/conversation_selector/index.tsx index 4891df533fdf1..b68cff6713e91 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant/conversations/conversation_selector/index.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant/conversations/conversation_selector/index.tsx @@ -19,7 +19,7 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react'; import useEvent from 'react-use/lib/useEvent'; import { css } from '@emotion/react'; -import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants'; +import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants'; import { Conversation } from '../../../..'; import { useAssistantContext } from '../../../assistant_context'; import * as i18n from './translations'; diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant/conversations/conversation_selector_settings/index.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant/conversations/conversation_selector_settings/index.tsx index a4618c736eb60..3f26c97f5ad0b 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant/conversations/conversation_selector_settings/index.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant/conversations/conversation_selector_settings/index.tsx @@ -18,7 +18,7 @@ import { import React, { useCallback, useMemo, useState } from 'react'; import { css } from '@emotion/react'; -import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants'; +import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants'; import { Conversation, Prompt } from '../../../..'; import { UseAssistantContext } from '../../../assistant_context'; import * as i18n from './translations'; diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant/index.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant/index.tsx index d119526a198c5..cdfd8187e7a2f 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant/index.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant/index.tsx @@ -29,7 +29,7 @@ import { import { createPortal } from 'react-dom'; import { css } from '@emotion/react'; -import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants'; +import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants'; import { ActionConnectorProps } from '@kbn/triggers-actions-ui-plugin/public/types'; import { ChatSend } from './chat_send'; import { BlockBotCallToAction } from './block_bot/cta'; diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/assistant_settings.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/assistant_settings.tsx index 1fec8e79af75a..caf8fa77a9b61 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/assistant_settings.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/assistant_settings.tsx @@ -23,7 +23,7 @@ import { // eslint-disable-next-line @kbn/eslint/module_migration import styled from 'styled-components'; import { css } from '@emotion/react'; -import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants'; +import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants'; import { Conversation, Prompt, QuickPrompt } from '../../..'; import * as i18n from './translations'; import { useAssistantContext } from '../../assistant_context'; diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/assistant_settings_button.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/assistant_settings_button.tsx index 773c68bbccf0e..f559ae8aa76dd 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/assistant_settings_button.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant/settings/assistant_settings_button.tsx @@ -8,7 +8,7 @@ import React, { useCallback } from 'react'; import { EuiButtonIcon, EuiToolTip } from '@elastic/eui'; -import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants'; +import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants'; import { Conversation } from '../../..'; import { AssistantSettings, CONVERSATIONS_TAB } from './assistant_settings'; import * as i18n from './translations'; diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/types.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/types.tsx index 573581091eebf..bf0a20e2b6ea5 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/types.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/types.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants'; +import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants'; export type ConversationRole = 'system' | 'user' | 'assistant'; diff --git a/x-pack/packages/kbn-elastic-assistant/impl/connectorland/connector_button/index.tsx b/x-pack/packages/kbn-elastic-assistant/impl/connectorland/connector_button/index.tsx index 8db849f64fdf6..8cfeb2ce0efdc 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/connectorland/connector_button/index.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/connectorland/connector_button/index.tsx @@ -8,7 +8,7 @@ import React, { useCallback } from 'react'; import { EuiCard, EuiFlexGroup, EuiFlexItem, EuiIcon } from '@elastic/eui'; -import { GenAiLogo } from '@kbn/stack-connectors-plugin/public/common'; +import { OpenAILogo } from '@kbn/stack-connectors-plugin/public/common'; import * as i18n from '../translations'; import { useAssistantContext } from '../../assistant_context'; @@ -41,7 +41,7 @@ export const ConnectorButton: React.FC = React.memo} + icon={} title={title} description={description} onClick={assistantAvailability.hasConnectorsAllPrivilege ? onClick : undefined} diff --git a/x-pack/packages/kbn-elastic-assistant/impl/connectorland/helpers.tsx b/x-pack/packages/kbn-elastic-assistant/impl/connectorland/helpers.tsx index b5db94fe041d3..9147a6ca83dba 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/connectorland/helpers.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/connectorland/helpers.tsx @@ -7,7 +7,7 @@ import type { ActionConnector } from '@kbn/triggers-actions-ui-plugin/public'; import { ActionConnectorProps } from '@kbn/triggers-actions-ui-plugin/public/types'; -import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants'; +import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants'; import { ActionTypeModel } from '@kbn/triggers-actions-ui-plugin/public'; interface GenAiConfig { @@ -20,7 +20,7 @@ interface GenAiConfig { * Returns the GenAiConfig for a given ActionConnector. Note that if the connector is preconfigured, * the config will be undefined as the connector is neither available nor editable. * - * TODO: Extract and use separate types from GenAiConfig from '@kbn/stack-connectors-plugin/common/gen_ai/types' + * TODO: Extract and use separate types from GenAiConfig from '@kbn/stack-connectors-plugin/common/openai/types' * * @param connector */ diff --git a/x-pack/packages/kbn-elastic-assistant/impl/connectorland/use_load_action_types/index.tsx b/x-pack/packages/kbn-elastic-assistant/impl/connectorland/use_load_action_types/index.tsx index 796ece694664a..b923471e8c368 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/connectorland/use_load_action_types/index.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/connectorland/use_load_action_types/index.tsx @@ -15,7 +15,7 @@ import type { IHttpFetchError } from '@kbn/core-http-browser'; import type { ActionType } from '@kbn/actions-plugin/common'; import { HttpSetup } from '@kbn/core-http-browser'; import { IToasts } from '@kbn/core-notifications-browser'; -import { GeneralConnectorFeatureId } from '@kbn/actions-plugin/common'; +import { GenerativeAIConnectorFeatureId } from '@kbn/actions-plugin/common'; import * as i18n from '../translations'; /** @@ -37,7 +37,10 @@ export const useLoadActionTypes = ({ QUERY_KEY, async () => { - const queryResult = await loadActionTypes({ http, featureId: GeneralConnectorFeatureId }); + const queryResult = await loadActionTypes({ + http, + featureId: GenerativeAIConnectorFeatureId, + }); const sortedData = queryResult.sort((a, b) => a.name.localeCompare(b.name)); return sortedData; diff --git a/x-pack/packages/kbn-elastic-assistant/impl/content/prompts/welcome/translations.ts b/x-pack/packages/kbn-elastic-assistant/impl/content/prompts/welcome/translations.ts index 85c355cf4456c..936d27fb1005a 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/content/prompts/welcome/translations.ts +++ b/x-pack/packages/kbn-elastic-assistant/impl/content/prompts/welcome/translations.ts @@ -19,7 +19,7 @@ export const WELCOME_GENERAL_2 = i18n.translate( 'xpack.elasticAssistant.securityAssistant.content.prompts.welcome.welcomeGeneral2Prompt', { defaultMessage: - "First things first, we'll need to set up a Generative AI Connector to get this chat experience going! With the Generative AI Connector, you'll be able to configure access to either an Azure OpenAI Service or OpenAI API account, but you better believe you'll be able to deploy your own models within your Elastic Cloud instance and use those here in the future... 😉", + "First things first, we'll need to set up a Generative AI Connector to get this chat experience going! With the Generative AI Connector, you'll be able to configure access to either an OpenAI service or an AWS Bedrock service, but you better believe you'll be able to deploy your own models within your Elastic Cloud instance and use those here in the future... 😉", } ); diff --git a/x-pack/packages/kbn-elastic-assistant/impl/mock/conversation.ts b/x-pack/packages/kbn-elastic-assistant/impl/mock/conversation.ts index 9444350e1a0e1..8e8a099766812 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/mock/conversation.ts +++ b/x-pack/packages/kbn-elastic-assistant/impl/mock/conversation.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants'; +import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants'; import { Conversation } from '../..'; export const alertConvo: Conversation = { diff --git a/x-pack/plugins/actions/common/connector_feature_config.test.ts b/x-pack/plugins/actions/common/connector_feature_config.test.ts index cb571dfa8714d..c12e3db21127f 100644 --- a/x-pack/plugins/actions/common/connector_feature_config.test.ts +++ b/x-pack/plugins/actions/common/connector_feature_config.test.ts @@ -13,7 +13,7 @@ import { describe('areValidFeatures', () => { it('returns true when all inputs are valid features', () => { - expect(areValidFeatures(['alerting', 'cases', 'general'])).toBeTruthy(); + expect(areValidFeatures(['alerting', 'cases', 'generativeAI'])).toBeTruthy(); }); it('returns true when only one input and it is a valid feature', () => { @@ -42,11 +42,9 @@ describe('getConnectorFeatureName', () => { describe('getConnectorCompatibility', () => { it('returns the compatibility list for valid feature ids', () => { - expect(getConnectorCompatibility(['alerting', 'cases', 'uptime', 'siem', 'general'])).toEqual([ - 'Alerting Rules', - 'Cases', - 'General', - ]); + expect( + getConnectorCompatibility(['alerting', 'cases', 'uptime', 'siem', 'generativeAI']) + ).toEqual(['Alerting Rules', 'Cases', 'Generative AI']); }); it('skips invalid feature ids', () => { diff --git a/x-pack/plugins/actions/common/connector_feature_config.ts b/x-pack/plugins/actions/common/connector_feature_config.ts index 27c035546882b..61a67087da9fa 100644 --- a/x-pack/plugins/actions/common/connector_feature_config.ts +++ b/x-pack/plugins/actions/common/connector_feature_config.ts @@ -25,12 +25,12 @@ export const AlertingConnectorFeatureId = 'alerting'; export const CasesConnectorFeatureId = 'cases'; export const UptimeConnectorFeatureId = 'uptime'; export const SecurityConnectorFeatureId = 'siem'; -export const GeneralConnectorFeatureId = 'general'; +export const GenerativeAIConnectorFeatureId = 'generativeAI'; -const compatibilityGeneral = i18n.translate( - 'xpack.actions.availableConnectorFeatures.compatibility.general', +const compatibilityGenerativeAI = i18n.translate( + 'xpack.actions.availableConnectorFeatures.compatibility.generativeAI', { - defaultMessage: 'General', + defaultMessage: 'Generative AI', } ); @@ -80,10 +80,10 @@ export const SecuritySolutionFeature: ConnectorFeatureConfig = { compatibility: compatibilityAlertingRules, }; -export const GeneralFeature: ConnectorFeatureConfig = { - id: GeneralConnectorFeatureId, - name: compatibilityGeneral, - compatibility: compatibilityGeneral, +export const GenerativeAIFeature: ConnectorFeatureConfig = { + id: GenerativeAIConnectorFeatureId, + name: compatibilityGenerativeAI, + compatibility: compatibilityGenerativeAI, }; const AllAvailableConnectorFeatures = { @@ -91,7 +91,7 @@ const AllAvailableConnectorFeatures = { [CasesConnectorFeature.id]: CasesConnectorFeature, [UptimeConnectorFeature.id]: UptimeConnectorFeature, [SecuritySolutionFeature.id]: SecuritySolutionFeature, - [GeneralFeature.id]: GeneralFeature, + [GenerativeAIFeature.id]: GenerativeAIFeature, }; export function areValidFeatures(ids: string[]) { diff --git a/x-pack/plugins/actions/common/types.ts b/x-pack/plugins/actions/common/types.ts index c3e1b35777fff..44d7516595d19 100644 --- a/x-pack/plugins/actions/common/types.ts +++ b/x-pack/plugins/actions/common/types.ts @@ -12,7 +12,7 @@ export { CasesConnectorFeatureId, UptimeConnectorFeatureId, SecurityConnectorFeatureId, - GeneralConnectorFeatureId, + GenerativeAIConnectorFeatureId, } from './connector_feature_config'; export interface ActionType { id: string; diff --git a/x-pack/plugins/actions/docs/openapi/bundled.json b/x-pack/plugins/actions/docs/openapi/bundled.json index 94efaf061fb4f..801dd78a76936 100644 --- a/x-pack/plugins/actions/docs/openapi/bundled.json +++ b/x-pack/plugins/actions/docs/openapi/bundled.json @@ -1768,7 +1768,7 @@ } }, "config_properties_genai": { - "title": "Connector request properties for a generative AI connector", + "title": "Connector request properties for an OpenAI connector", "description": "Defines properties for connectors when type is `.gen-ai`.", "oneOf": [ { @@ -1821,7 +1821,7 @@ } }, "secrets_properties_genai": { - "title": "Connector secrets properties for a generative AI connector", + "title": "Connector secrets properties for an OpenAI connector", "description": "Defines secrets for connectors when type is `.gen-ai`.", "type": "object", "properties": { @@ -1832,8 +1832,8 @@ } }, "create_connector_request_genai": { - "title": "Create generative AI connector request", - "description": "The generative AI connector uses axios to send a POST request to either OpenAI or Azure OpenAPI.\n", + "title": "Create OpenAI connector request", + "description": "The OpenAI connector uses axios to send a POST request to either OpenAI or Azure OpenAPI.\n", "type": "object", "required": [ "config", @@ -5722,4 +5722,4 @@ } } } -} \ No newline at end of file +} diff --git a/x-pack/plugins/actions/docs/openapi/bundled.yaml b/x-pack/plugins/actions/docs/openapi/bundled.yaml index b1ff36d6f3370..63156405da018 100644 --- a/x-pack/plugins/actions/docs/openapi/bundled.yaml +++ b/x-pack/plugins/actions/docs/openapi/bundled.yaml @@ -1031,14 +1031,14 @@ components: type: boolean host: description: | - The host name of the service provider. If the `service` is `elastic_cloud` (for Elastic Cloud notifications) or one of Nodemailer's well-known email service providers, this property is ignored. If `service` is `other`, this property must be defined. + The host name of the service provider. If the `service` is `elastic_cloud` (for Elastic Cloud notifications) or one of Nodemailer's well-known email service providers, this property is ignored. If `service` is `other`, this property must be defined. type: string oauthTokenUrl: type: string nullable: true port: description: | - The port to connect to on the service provider. If the `service` is `elastic_cloud` (for Elastic Cloud notifications) or one of Nodemailer's well-known email service providers, this property is ignored. If `service` is `other`, this property must be defined. + The port to connect to on the service provider. If the `service` is `elastic_cloud` (for Elastic Cloud notifications) or one of Nodemailer's well-known email service providers, this property is ignored. If `service` is `other`, this property must be defined. type: integer secure: description: | @@ -1103,7 +1103,7 @@ components: secrets: $ref: '#/components/schemas/secrets_properties_email' config_properties_genai: - title: Connector request properties for a generative AI connector + title: Connector request properties for an OpenAI connector description: Defines properties for connectors when type is `.gen-ai`. oneOf: - type: object @@ -1138,7 +1138,7 @@ components: discriminator: propertyName: apiProvider secrets_properties_genai: - title: Connector secrets properties for a generative AI connector + title: Connector secrets properties for an OpenAI connector description: Defines secrets for connectors when type is `.gen-ai`. type: object properties: @@ -1146,9 +1146,9 @@ components: type: string description: The OpenAI API key. create_connector_request_genai: - title: Create generative AI connector request + title: Create OpenAI connector request description: | - The generative AI connector uses axios to send a POST request to either OpenAI or Azure OpenAPI. + The OpenAI connector uses axios to send a POST request to either OpenAI or Azure OpenAPI. type: object required: - config diff --git a/x-pack/plugins/actions/docs/openapi/components/schemas/config_properties_genai.yaml b/x-pack/plugins/actions/docs/openapi/components/schemas/config_properties_genai.yaml index ca4388303fd2c..8797f1b330374 100644 --- a/x-pack/plugins/actions/docs/openapi/components/schemas/config_properties_genai.yaml +++ b/x-pack/plugins/actions/docs/openapi/components/schemas/config_properties_genai.yaml @@ -1,4 +1,4 @@ -title: Connector request properties for a generative AI connector +title: Connector request properties for an OpenAI connector description: Defines properties for connectors when type is `.gen-ai`. oneOf: - type: object @@ -29,4 +29,4 @@ oneOf: type: string description: The default model to use for requests. discriminator: - propertyName: apiProvider \ No newline at end of file + propertyName: apiProvider diff --git a/x-pack/plugins/actions/docs/openapi/components/schemas/connector_response_properties_genai.yaml b/x-pack/plugins/actions/docs/openapi/components/schemas/connector_response_properties_genai.yaml index 17e748216639d..928147ed87a69 100644 --- a/x-pack/plugins/actions/docs/openapi/components/schemas/connector_response_properties_genai.yaml +++ b/x-pack/plugins/actions/docs/openapi/components/schemas/connector_response_properties_genai.yaml @@ -1,4 +1,4 @@ -title: Connector response properties for a generative AI connector +title: Connector response properties for an OpenAI connector type: object required: - config diff --git a/x-pack/plugins/actions/docs/openapi/components/schemas/create_connector_request_genai.yaml b/x-pack/plugins/actions/docs/openapi/components/schemas/create_connector_request_genai.yaml index 9aa605c136bb9..95d65bdb80919 100644 --- a/x-pack/plugins/actions/docs/openapi/components/schemas/create_connector_request_genai.yaml +++ b/x-pack/plugins/actions/docs/openapi/components/schemas/create_connector_request_genai.yaml @@ -1,6 +1,6 @@ -title: Create generative AI connector request +title: Create OpenAI connector request description: > - The generative AI connector uses axios to send a POST request to either + The OpenAI connector uses axios to send a POST request to either OpenAI or Azure OpenAPI. type: object required: @@ -22,4 +22,4 @@ properties: description: The display name for the connector. example: my-connector secrets: - $ref: 'secrets_properties_genai.yaml' \ No newline at end of file + $ref: 'secrets_properties_genai.yaml' diff --git a/x-pack/plugins/actions/docs/openapi/components/schemas/secrets_properties_genai.yaml b/x-pack/plugins/actions/docs/openapi/components/schemas/secrets_properties_genai.yaml index fae3f0ea131cc..586c50ddbbd37 100644 --- a/x-pack/plugins/actions/docs/openapi/components/schemas/secrets_properties_genai.yaml +++ b/x-pack/plugins/actions/docs/openapi/components/schemas/secrets_properties_genai.yaml @@ -1,7 +1,7 @@ -title: Connector secrets properties for a generative AI connector +title: Connector secrets properties for an OpenAI connector description: Defines secrets for connectors when type is `.gen-ai`. type: object properties: apiKey: type: string - description: The OpenAI API key. \ No newline at end of file + description: The OpenAI API key. diff --git a/x-pack/plugins/actions/docs/openapi/components/schemas/update_connector_request_genai.yaml b/x-pack/plugins/actions/docs/openapi/components/schemas/update_connector_request_genai.yaml index a7fbf5cb7bcfa..709dea64280dc 100644 --- a/x-pack/plugins/actions/docs/openapi/components/schemas/update_connector_request_genai.yaml +++ b/x-pack/plugins/actions/docs/openapi/components/schemas/update_connector_request_genai.yaml @@ -1,4 +1,4 @@ -title: Update generative AI connector request +title: Update OpenAI connector request type: object required: - config @@ -10,4 +10,4 @@ properties: type: string description: The display name for the connector. secrets: - $ref: 'secrets_properties_genai.yaml' \ No newline at end of file + $ref: 'secrets_properties_genai.yaml' diff --git a/x-pack/plugins/actions/server/lib/action_executor.test.ts b/x-pack/plugins/actions/server/lib/action_executor.test.ts index f0a11b9f90042..a966605bd3a4f 100644 --- a/x-pack/plugins/actions/server/lib/action_executor.test.ts +++ b/x-pack/plugins/actions/server/lib/action_executor.test.ts @@ -1766,7 +1766,7 @@ test('writes to event log for execute and execute start when consumer and relate }); }); -test('writes usage data to event log for gen ai events', async () => { +test('writes usage data to event log for OpenAI events', async () => { const executorMock = setupActionExecutorMock('.gen-ai'); const mockGenAi = { id: 'chatcmpl-7LztF5xsJl2z5jcNpJKvaPm4uWt8x', diff --git a/x-pack/plugins/actions/server/lib/action_executor.ts b/x-pack/plugins/actions/server/lib/action_executor.ts index d5257f4eb8450..d3d57de4cda4e 100644 --- a/x-pack/plugins/actions/server/lib/action_executor.ts +++ b/x-pack/plugins/actions/server/lib/action_executor.ts @@ -286,8 +286,8 @@ export class ActionExecutor { event.event = event.event || {}; - // start gen_ai extension - // add event.kibana.action.execution.gen_ai to event log when GenerativeAi Connector is executed + // start openai extension + // add event.kibana.action.execution.openai to event log when OpenAI Connector is executed if (result.status === 'ok' && actionTypeId === '.gen-ai') { const data = result.data as unknown as { usage: { prompt_tokens?: number; completion_tokens?: number; total_tokens?: number }; @@ -311,7 +311,7 @@ export class ActionExecutor { }, }; } - // end gen_ai extension + // end openai extension const currentUser = security?.authc.getCurrentUser(request); diff --git a/x-pack/plugins/elastic_assistant/server/routes/evaluate/utils.ts b/x-pack/plugins/elastic_assistant/server/routes/evaluate/utils.ts index b1a37a5e60e81..a519398f158be 100644 --- a/x-pack/plugins/elastic_assistant/server/routes/evaluate/utils.ts +++ b/x-pack/plugins/elastic_assistant/server/routes/evaluate/utils.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/gen_ai/constants'; +import { OpenAiProviderType } from '@kbn/stack-connectors-plugin/common/openai/constants'; import type { ActionResult } from '@kbn/actions-plugin/server'; /** diff --git a/x-pack/plugins/observability_ai_assistant/README.md b/x-pack/plugins/observability_ai_assistant/README.md index 11e6d7d38d659..8d5e166883995 100644 --- a/x-pack/plugins/observability_ai_assistant/README.md +++ b/x-pack/plugins/observability_ai_assistant/README.md @@ -6,7 +6,7 @@ This document gives an overview of the features of the Observability AI Assistan #### **1.1. Configuration** -Users can connect to an LLM using [connectors](https://www.elastic.co/guide/en/kibana/current/action-types.html) - specifically the [Generative AI connector](https://www.elastic.co/guide/en/kibana/current/gen-ai-action-type.html), which currently supports both OpenAI and Azure OpenAI as providers. The connector is Enterprise-only. Users can also leverage [preconfigured connectors](https://www.elastic.co/guide/en/kibana/current/pre-configured-connectors.html), in which case the following should be added to `kibana.yml`: +Users can connect to an LLM using [connectors](https://www.elastic.co/guide/en/kibana/current/action-types.html) - specifically the [OpenAI connector](https://www.elastic.co/guide/en/kibana/current/openai-action-type.html), which currently supports both OpenAI and Azure OpenAI as providers. The connector is Enterprise-only. Users can also leverage [preconfigured connectors](https://www.elastic.co/guide/en/kibana/current/pre-configured-connectors.html), in which case the following should be added to `kibana.yml`: ```yaml xpack.actions.preconfigured: diff --git a/x-pack/plugins/observability_ai_assistant/public/components/chat/initial_setup_panel.tsx b/x-pack/plugins/observability_ai_assistant/public/components/chat/initial_setup_panel.tsx index 281cf46c972bb..b8c99bbfa7cd4 100644 --- a/x-pack/plugins/observability_ai_assistant/public/components/chat/initial_setup_panel.tsx +++ b/x-pack/plugins/observability_ai_assistant/public/components/chat/initial_setup_panel.tsx @@ -143,7 +143,7 @@ export function InitialSetupPanel({ {i18n.translate( 'xpack.observabilityAiAssistant.initialSetupPanel.setupConnector.description1', { - defaultMessage: 'Set up a Generative AI connector with your AI provider.', + defaultMessage: 'Set up an OpenAI connector with your AI provider.', } )}

    @@ -153,7 +153,7 @@ export function InitialSetupPanel({ 'xpack.observabilityAiAssistant.initialSetupPanel.setupConnector.description2', { defaultMessage: - 'The Generative AI model needs to support function calls. We strongly recommend using GPT4.', + 'The OpenAI model needs to support function calls. We strongly recommend using GPT4.', } )} diff --git a/x-pack/plugins/stack_connectors/common/gen_ai/constants.ts b/x-pack/plugins/stack_connectors/common/openai/constants.ts similarity index 93% rename from x-pack/plugins/stack_connectors/common/gen_ai/constants.ts rename to x-pack/plugins/stack_connectors/common/openai/constants.ts index 8c8dd84c4e326..db01f52d762cf 100644 --- a/x-pack/plugins/stack_connectors/common/gen_ai/constants.ts +++ b/x-pack/plugins/stack_connectors/common/openai/constants.ts @@ -7,13 +7,13 @@ import { i18n } from '@kbn/i18n'; -export const OPEN_AI_TITLE = i18n.translate( +export const OPENAI_TITLE = i18n.translate( 'xpack.stackConnectors.components.genAi.connectorTypeTitle', { defaultMessage: 'OpenAI', } ); -export const GEN_AI_CONNECTOR_ID = '.gen-ai'; +export const OPENAI_CONNECTOR_ID = '.gen-ai'; export enum SUB_ACTION { RUN = 'run', INVOKE_AI = 'invokeAI', diff --git a/x-pack/plugins/stack_connectors/common/gen_ai/schema.ts b/x-pack/plugins/stack_connectors/common/openai/schema.ts similarity index 100% rename from x-pack/plugins/stack_connectors/common/gen_ai/schema.ts rename to x-pack/plugins/stack_connectors/common/openai/schema.ts diff --git a/x-pack/plugins/stack_connectors/common/gen_ai/types.ts b/x-pack/plugins/stack_connectors/common/openai/types.ts similarity index 100% rename from x-pack/plugins/stack_connectors/common/gen_ai/types.ts rename to x-pack/plugins/stack_connectors/common/openai/types.ts diff --git a/x-pack/plugins/stack_connectors/public/common/index.ts b/x-pack/plugins/stack_connectors/public/common/index.ts index ec0ce2960114b..ec5dd5e69e242 100644 --- a/x-pack/plugins/stack_connectors/public/common/index.ts +++ b/x-pack/plugins/stack_connectors/public/common/index.ts @@ -5,7 +5,7 @@ * 2.0. */ -import GenAiLogo from '../connector_types/gen_ai/logo'; +import OpenAILogo from '../connector_types/openai/logo'; -export { GEN_AI_CONNECTOR_ID, OpenAiProviderType } from '../../common/gen_ai/constants'; -export { GenAiLogo }; +export { OPENAI_CONNECTOR_ID, OpenAiProviderType } from '../../common/openai/constants'; +export { OpenAILogo }; diff --git a/x-pack/plugins/stack_connectors/public/connector_types/d3security/d3security.tsx b/x-pack/plugins/stack_connectors/public/connector_types/d3security/d3security.tsx index 41df7d3aed16d..f3223eb8314f3 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/d3security/d3security.tsx +++ b/x-pack/plugins/stack_connectors/public/connector_types/d3security/d3security.tsx @@ -8,7 +8,7 @@ import { lazy } from 'react'; import { i18n } from '@kbn/i18n'; import { GenericValidationResult } from '@kbn/triggers-actions-ui-plugin/public/types'; -import { SUB_ACTION } from '../../../common/gen_ai/constants'; +import { SUB_ACTION } from '../../../common/d3security/constants'; import { D3SecurityActionParams, D3SecurityConnector } from './types'; import { D3_SECURITY_CONNECTOR_ID } from '../../../common/d3security/constants'; interface ValidationErrors { diff --git a/x-pack/plugins/stack_connectors/public/connector_types/index.ts b/x-pack/plugins/stack_connectors/public/connector_types/index.ts index 20964012607f8..0c024870133dc 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/index.ts +++ b/x-pack/plugins/stack_connectors/public/connector_types/index.ts @@ -11,7 +11,7 @@ import { getCasesWebhookConnectorType } from './cases_webhook'; import { getEmailConnectorType } from './email'; import { getIndexConnectorType } from './es_index'; import { getJiraConnectorType } from './jira'; -import { getGenerativeAiConnectorType } from './gen_ai'; +import { getOpenAIConnectorType } from './openai'; import { getBedrockConnectorType } from './bedrock'; import { getOpsgenieConnectorType } from './opsgenie'; import { getPagerDutyConnectorType } from './pagerduty'; @@ -60,7 +60,7 @@ export function registerConnectorTypes({ connectorTypeRegistry.register(getJiraConnectorType()); connectorTypeRegistry.register(getResilientConnectorType()); connectorTypeRegistry.register(getOpsgenieConnectorType()); - connectorTypeRegistry.register(getGenerativeAiConnectorType()); + connectorTypeRegistry.register(getOpenAIConnectorType()); connectorTypeRegistry.register(getBedrockConnectorType()); connectorTypeRegistry.register(getTeamsConnectorType()); connectorTypeRegistry.register(getTorqConnectorType()); diff --git a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/api.test.ts b/x-pack/plugins/stack_connectors/public/connector_types/openai/api.test.ts similarity index 95% rename from x-pack/plugins/stack_connectors/public/connector_types/gen_ai/api.test.ts rename to x-pack/plugins/stack_connectors/public/connector_types/openai/api.test.ts index cf1197c487cd9..5ab342a22828b 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/api.test.ts +++ b/x-pack/plugins/stack_connectors/public/connector_types/openai/api.test.ts @@ -7,7 +7,7 @@ import { httpServiceMock } from '@kbn/core-http-browser-mocks'; import { getDashboard } from './api'; -import { SUB_ACTION } from '../../../common/gen_ai/constants'; +import { SUB_ACTION } from '../../../common/openai/constants'; const response = { available: true, }; diff --git a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/api.ts b/x-pack/plugins/stack_connectors/public/connector_types/openai/api.ts similarity index 94% rename from x-pack/plugins/stack_connectors/public/connector_types/gen_ai/api.ts rename to x-pack/plugins/stack_connectors/public/connector_types/openai/api.ts index da35d608239b1..97b0608bb725d 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/api.ts +++ b/x-pack/plugins/stack_connectors/public/connector_types/openai/api.ts @@ -7,7 +7,7 @@ import { HttpSetup } from '@kbn/core-http-browser'; import { ActionTypeExecutorResult, BASE_ACTION_API_PATH } from '@kbn/actions-plugin/common'; -import { SUB_ACTION } from '../../../common/gen_ai/constants'; +import { SUB_ACTION } from '../../../common/openai/constants'; import { ConnectorExecutorResult, rewriteResponseToCamelCase } from '../lib/rewrite_response_body'; export async function getDashboard({ diff --git a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/connector.test.tsx b/x-pack/plugins/stack_connectors/public/connector_types/openai/connector.test.tsx similarity index 81% rename from x-pack/plugins/stack_connectors/public/connector_types/gen_ai/connector.test.tsx rename to x-pack/plugins/stack_connectors/public/connector_types/openai/connector.test.tsx index 5e561615f0bcf..e88c3fa116153 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/connector.test.tsx +++ b/x-pack/plugins/stack_connectors/public/connector_types/openai/connector.test.tsx @@ -6,11 +6,11 @@ */ import React from 'react'; -import GenerativeAiConnectorFields from './connector'; +import ConnectorFields from './connector'; import { ConnectorFormTestProvider } from '../lib/test_utils'; import { act, fireEvent, render, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { DEFAULT_OPENAI_MODEL, OpenAiProviderType } from '../../../common/gen_ai/constants'; +import { DEFAULT_OPENAI_MODEL, OpenAiProviderType } from '../../../common/openai/constants'; import { useKibana } from '@kbn/triggers-actions-ui-plugin/public'; import { useGetDashboard } from './use_get_dashboard'; @@ -21,7 +21,7 @@ const useKibanaMock = useKibana as jest.Mocked; const mockDashboard = useGetDashboard as jest.Mock; const openAiConnector = { actionTypeId: '.gen-ai', - name: 'genAi', + name: 'OpenAI', id: '123', config: { apiUrl: 'https://openaiurl.com', @@ -46,7 +46,7 @@ const azureConnector = { const navigateToUrl = jest.fn(); -describe('GenerativeAiConnectorFields renders', () => { +describe('ConnectorFields renders', () => { beforeEach(() => { jest.clearAllMocks(); useKibanaMock().services.application.navigateToUrl = navigateToUrl; @@ -57,11 +57,7 @@ describe('GenerativeAiConnectorFields renders', () => { test('open ai connector fields are rendered', async () => { const { getAllByTestId } = render( - {}} - /> + {}} /> ); expect(getAllByTestId('config.apiUrl-input')[0]).toBeInTheDocument(); @@ -77,11 +73,7 @@ describe('GenerativeAiConnectorFields renders', () => { test('azure ai connector fields are rendered', async () => { const { getAllByTestId } = render( - {}} - /> + {}} /> ); expect(getAllByTestId('config.apiUrl-input')[0]).toBeInTheDocument(); @@ -98,11 +90,7 @@ describe('GenerativeAiConnectorFields renders', () => { it('Does not render if isEdit is false and dashboardUrl is defined', async () => { const { queryByTestId } = render( - {}} - /> + {}} /> ); expect(queryByTestId('link-gen-ai-token-dashboard')).not.toBeInTheDocument(); @@ -113,11 +101,7 @@ describe('GenerativeAiConnectorFields renders', () => { })); const { queryByTestId } = render( - {}} - /> + {}} /> ); expect(queryByTestId('link-gen-ai-token-dashboard')).not.toBeInTheDocument(); @@ -125,11 +109,7 @@ describe('GenerativeAiConnectorFields renders', () => { it('Renders if isEdit is true and dashboardUrl is defined', async () => { const { getByTestId } = render( - {}} - /> + {}} /> ); expect(getByTestId('link-gen-ai-token-dashboard')).toBeInTheDocument(); @@ -137,11 +117,7 @@ describe('GenerativeAiConnectorFields renders', () => { it('On click triggers redirect with correct saved object id', async () => { const { getByTestId } = render( - {}} - /> + {}} /> ); fireEvent.click(getByTestId('link-gen-ai-token-dashboard')); @@ -158,11 +134,7 @@ describe('GenerativeAiConnectorFields renders', () => { it('connector validation succeeds when connector config is valid', async () => { const { getByTestId } = render( - {}} - /> + {}} /> ); @@ -191,11 +163,7 @@ describe('GenerativeAiConnectorFields renders', () => { const res = render( - {}} - /> + {}} /> ); @@ -224,11 +192,7 @@ describe('GenerativeAiConnectorFields renders', () => { const res = render( - {}} - /> + {}} /> ); diff --git a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/connector.tsx b/x-pack/plugins/stack_connectors/public/connector_types/openai/connector.tsx similarity index 93% rename from x-pack/plugins/stack_connectors/public/connector_types/gen_ai/connector.tsx rename to x-pack/plugins/stack_connectors/public/connector_types/openai/connector.tsx index 99b8bb701e60e..516ff9c3e9264 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/connector.tsx +++ b/x-pack/plugins/stack_connectors/public/connector_types/openai/connector.tsx @@ -19,8 +19,8 @@ import { } from '@kbn/es-ui-shared-plugin/static/forms/hook_form_lib'; import { useKibana } from '@kbn/triggers-actions-ui-plugin/public'; import { fieldValidators } from '@kbn/es-ui-shared-plugin/static/forms/helpers'; +import { OpenAiProviderType } from '../../../common/openai/constants'; import { useGetDashboard } from './use_get_dashboard'; -import { OpenAiProviderType } from '../../../common/gen_ai/constants'; import * as i18n from './translations'; import { azureAiConfig, @@ -31,10 +31,7 @@ import { } from './constants'; const { emptyField } = fieldValidators; -const GenerativeAiConnectorFields: React.FC = ({ - readOnly, - isEdit, -}) => { +const ConnectorFields: React.FC = ({ readOnly, isEdit }) => { const { getFieldDefaultValue } = useFormContext(); const [{ config, id, name }] = useFormData({ watch: ['config.apiProvider'], @@ -117,4 +114,4 @@ const GenerativeAiConnectorFields: React.FC = ({ }; // eslint-disable-next-line import/no-default-export -export { GenerativeAiConnectorFields as default }; +export { ConnectorFields as default }; diff --git a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/constants.tsx b/x-pack/plugins/stack_connectors/public/connector_types/openai/constants.tsx similarity index 96% rename from x-pack/plugins/stack_connectors/public/connector_types/gen_ai/constants.tsx rename to x-pack/plugins/stack_connectors/public/connector_types/openai/constants.tsx index ab7f18e2be00f..4df722ecfae04 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/constants.tsx +++ b/x-pack/plugins/stack_connectors/public/connector_types/openai/constants.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { ConfigFieldSchema, SecretsFieldSchema } from '@kbn/triggers-actions-ui-plugin/public'; import { FormattedMessage } from '@kbn/i18n-react'; import { EuiLink } from '@elastic/eui'; -import { DEFAULT_OPENAI_MODEL, OpenAiProviderType } from '../../../common/gen_ai/constants'; +import { DEFAULT_OPENAI_MODEL, OpenAiProviderType } from '../../../common/openai/constants'; import * as i18n from './translations'; export const DEFAULT_URL = 'https://api.openai.com/v1/chat/completions' as const; @@ -46,7 +46,7 @@ export const openAiConfig: ConfigFieldSchema[] = [ href="https://platform.openai.com/docs/api-reference" target="_blank" > - {`${i18n.OPEN_AI} ${i18n.DOCUMENTATION}`} + {`${i18n.OPENAI} ${i18n.DOCUMENTATION}`} ), }} @@ -108,7 +108,7 @@ export const openAiSecrets: SecretsFieldSchema[] = [ href="https://platform.openai.com/account/api-keys" target="_blank" > - {`${i18n.OPEN_AI} ${i18n.DOCUMENTATION}`} + {`${i18n.OPENAI} ${i18n.DOCUMENTATION}`} ), }} @@ -145,8 +145,8 @@ export const azureAiSecrets: SecretsFieldSchema[] = [ export const providerOptions = [ { value: OpenAiProviderType.OpenAi, - text: i18n.OPEN_AI, - label: i18n.OPEN_AI, + text: i18n.OPENAI, + label: i18n.OPENAI, }, { value: OpenAiProviderType.AzureAi, diff --git a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/index.ts b/x-pack/plugins/stack_connectors/public/connector_types/openai/index.ts similarity index 76% rename from x-pack/plugins/stack_connectors/public/connector_types/gen_ai/index.ts rename to x-pack/plugins/stack_connectors/public/connector_types/openai/index.ts index dea9dbeaef3d7..8c51a45c58f9f 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/index.ts +++ b/x-pack/plugins/stack_connectors/public/connector_types/openai/index.ts @@ -5,4 +5,4 @@ * 2.0. */ -export { getConnectorType as getGenerativeAiConnectorType } from './gen_ai'; +export { getConnectorType as getOpenAIConnectorType } from './openai'; diff --git a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/logo.tsx b/x-pack/plugins/stack_connectors/public/connector_types/openai/logo.tsx similarity index 100% rename from x-pack/plugins/stack_connectors/public/connector_types/gen_ai/logo.tsx rename to x-pack/plugins/stack_connectors/public/connector_types/openai/logo.tsx diff --git a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/gen_ai.test.tsx b/x-pack/plugins/stack_connectors/public/connector_types/openai/openai.test.tsx similarity index 94% rename from x-pack/plugins/stack_connectors/public/connector_types/gen_ai/gen_ai.test.tsx rename to x-pack/plugins/stack_connectors/public/connector_types/openai/openai.test.tsx index 3bed686dca025..49a4d87524f7a 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/gen_ai.test.tsx +++ b/x-pack/plugins/stack_connectors/public/connector_types/openai/openai.test.tsx @@ -9,7 +9,7 @@ import { TypeRegistry } from '@kbn/triggers-actions-ui-plugin/public/application import { registerConnectorTypes } from '..'; import type { ActionTypeModel } from '@kbn/triggers-actions-ui-plugin/public/types'; import { registrationServicesMock } from '../../mocks'; -import { SUB_ACTION } from '../../../common/gen_ai/constants'; +import { SUB_ACTION } from '../../../common/openai/constants'; const ACTION_TYPE_ID = '.gen-ai'; let actionTypeModel: ActionTypeModel; @@ -26,12 +26,12 @@ beforeAll(() => { describe('actionTypeRegistry.get() works', () => { test('connector type static data is as expected', () => { expect(actionTypeModel.id).toEqual(ACTION_TYPE_ID); - expect(actionTypeModel.selectMessage).toBe('Send a request to generative AI systems.'); + expect(actionTypeModel.selectMessage).toBe('Send a request to OpenAI systems.'); expect(actionTypeModel.actionTypeTitle).toBe('OpenAI'); }); }); -describe('gen ai action params validation', () => { +describe('OpenAI action params validation', () => { test('action params validation succeeds when action params is valid', async () => { const actionParams = { subAction: SUB_ACTION.RUN, diff --git a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/gen_ai.tsx b/x-pack/plugins/stack_connectors/public/connector_types/openai/openai.tsx similarity index 80% rename from x-pack/plugins/stack_connectors/public/connector_types/gen_ai/gen_ai.tsx rename to x-pack/plugins/stack_connectors/public/connector_types/openai/openai.tsx index 7a4c798763c46..83340c90be804 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/gen_ai.tsx +++ b/x-pack/plugins/stack_connectors/public/connector_types/openai/openai.tsx @@ -8,24 +8,24 @@ import { lazy } from 'react'; import { i18n } from '@kbn/i18n'; import type { GenericValidationResult } from '@kbn/triggers-actions-ui-plugin/public/types'; -import { SUB_ACTION } from '../../../common/gen_ai/constants'; -import { GEN_AI_CONNECTOR_ID, OPEN_AI_TITLE } from '../../../common/gen_ai/constants'; -import { GenerativeAiActionParams, GenerativeAiConnector } from './types'; +import { SUB_ACTION } from '../../../common/openai/constants'; +import { OPENAI_CONNECTOR_ID, OPENAI_TITLE } from '../../../common/openai/constants'; +import { ActionParams, OpenAIConnector } from './types'; interface ValidationErrors { subAction: string[]; body: string[]; } -export function getConnectorType(): GenerativeAiConnector { +export function getConnectorType(): OpenAIConnector { return { - id: GEN_AI_CONNECTOR_ID, + id: OPENAI_CONNECTOR_ID, iconClass: lazy(() => import('./logo')), selectMessage: i18n.translate('xpack.stackConnectors.components.genAi.selectMessageText', { - defaultMessage: 'Send a request to generative AI systems.', + defaultMessage: 'Send a request to OpenAI systems.', }), - actionTypeTitle: OPEN_AI_TITLE, + actionTypeTitle: OPENAI_TITLE, validateParams: async ( - actionParams: GenerativeAiActionParams + actionParams: ActionParams ): Promise> => { const { subAction, subActionParams } = actionParams; const translations = await import('./translations'); diff --git a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/params.test.tsx b/x-pack/plugins/stack_connectors/public/connector_types/openai/params.test.tsx similarity index 94% rename from x-pack/plugins/stack_connectors/public/connector_types/gen_ai/params.test.tsx rename to x-pack/plugins/stack_connectors/public/connector_types/openai/params.test.tsx index ef418bd16965d..cefabe4d3b1aa 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/params.test.tsx +++ b/x-pack/plugins/stack_connectors/public/connector_types/openai/params.test.tsx @@ -7,9 +7,9 @@ import React from 'react'; import { fireEvent, render } from '@testing-library/react'; -import GenerativeAiParamsFields from './params'; +import ParamsFields from './params'; import { MockCodeEditor } from '@kbn/triggers-actions-ui-plugin/public/application/code_editor.mock'; -import { OpenAiProviderType, SUB_ACTION } from '../../../common/gen_ai/constants'; +import { OpenAiProviderType, SUB_ACTION } from '../../../common/openai/constants'; import { DEFAULT_BODY, DEFAULT_BODY_AZURE, DEFAULT_URL } from './constants'; const kibanaReactPath = '../../../../../../src/plugins/kibana_react/public'; @@ -34,7 +34,7 @@ const messageVariables = [ describe('Gen AI Params Fields renders', () => { test('all params fields are rendered', () => { const { getByTestId } = render( - { isPreconfigured: false, isSystemAction: false as const, isDeprecated: false, - name: 'My GenAI Connector', + name: 'My OpenAI Connector', config: { apiProvider, apiUrl: DEFAULT_URL, }, }; render( - { const editAction = jest.fn(); const errors = {}; render( - { const editAction = jest.fn(); const errors = {}; const { getByTestId } = render( - -> = ({ +const ParamsFields: React.FunctionComponent> = ({ actionConnector, actionParams, editAction, @@ -31,7 +29,7 @@ const GenerativeAiParamsFields: React.FunctionComponent< const { body } = subActionParams ?? {}; - const typedActionConnector = actionConnector as unknown as GenerativeAiActionConnector; + const typedActionConnector = actionConnector as unknown as OpenAIActionConnector; const isTest = useMemo(() => executionMode === ActionConnectorMode.Test, [executionMode]); @@ -55,7 +53,7 @@ const GenerativeAiParamsFields: React.FunctionComponent< }, [typedActionConnector?.config?.apiProvider, editAction, index, subActionParams]); const editSubActionParams = useCallback( - (params: GenerativeAiActionParams['subActionParams']) => { + (params: ActionParams['subActionParams']) => { editAction('subActionParams', { ...subActionParams, ...params }, index); }, [editAction, index, subActionParams] @@ -87,4 +85,4 @@ const GenerativeAiParamsFields: React.FunctionComponent< }; // eslint-disable-next-line import/no-default-export -export { GenerativeAiParamsFields as default }; +export { ParamsFields as default }; diff --git a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/translations.ts b/x-pack/plugins/stack_connectors/public/connector_types/openai/translations.ts similarity index 94% rename from x-pack/plugins/stack_connectors/public/connector_types/gen_ai/translations.ts rename to x-pack/plugins/stack_connectors/public/connector_types/openai/translations.ts index ef6ccd07d386b..f6cfa4a91cf61 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/translations.ts +++ b/x-pack/plugins/stack_connectors/public/connector_types/openai/translations.ts @@ -39,7 +39,7 @@ export const API_PROVIDER_LABEL = i18n.translate( } ); -export const OPEN_AI = i18n.translate('xpack.stackConnectors.components.genAi.openAi', { +export const OPENAI = i18n.translate('xpack.stackConnectors.components.genAi.openAi', { defaultMessage: 'OpenAI', }); @@ -104,6 +104,6 @@ export const USAGE_DASHBOARD_LINK = (apiProvider: string, connectorName: string) export const GET_DASHBOARD_API_ERROR = i18n.translate( 'xpack.stackConnectors.components.genAi.error.dashboardApiError', { - defaultMessage: 'Error finding Generative AI Token Usage Dashboard.', + defaultMessage: 'Error finding OpenAI Token Usage Dashboard.', } ); diff --git a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/types.ts b/x-pack/plugins/stack_connectors/public/connector_types/openai/types.ts similarity index 59% rename from x-pack/plugins/stack_connectors/public/connector_types/gen_ai/types.ts rename to x-pack/plugins/stack_connectors/public/connector_types/openai/types.ts index ddb0f8e871b19..3ba19c04d13a7 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/types.ts +++ b/x-pack/plugins/stack_connectors/public/connector_types/openai/types.ts @@ -7,29 +7,22 @@ import { ActionTypeModel as ConnectorTypeModel } from '@kbn/triggers-actions-ui-plugin/public'; import { UserConfiguredActionConnector } from '@kbn/triggers-actions-ui-plugin/public/types'; -import { OpenAiProviderType, SUB_ACTION } from '../../../common/gen_ai/constants'; -import { RunActionParams } from '../../../common/gen_ai/types'; +import { OpenAiProviderType, SUB_ACTION } from '../../../common/openai/constants'; +import { RunActionParams } from '../../../common/openai/types'; -export interface GenerativeAiActionParams { +export interface ActionParams { subAction: SUB_ACTION.RUN | SUB_ACTION.TEST; subActionParams: RunActionParams; } -export interface GenerativeAiConfig { +export interface Config { apiProvider: OpenAiProviderType; apiUrl: string; } -export interface GenerativeAiSecrets { +export interface Secrets { apiKey: string; } -export type GenerativeAiConnector = ConnectorTypeModel< - GenerativeAiConfig, - GenerativeAiSecrets, - GenerativeAiActionParams ->; -export type GenerativeAiActionConnector = UserConfiguredActionConnector< - GenerativeAiConfig, - GenerativeAiSecrets ->; +export type OpenAIConnector = ConnectorTypeModel; +export type OpenAIActionConnector = UserConfiguredActionConnector; diff --git a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/use_get_dashboard.test.ts b/x-pack/plugins/stack_connectors/public/connector_types/openai/use_get_dashboard.test.ts similarity index 98% rename from x-pack/plugins/stack_connectors/public/connector_types/gen_ai/use_get_dashboard.test.ts rename to x-pack/plugins/stack_connectors/public/connector_types/openai/use_get_dashboard.test.ts index 255e2aba1b000..8e78c522712bd 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/use_get_dashboard.test.ts +++ b/x-pack/plugins/stack_connectors/public/connector_types/openai/use_get_dashboard.test.ts @@ -123,7 +123,7 @@ describe('useGetDashboard_function', () => { await waitForNextUpdate(); expect(result.current.isLoading).toBe(false); expect(mockToasts.addDanger).toHaveBeenCalledWith({ - title: 'Error finding Generative AI Token Usage Dashboard.', + title: 'Error finding OpenAI Token Usage Dashboard.', text: 'Error fetching dashboard', }); }); diff --git a/x-pack/plugins/stack_connectors/public/connector_types/gen_ai/use_get_dashboard.ts b/x-pack/plugins/stack_connectors/public/connector_types/openai/use_get_dashboard.ts similarity index 100% rename from x-pack/plugins/stack_connectors/public/connector_types/gen_ai/use_get_dashboard.ts rename to x-pack/plugins/stack_connectors/public/connector_types/openai/use_get_dashboard.ts diff --git a/x-pack/plugins/stack_connectors/server/connector_types/bedrock/index.ts b/x-pack/plugins/stack_connectors/server/connector_types/bedrock/index.ts index 661771f6df124..11050628203a9 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/bedrock/index.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/bedrock/index.ts @@ -10,7 +10,7 @@ import { SubActionConnectorType, ValidatorType, } from '@kbn/actions-plugin/server/sub_action_framework/types'; -import { GeneralConnectorFeatureId } from '@kbn/actions-plugin/common'; +import { GenerativeAIConnectorFeatureId } from '@kbn/actions-plugin/common'; import { urlAllowListValidator } from '@kbn/actions-plugin/server'; import { ValidatorServices } from '@kbn/actions-plugin/server/types'; import { assertURL } from '@kbn/actions-plugin/server/sub_action_framework/helpers/validators'; @@ -29,7 +29,7 @@ export const getConnectorType = (): SubActionConnectorType => ( secrets: SecretsSchema, }, validators: [{ type: ValidatorType.CONFIG, validator: configValidator }], - supportedFeatureIds: [GeneralConnectorFeatureId], + supportedFeatureIds: [GenerativeAIConnectorFeatureId], minimumLicenseRequired: 'enterprise' as const, renderParameterTemplates, }); diff --git a/x-pack/plugins/stack_connectors/server/connector_types/index.ts b/x-pack/plugins/stack_connectors/server/connector_types/index.ts index 743f2664ed0b5..0117a9d1a7a2a 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/index.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/index.ts @@ -17,7 +17,7 @@ import { getTinesConnectorType } from './tines'; import { getActionType as getTorqConnectorType } from './torq'; import { getConnectorType as getEmailConnectorType } from './email'; import { getConnectorType as getIndexConnectorType } from './es_index'; -import { getConnectorType as getGenerativeAiConnectorType } from './gen_ai'; +import { getConnectorType as getOpenAIConnectorType } from './openai'; import { getConnectorType as getBedrockConnectorType } from './bedrock'; import { getConnectorType as getPagerDutyConnectorType } from './pagerduty'; import { getConnectorType as getSwimlaneConnectorType } from './swimlane'; @@ -101,7 +101,7 @@ export function registerConnectorTypes({ actions.registerSubActionConnectorType(getOpsgenieConnectorType()); actions.registerSubActionConnectorType(getTinesConnectorType()); - actions.registerSubActionConnectorType(getGenerativeAiConnectorType()); + actions.registerSubActionConnectorType(getOpenAIConnectorType()); actions.registerSubActionConnectorType(getBedrockConnectorType()); actions.registerSubActionConnectorType(getD3SecurityConnectorType()); } diff --git a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/create_dashboard.test.ts b/x-pack/plugins/stack_connectors/server/connector_types/openai/create_dashboard.test.ts similarity index 100% rename from x-pack/plugins/stack_connectors/server/connector_types/gen_ai/create_dashboard.test.ts rename to x-pack/plugins/stack_connectors/server/connector_types/openai/create_dashboard.test.ts diff --git a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/create_dashboard.ts b/x-pack/plugins/stack_connectors/server/connector_types/openai/create_dashboard.ts similarity index 100% rename from x-pack/plugins/stack_connectors/server/connector_types/gen_ai/create_dashboard.ts rename to x-pack/plugins/stack_connectors/server/connector_types/openai/create_dashboard.ts diff --git a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/dashboard.ts b/x-pack/plugins/stack_connectors/server/connector_types/openai/dashboard.ts similarity index 97% rename from x-pack/plugins/stack_connectors/server/connector_types/gen_ai/dashboard.ts rename to x-pack/plugins/stack_connectors/server/connector_types/openai/dashboard.ts index 6470f088577b7..8503ef9bf59fc 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/dashboard.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/openai/dashboard.ts @@ -9,7 +9,7 @@ import { DashboardAttributes } from '@kbn/dashboard-plugin/common'; import { v4 as uuidv4 } from 'uuid'; import { SavedObject } from '@kbn/core-saved-objects-common/src/server_types'; -export const dashboardTitle = `Generative AI Token Usage`; +export const dashboardTitle = `OpenAI Token Usage`; export const getDashboard = (dashboardId: string): SavedObject => { const ids: Record = { @@ -125,7 +125,7 @@ export const getDashboard = (dashboardId: string): SavedObject { @@ -30,12 +30,12 @@ axios.create = jest.fn(() => axios); let connectorType: SubActionConnectorType; let configurationUtilities: jest.Mocked; -describe('Generative AI Connector', () => { +describe('OpenAI Connector', () => { beforeEach(() => { configurationUtilities = actionsConfigMock.create(); connectorType = getConnectorType(); }); - test('exposes the connector as `Generative AI` with id `.gen-ai`', () => { + test('exposes the connector as `OpenAI` with id `.gen-ai`', () => { expect(connectorType.id).toEqual('.gen-ai'); expect(connectorType.name).toEqual('OpenAI'); }); @@ -59,7 +59,7 @@ describe('Generative AI Connector', () => { expect(() => { configValidator(config, { configurationUtilities }); }).toThrowErrorMatchingInlineSnapshot( - '"Error configuring Generative AI action: Error: URL Error: Invalid URL: example.com/do-something"' + '"Error configuring OpenAI action: Error: URL Error: Invalid URL: example.com/do-something"' ); }); @@ -72,7 +72,7 @@ describe('Generative AI Connector', () => { expect(() => { configValidator(config, { configurationUtilities }); }).toThrowErrorMatchingInlineSnapshot( - '"Error configuring Generative AI action: Error: API Provider is not supported"' + '"Error configuring OpenAI action: Error: API Provider is not supported"' ); }); @@ -85,7 +85,7 @@ describe('Generative AI Connector', () => { expect(() => { configValidator(config, { configurationUtilities }); }).toThrowErrorMatchingInlineSnapshot( - '"Error configuring Generative AI action: Error: API Provider is not supported: bad-one"' + '"Error configuring OpenAI action: Error: API Provider is not supported: bad-one"' ); }); @@ -106,7 +106,7 @@ describe('Generative AI Connector', () => { expect(() => { configValidator(config, { configurationUtilities: configUtils }); }).toThrowErrorMatchingInlineSnapshot( - `"Error configuring Generative AI action: Error: error validating url: target url is not present in allowedHosts"` + `"Error configuring OpenAI action: Error: error validating url: target url is not present in allowedHosts"` ); }); }); diff --git a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/index.ts b/x-pack/plugins/stack_connectors/server/connector_types/openai/index.ts similarity index 76% rename from x-pack/plugins/stack_connectors/server/connector_types/gen_ai/index.ts rename to x-pack/plugins/stack_connectors/server/connector_types/openai/index.ts index cc43a05fd346d..fb6a27b17bad5 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/index.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/openai/index.ts @@ -10,30 +10,30 @@ import { SubActionConnectorType, ValidatorType, } from '@kbn/actions-plugin/server/sub_action_framework/types'; -import { GeneralConnectorFeatureId } from '@kbn/actions-plugin/common'; +import { GenerativeAIConnectorFeatureId } from '@kbn/actions-plugin/common'; import { urlAllowListValidator } from '@kbn/actions-plugin/server'; import { ValidatorServices } from '@kbn/actions-plugin/server/types'; import { assertURL } from '@kbn/actions-plugin/server/sub_action_framework/helpers/validators'; import { - GEN_AI_CONNECTOR_ID, - OPEN_AI_TITLE, + OPENAI_CONNECTOR_ID, + OPENAI_TITLE, OpenAiProviderType, -} from '../../../common/gen_ai/constants'; -import { ConfigSchema, SecretsSchema } from '../../../common/gen_ai/schema'; -import { Config, Secrets } from '../../../common/gen_ai/types'; -import { GenAiConnector } from './gen_ai'; +} from '../../../common/openai/constants'; +import { ConfigSchema, SecretsSchema } from '../../../common/openai/schema'; +import { Config, Secrets } from '../../../common/openai/types'; +import { OpenAIConnector } from './openai'; import { renderParameterTemplates } from './render'; export const getConnectorType = (): SubActionConnectorType => ({ - id: GEN_AI_CONNECTOR_ID, - name: OPEN_AI_TITLE, - Service: GenAiConnector, + id: OPENAI_CONNECTOR_ID, + name: OPENAI_TITLE, + Service: OpenAIConnector, schema: { config: ConfigSchema, secrets: SecretsSchema, }, validators: [{ type: ValidatorType.CONFIG, validator: configValidator }], - supportedFeatureIds: [GeneralConnectorFeatureId], + supportedFeatureIds: [GenerativeAIConnectorFeatureId], minimumLicenseRequired: 'enterprise' as const, renderParameterTemplates, }); @@ -57,7 +57,7 @@ export const configValidator = (configObject: Config, validatorServices: Validat } catch (err) { throw new Error( i18n.translate('xpack.stackConnectors.genAi.configurationErrorApiProvider', { - defaultMessage: 'Error configuring Generative AI action: {err}', + defaultMessage: 'Error configuring OpenAI action: {err}', values: { err, }, diff --git a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/azure_openai_utils.test.ts b/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/azure_openai_utils.test.ts similarity index 99% rename from x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/azure_openai_utils.test.ts rename to x-pack/plugins/stack_connectors/server/connector_types/openai/lib/azure_openai_utils.test.ts index 7e064fcd6fc1e..43a9aa83a3f02 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/azure_openai_utils.test.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/azure_openai_utils.test.ts @@ -14,7 +14,7 @@ import { AZURE_OPENAI_CHAT_URL, AZURE_OPENAI_COMPLETIONS_URL, AZURE_OPENAI_COMPLETIONS_EXTENSIONS_URL, -} from '../../../../common/gen_ai/constants'; +} from '../../../../common/openai/constants'; describe('Azure Open AI Utils', () => { const chatUrl = diff --git a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/azure_openai_utils.ts b/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/azure_openai_utils.ts similarity index 97% rename from x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/azure_openai_utils.ts rename to x-pack/plugins/stack_connectors/server/connector_types/openai/lib/azure_openai_utils.ts index f892fdbfff093..f39a574554a57 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/azure_openai_utils.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/azure_openai_utils.ts @@ -9,7 +9,7 @@ import { AZURE_OPENAI_CHAT_URL, AZURE_OPENAI_COMPLETIONS_URL, AZURE_OPENAI_COMPLETIONS_EXTENSIONS_URL, -} from '../../../../common/gen_ai/constants'; +} from '../../../../common/openai/constants'; const APIS_ALLOWING_STREAMING = new Set([ AZURE_OPENAI_CHAT_URL, diff --git a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/openai_utils.test.ts b/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/openai_utils.test.ts similarity index 99% rename from x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/openai_utils.test.ts rename to x-pack/plugins/stack_connectors/server/connector_types/openai/lib/openai_utils.test.ts index 17e9b2365ae9f..656982525cd0e 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/openai_utils.test.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/openai_utils.test.ts @@ -10,7 +10,7 @@ import { DEFAULT_OPENAI_MODEL, OPENAI_CHAT_URL, OPENAI_LEGACY_COMPLETION_URL, -} from '../../../../common/gen_ai/constants'; +} from '../../../../common/openai/constants'; describe('Open AI Utils', () => { describe('sanitizeRequest', () => { diff --git a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/openai_utils.ts b/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/openai_utils.ts similarity index 97% rename from x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/openai_utils.ts rename to x-pack/plugins/stack_connectors/server/connector_types/openai/lib/openai_utils.ts index aacae0d7bc0c6..8bbe8997c7e50 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/openai_utils.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/openai_utils.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { OPENAI_CHAT_URL, OPENAI_LEGACY_COMPLETION_URL } from '../../../../common/gen_ai/constants'; +import { OPENAI_CHAT_URL, OPENAI_LEGACY_COMPLETION_URL } from '../../../../common/openai/constants'; const APIS_ALLOWING_STREAMING = new Set([OPENAI_CHAT_URL, OPENAI_LEGACY_COMPLETION_URL]); diff --git a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/utils.test.ts b/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/utils.test.ts similarity index 99% rename from x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/utils.test.ts rename to x-pack/plugins/stack_connectors/server/connector_types/openai/lib/utils.test.ts index c50b513661ba3..9dffaab3e5e00 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/utils.test.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/utils.test.ts @@ -10,7 +10,7 @@ import { DEFAULT_OPENAI_MODEL, OpenAiProviderType, OPENAI_CHAT_URL, -} from '../../../../common/gen_ai/constants'; +} from '../../../../common/openai/constants'; import { sanitizeRequest as openAiSanitizeRequest, getRequestWithStreamOption as openAiGetRequestWithStreamOption, diff --git a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/utils.ts b/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/utils.ts similarity index 97% rename from x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/utils.ts rename to x-pack/plugins/stack_connectors/server/connector_types/openai/lib/utils.ts index d51f85c7aa514..74cf97e95ac06 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/lib/utils.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/openai/lib/utils.ts @@ -7,7 +7,7 @@ import { AxiosResponse, ResponseType } from 'axios'; import { IncomingMessage } from 'http'; -import { OpenAiProviderType } from '../../../../common/gen_ai/constants'; +import { OpenAiProviderType } from '../../../../common/openai/constants'; import { sanitizeRequest as openAiSanitizeRequest, getRequestWithStreamOption as openAiGetRequestWithStreamOption, diff --git a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/gen_ai.test.ts b/x-pack/plugins/stack_connectors/server/connector_types/openai/openai.test.ts similarity index 97% rename from x-pack/plugins/stack_connectors/server/connector_types/gen_ai/gen_ai.test.ts rename to x-pack/plugins/stack_connectors/server/connector_types/openai/openai.test.ts index 650ff4dd5cdc3..091421435162b 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/gen_ai.test.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/openai/openai.test.ts @@ -5,20 +5,20 @@ * 2.0. */ -import { GenAiConnector } from './gen_ai'; +import { OpenAIConnector } from './openai'; import { actionsConfigMock } from '@kbn/actions-plugin/server/actions_config.mock'; import { DEFAULT_OPENAI_MODEL, - GEN_AI_CONNECTOR_ID, + OPENAI_CONNECTOR_ID, OpenAiProviderType, -} from '../../../common/gen_ai/constants'; +} from '../../../common/openai/constants'; import { loggingSystemMock } from '@kbn/core-logging-server-mocks'; import { actionsMock } from '@kbn/actions-plugin/server/mocks'; -import { RunActionResponseSchema, StreamingResponseSchema } from '../../../common/gen_ai/schema'; +import { RunActionResponseSchema, StreamingResponseSchema } from '../../../common/openai/schema'; import { initDashboard } from './create_dashboard'; jest.mock('./create_dashboard'); -describe('GenAiConnector', () => { +describe('OpenAIConnector', () => { let mockRequest: jest.Mock; let mockError: jest.Mock; const mockResponseString = 'Hello! How can I assist you today?'; @@ -46,9 +46,9 @@ describe('GenAiConnector', () => { }); describe('OpenAI', () => { - const connector = new GenAiConnector({ + const connector = new OpenAIConnector({ configurationUtilities: actionsConfigMock.create(), - connector: { id: '1', type: GEN_AI_CONNECTOR_ID }, + connector: { id: '1', type: OPENAI_CONNECTOR_ID }, config: { apiUrl: 'https://api.openai.com/v1/chat/completions', apiProvider: OpenAiProviderType.OpenAi, @@ -285,9 +285,9 @@ describe('GenAiConnector', () => { }); describe('AzureAI', () => { - const connector = new GenAiConnector({ + const connector = new OpenAIConnector({ configurationUtilities: actionsConfigMock.create(), - connector: { id: '1', type: GEN_AI_CONNECTOR_ID }, + connector: { id: '1', type: OPENAI_CONNECTOR_ID }, config: { apiUrl: 'https://My-test-resource-123.openai.azure.com/openai/deployments/NEW-DEPLOYMENT-321/chat/completions?api-version=2023-05-15', @@ -455,9 +455,9 @@ describe('GenAiConnector', () => { }); describe('Token dashboard', () => { - const connector = new GenAiConnector({ + const connector = new OpenAIConnector({ configurationUtilities: actionsConfigMock.create(), - connector: { id: '1', type: GEN_AI_CONNECTOR_ID }, + connector: { id: '1', type: OPENAI_CONNECTOR_ID }, config: { apiUrl: 'https://example.com/api', apiProvider: OpenAiProviderType.AzureAi }, secrets: { apiKey: '123' }, logger: loggingSystemMock.createLogger(), diff --git a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/gen_ai.ts b/x-pack/plugins/stack_connectors/server/connector_types/openai/openai.ts similarity index 96% rename from x-pack/plugins/stack_connectors/server/connector_types/gen_ai/gen_ai.ts rename to x-pack/plugins/stack_connectors/server/connector_types/openai/openai.ts index 4a0efbe11d472..dec34ac2bb388 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/gen_ai.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/openai/openai.ts @@ -7,7 +7,6 @@ import { ServiceParams, SubActionConnector } from '@kbn/actions-plugin/server'; import type { AxiosError } from 'axios'; -import { initDashboard } from './create_dashboard'; import { RunActionParamsSchema, RunActionResponseSchema, @@ -15,21 +14,22 @@ import { StreamActionParamsSchema, StreamingResponseSchema, InvokeAIActionParamsSchema, -} from '../../../common/gen_ai/schema'; +} from '../../../common/openai/schema'; import type { Config, Secrets, RunActionParams, RunActionResponse, StreamActionParams, -} from '../../../common/gen_ai/types'; -import { SUB_ACTION } from '../../../common/gen_ai/constants'; +} from '../../../common/openai/types'; +import { SUB_ACTION } from '../../../common/openai/constants'; import { DashboardActionParams, DashboardActionResponse, InvokeAIActionParams, InvokeAIActionResponse, -} from '../../../common/gen_ai/types'; +} from '../../../common/openai/types'; +import { initDashboard } from './create_dashboard'; import { getAxiosOptions, getRequestWithStreamOption, @@ -37,7 +37,7 @@ import { sanitizeRequest, } from './lib/utils'; -export class GenAiConnector extends SubActionConnector { +export class OpenAIConnector extends SubActionConnector { private url; private provider; private key; diff --git a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/render.test.ts b/x-pack/plugins/stack_connectors/server/connector_types/openai/render.test.ts similarity index 96% rename from x-pack/plugins/stack_connectors/server/connector_types/gen_ai/render.test.ts rename to x-pack/plugins/stack_connectors/server/connector_types/openai/render.test.ts index 301e096ad35bb..b9fff0362913c 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/render.test.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/openai/render.test.ts @@ -17,7 +17,7 @@ const params = { const variables = { domain: 'm0zepcuuu2' }; -describe('GenAI - renderParameterTemplates', () => { +describe('OpenAI - renderParameterTemplates', () => { it('should not render body on test action', () => { const testParams = { subAction: 'test', subActionParams: { body: 'test_json' } }; const result = renderParameterTemplates(testParams, variables); diff --git a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/render.ts b/x-pack/plugins/stack_connectors/server/connector_types/openai/render.ts similarity index 93% rename from x-pack/plugins/stack_connectors/server/connector_types/gen_ai/render.ts rename to x-pack/plugins/stack_connectors/server/connector_types/openai/render.ts index aae342a5acd8f..bb2f97d7ca0db 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/gen_ai/render.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/openai/render.ts @@ -8,7 +8,7 @@ import { ExecutorParams } from '@kbn/actions-plugin/server/sub_action_framework/types'; import { renderMustacheString } from '@kbn/actions-plugin/server/lib/mustache_renderer'; import { RenderParameterTemplates } from '@kbn/actions-plugin/server/types'; -import { SUB_ACTION } from '../../../common/gen_ai/constants'; +import { SUB_ACTION } from '../../../common/openai/constants'; export const renderParameterTemplates: RenderParameterTemplates = ( params, diff --git a/x-pack/plugins/translations/translations/fr-FR.json b/x-pack/plugins/translations/translations/fr-FR.json index 13adc0fb66fb9..11872fd12e242 100644 --- a/x-pack/plugins/translations/translations/fr-FR.json +++ b/x-pack/plugins/translations/translations/fr-FR.json @@ -7073,7 +7073,6 @@ "xpack.actions.availableConnectorFeatures.cases": "Cas", "xpack.actions.availableConnectorFeatures.compatibility.alertingRules": "Règles d'alerting", "xpack.actions.availableConnectorFeatures.compatibility.cases": "Cas", - "xpack.actions.availableConnectorFeatures.compatibility.general": "Général", "xpack.actions.availableConnectorFeatures.securitySolution": "Solution de sécurité", "xpack.actions.availableConnectorFeatures.uptime": "Uptime", "xpack.actions.builtin.cases.jiraTitle": "Jira", @@ -39763,4 +39762,4 @@ "xpack.painlessLab.walkthroughButtonLabel": "Présentation", "xpack.serverlessObservability.nav.getStarted": "Démarrer" } -} \ No newline at end of file +} diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 65ac82de93183..a48765228124e 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -7089,7 +7089,6 @@ "xpack.actions.availableConnectorFeatures.cases": "ケース", "xpack.actions.availableConnectorFeatures.compatibility.alertingRules": "アラートルール", "xpack.actions.availableConnectorFeatures.compatibility.cases": "ケース", - "xpack.actions.availableConnectorFeatures.compatibility.general": "一般", "xpack.actions.availableConnectorFeatures.securitySolution": "セキュリティソリューション", "xpack.actions.availableConnectorFeatures.uptime": "アップタイム", "xpack.actions.builtin.cases.jiraTitle": "Jira", @@ -39754,4 +39753,4 @@ "xpack.painlessLab.walkthroughButtonLabel": "実地検証", "xpack.serverlessObservability.nav.getStarted": "使ってみる" } -} \ No newline at end of file +} diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 71efc0fb21069..e2019067a5ea9 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -7088,7 +7088,6 @@ "xpack.actions.availableConnectorFeatures.cases": "案例", "xpack.actions.availableConnectorFeatures.compatibility.alertingRules": "告警规则", "xpack.actions.availableConnectorFeatures.compatibility.cases": "案例", - "xpack.actions.availableConnectorFeatures.compatibility.general": "常规", "xpack.actions.availableConnectorFeatures.securitySolution": "安全解决方案", "xpack.actions.availableConnectorFeatures.uptime": "运行时间", "xpack.actions.builtin.cases.jiraTitle": "Jira", @@ -39748,4 +39747,4 @@ "xpack.painlessLab.walkthroughButtonLabel": "指导", "xpack.serverlessObservability.nav.getStarted": "开始使用" } -} \ No newline at end of file +} diff --git a/x-pack/test/alerting_api_integration/common/plugins/actions_simulators/server/gen_ai_simulation.ts b/x-pack/test/alerting_api_integration/common/plugins/actions_simulators/server/openai_simulation.ts similarity index 91% rename from x-pack/test/alerting_api_integration/common/plugins/actions_simulators/server/gen_ai_simulation.ts rename to x-pack/test/alerting_api_integration/common/plugins/actions_simulators/server/openai_simulation.ts index b10c5b6aa5f7c..3ab2c3b0dd54e 100644 --- a/x-pack/test/alerting_api_integration/common/plugins/actions_simulators/server/gen_ai_simulation.ts +++ b/x-pack/test/alerting_api_integration/common/plugins/actions_simulators/server/openai_simulation.ts @@ -9,7 +9,7 @@ import http from 'http'; import { ProxyArgs, Simulator } from './simulator'; -export class GenAiSimulator extends Simulator { +export class OpenAISimulator extends Simulator { private readonly returnError: boolean; constructor({ returnError = false, proxy }: { returnError?: boolean; proxy?: ProxyArgs }) { @@ -24,10 +24,10 @@ export class GenAiSimulator extends Simulator { data: Record ) { if (this.returnError) { - return GenAiSimulator.sendErrorResponse(response); + return OpenAISimulator.sendErrorResponse(response); } - return GenAiSimulator.sendResponse(response); + return OpenAISimulator.sendResponse(response); } private static sendResponse(response: http.ServerResponse) { diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/gen_ai.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/openai.ts similarity index 96% rename from x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/gen_ai.ts rename to x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/openai.ts index 5cfe992171dac..c4f8d1078002c 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/gen_ai.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/openai.ts @@ -8,9 +8,9 @@ import expect from '@kbn/expect'; import { - GenAiSimulator, + OpenAISimulator, genAiSuccessResponse, -} from '@kbn/actions-simulators-plugin/server/gen_ai_simulation'; +} from '@kbn/actions-simulators-plugin/server/openai_simulation'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; import { getUrlPrefix, ObjectRemover } from '../../../../../common/lib'; @@ -51,7 +51,7 @@ export default function genAiTest({ getService }: FtrProviderContext) { objectRemover.removeAll(); }); describe('action creation', () => { - const simulator = new GenAiSimulator({ + const simulator = new OpenAISimulator({ returnError: false, proxy: { config: configService.get('kbnTestServer.serverArgs'), @@ -189,7 +189,7 @@ export default function genAiTest({ getService }: FtrProviderContext) { statusCode: 400, error: 'Bad Request', message: - 'error validating action type config: Error configuring Generative AI action: Error: error validating url: target url "http://genAi.mynonexistent.com" is not added to the Kibana config xpack.actions.allowedHosts', + 'error validating action type config: Error configuring OpenAI action: Error: error validating url: target url "http://genAi.mynonexistent.com" is not added to the Kibana config xpack.actions.allowedHosts', }); }); }); @@ -217,7 +217,7 @@ export default function genAiTest({ getService }: FtrProviderContext) { describe('executor', () => { describe('validation', () => { - const simulator = new GenAiSimulator({ + const simulator = new OpenAISimulator({ proxy: { config: configService.get('kbnTestServer.serverArgs'), }, @@ -272,7 +272,7 @@ export default function genAiTest({ getService }: FtrProviderContext) { describe('execution', () => { describe('successful response simulator', () => { - const simulator = new GenAiSimulator({ + const simulator = new OpenAISimulator({ proxy: { config: configService.get('kbnTestServer.serverArgs'), }, @@ -313,7 +313,7 @@ export default function genAiTest({ getService }: FtrProviderContext) { data: genAiSuccessResponse, }); }); - describe('gen ai dashboard', () => { + describe('OpenAI dashboard', () => { const dashboardId = 'specific-dashboard-id-default'; it('should not create a dashboard when user does not have kibana event log permissions', async () => { @@ -377,7 +377,7 @@ export default function genAiTest({ getService }: FtrProviderContext) { }); }); describe('non-default space simulator', () => { - const simulator = new GenAiSimulator({ + const simulator = new OpenAISimulator({ proxy: { config: configService.get('kbnTestServer.serverArgs'), }, @@ -428,7 +428,7 @@ export default function genAiTest({ getService }: FtrProviderContext) { }); describe('error response simulator', () => { - const simulator = new GenAiSimulator({ + const simulator = new OpenAISimulator({ returnError: true, proxy: { config: configService.get('kbnTestServer.serverArgs'), diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/index.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/index.ts index fd667f8f1025a..e9fc2cbeb7c00 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/index.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/index.ts @@ -39,7 +39,7 @@ export default function connectorsTests({ loadTestFile, getService }: FtrProvide loadTestFile(require.resolve('./connector_types/xmatters')); loadTestFile(require.resolve('./connector_types/tines')); loadTestFile(require.resolve('./connector_types/torq')); - loadTestFile(require.resolve('./connector_types/gen_ai')); + loadTestFile(require.resolve('./connector_types/openai')); loadTestFile(require.resolve('./connector_types/d3security')); loadTestFile(require.resolve('./connector_types/bedrock')); loadTestFile(require.resolve('./create')); diff --git a/x-pack/test/screenshot_creation/apps/response_ops_docs/stack_connectors/generative_ai_connector.ts b/x-pack/test/screenshot_creation/apps/response_ops_docs/stack_connectors/generative_ai_connector.ts index 69fa2448a7818..4dc7d6d3fa26e 100644 --- a/x-pack/test/screenshot_creation/apps/response_ops_docs/stack_connectors/generative_ai_connector.ts +++ b/x-pack/test/screenshot_creation/apps/response_ops_docs/stack_connectors/generative_ai_connector.ts @@ -21,13 +21,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { `"content": "You are a cyber security analyst using Elastic Security. I would like you to evaluate the event below and format your output neatly in markdown syntax. Add your description, an accuracy rating, and a threat rating."\n` + `}]`; - describe('generative ai connector', function () { + describe('OpenAI connector', function () { beforeEach(async () => { await pageObjects.common.navigateToApp('connectors'); await pageObjects.header.waitUntilLoadingHasFinished(); }); - it('generative ai connector screenshots', async () => { + it('OpenAI connector screenshots', async () => { await pageObjects.common.navigateToApp('connectors'); await pageObjects.header.waitUntilLoadingHasFinished(); await actions.common.openNewConnectorForm('gen-ai'); diff --git a/x-pack/test/screenshot_creation/apps/response_ops_docs/stack_connectors/xmatters_connector.ts b/x-pack/test/screenshot_creation/apps/response_ops_docs/stack_connectors/xmatters_connector.ts index 80aafd27dc63b..709d9bdfae76e 100644 --- a/x-pack/test/screenshot_creation/apps/response_ops_docs/stack_connectors/xmatters_connector.ts +++ b/x-pack/test/screenshot_creation/apps/response_ops_docs/stack_connectors/xmatters_connector.ts @@ -20,7 +20,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { await pageObjects.header.waitUntilLoadingHasFinished(); }); - it('generative ai connector screenshots', async () => { + it('xmatters connector screenshots', async () => { await pageObjects.common.navigateToApp('connectors'); await pageObjects.header.waitUntilLoadingHasFinished(); await actions.common.openNewConnectorForm('xmatters');