diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/ml_inference_logic.test.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/ml_inference_logic.test.ts index a4562d66349cc..330884868acf2 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/ml_inference_logic.test.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/ml_inference_logic.test.ts @@ -16,6 +16,7 @@ import { TrainedModelState } from '../../../../../../../common/types/pipelines'; import { GetDocumentsApiLogic } from '../../../../api/documents/get_document_logic'; import { MappingsApiLogic } from '../../../../api/mappings/mappings_logic'; import { MLModelsApiLogic } from '../../../../api/ml_models/ml_models_logic'; +import { StartTextExpansionModelApiLogic } from '../../../../api/ml_models/text_expansion/start_text_expansion_model_api_logic'; import { AttachMlInferencePipelineApiLogic } from '../../../../api/pipelines/attach_ml_inference_pipeline'; import { CreateMlInferencePipelineApiLogic } from '../../../../api/pipelines/create_ml_inference_pipeline'; import { FetchMlInferencePipelineProcessorsApiLogic } from '../../../../api/pipelines/fetch_ml_inference_pipeline_processors'; @@ -85,6 +86,7 @@ describe('MlInferenceLogic', () => { FetchMlInferencePipelinesApiLogic ); const { mount: mountGetDocumentsApiLogic } = new LogicMounter(GetDocumentsApiLogic); + const { mount: mountStartTextExpansionModel } = new LogicMounter(StartTextExpansionModelApiLogic); beforeEach(() => { jest.clearAllMocks(); @@ -97,6 +99,7 @@ describe('MlInferenceLogic', () => { mountCreateMlInferencePipelineApiLogic(); mountAttachMlInferencePipelineApiLogic(); mountGetDocumentsApiLogic(); + mountStartTextExpansionModel(); mount(); }); @@ -628,5 +631,16 @@ describe('MlInferenceLogic', () => { }); }); }); + describe('startTextExpansionModelSuccess', () => { + it('fetches ml models', () => { + jest.spyOn(MLInferenceLogic.actions, 'makeMLModelsRequest'); + StartTextExpansionModelApiLogic.actions.apiSuccess({ + deploymentState: 'started', + modelId: 'foo', + }); + + expect(MLInferenceLogic.actions.makeMLModelsRequest).toHaveBeenCalledWith(undefined); + }); + }); }); }); diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/ml_inference_logic.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/ml_inference_logic.ts index 2cc9a7eabea35..18b0cb8ab8328 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/ml_inference_logic.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/search_index/pipelines/ml_inference/ml_inference_logic.ts @@ -39,6 +39,10 @@ import { TrainedModelsApiLogicActions, TrainedModelsApiLogic, } from '../../../../api/ml_models/ml_trained_models_logic'; +import { + StartTextExpansionModelApiLogic, + StartTextExpansionModelApiLogicActions, +} from '../../../../api/ml_models/text_expansion/start_text_expansion_model_api_logic'; import { AttachMlInferencePipelineApiLogic, AttachMlInferencePipelineApiLogicArgs, @@ -156,6 +160,7 @@ interface MLInferenceProcessorsActions { setInferencePipelineConfiguration: (configuration: InferencePipelineConfiguration) => { configuration: InferencePipelineConfiguration; }; + startTextExpansionModelSuccess: StartTextExpansionModelApiLogicActions['apiSuccess']; } export interface AddInferencePipelineModal { @@ -230,6 +235,8 @@ export const MLInferenceLogic = kea< ], PipelinesLogic, ['closeAddMlInferencePipelineModal as closeAddMlInferencePipelineModal'], + StartTextExpansionModelApiLogic, + ['apiSuccess as startTextExpansionModelSuccess'], ], values: [ CachedFetchIndexApiLogic, @@ -316,6 +323,10 @@ export const MLInferenceLogic = kea< }); } }, + startTextExpansionModelSuccess: () => { + // Refresh ML models list when the text expansion model is started + actions.makeMLModelsRequest(undefined); + }, }), path: ['enterprise_search', 'content', 'pipelines_add_ml_inference_pipeline'], reducers: { diff --git a/x-pack/plugins/observability/public/hooks/slo/use_fetch_slo_list.ts b/x-pack/plugins/observability/public/hooks/slo/use_fetch_slo_list.ts index 990b303ea0342..3af46cb7b1c25 100644 --- a/x-pack/plugins/observability/public/hooks/slo/use_fetch_slo_list.ts +++ b/x-pack/plugins/observability/public/hooks/slo/use_fetch_slo_list.ts @@ -13,6 +13,7 @@ import { useQuery, useQueryClient, } from '@tanstack/react-query'; +import { i18n } from '@kbn/i18n'; import { FindSLOResponse } from '@kbn/slo-schema'; import { useKibana } from '../../utils/kibana_react'; @@ -47,10 +48,15 @@ export function useFetchSloList({ indicatorTypes = [], shouldRefetch, }: SLOListParams | undefined = {}): UseFetchSloListResponse { - const { http } = useKibana().services; + const { + http, + notifications: { toasts }, + } = useKibana().services; const queryClient = useQueryClient(); - const [stateRefetchInterval, setStateRefetchInterval] = useState(SHORT_REFETCH_INTERVAL); + const [stateRefetchInterval, setStateRefetchInterval] = useState( + SHORT_REFETCH_INTERVAL + ); const { isInitialLoading, isLoading, isError, isSuccess, isRefetching, data, refetch } = useQuery( { @@ -72,13 +78,19 @@ export function useFetchSloList({ return response; } catch (error) { - // ignore error + throw error; } }, keepPreviousData: true, refetchOnWindowFocus: false, refetchInterval: shouldRefetch ? stateRefetchInterval : undefined, staleTime: 1000, + retry: (failureCount, error) => { + if (String(error) === 'Error: Forbidden') { + return false; + } + return failureCount < 4; + }, onSuccess: ({ results }: FindSLOResponse) => { if (!shouldRefetch) { return; @@ -102,6 +114,13 @@ export function useFetchSloList({ exact: false, }); }, + onError: (error: Error) => { + toasts.addError(error, { + title: i18n.translate('xpack.observability.slo.list.errorNotification', { + defaultMessage: 'Something went wrong while fetching SLOs', + }), + }); + }, } ); diff --git a/x-pack/plugins/observability/public/pages/slos/slos.tsx b/x-pack/plugins/observability/public/pages/slos/slos.tsx index 9b7df97e1e13c..6fe200b40523b 100644 --- a/x-pack/plugins/observability/public/pages/slos/slos.tsx +++ b/x-pack/plugins/observability/public/pages/slos/slos.tsx @@ -31,7 +31,7 @@ export function SlosPage() { const { hasWriteCapabilities } = useCapabilities(); const { hasAtLeast } = useLicense(); - const { isInitialLoading, isLoading, sloList } = useFetchSloList(); + const { isInitialLoading, isLoading, isError, sloList } = useFetchSloList(); const { total } = sloList || {}; @@ -46,6 +46,12 @@ export function SlosPage() { }, ]); + useEffect(() => { + if ((!isLoading && total === 0) || hasAtLeast('platinum') === false || isError) { + navigateToUrl(basePath.prepend(paths.observability.slosWelcome)); + } + }, [basePath, hasAtLeast, isError, isLoading, navigateToUrl, total]); + const handleClickCreateSlo = () => { navigateToUrl(basePath.prepend(paths.observability.sloCreate)); }; @@ -54,12 +60,6 @@ export function SlosPage() { setIsAutoRefreshing(!isAutoRefreshing); }; - useEffect(() => { - if ((!isLoading && total === 0) || hasAtLeast('platinum') === false) { - navigateToUrl(basePath.prepend(paths.observability.slosWelcome)); - } - }, [basePath, hasAtLeast, isLoading, navigateToUrl, total]); - if (isInitialLoading) { return null; } diff --git a/x-pack/plugins/profiling/public/components/no_data_page.tsx b/x-pack/plugins/profiling/public/components/no_data_page.tsx index 6659a6370c867..b01444bd3ce1d 100644 --- a/x-pack/plugins/profiling/public/components/no_data_page.tsx +++ b/x-pack/plugins/profiling/public/components/no_data_page.tsx @@ -39,6 +39,7 @@ export function NoDataPage({ subTitle }: { subTitle: string }) { const secretToken = data?.variables.secretToken; const collectionAgentHostPort = data?.variables.apmServerUrl.replace('https://', ''); + const hostAgentVersion = 'v3'; const tabs = [ { @@ -66,7 +67,7 @@ export function NoDataPage({ subTitle }: { subTitle: string }) { {`helm install --create-namespace -n=universal-profiling universal-profiling-agent \\ --set "projectID=1,secretToken=${secretToken}" \\ --set "collectionAgentHostPort=${collectionAgentHostPort}" \\ ---set "image.baseUrl=docker.elastic.co,image.repository=observability,image.name=profiling-agent" \\ +--set "version=${hostAgentVersion}" \\ optimyze/pf-host-agent`} ), @@ -104,7 +105,7 @@ optimyze/pf-host-agent`} {`docker run --name host-agent --privileged --pid=host -v /etc/machine-id:/etc/machine-id:ro \\ -v /var/run/docker.sock:/var/run/docker.sock -v /sys/kernel/debug:/sys/kernel/debug:ro \\ -docker.elastic.co/observability/profiling-agent:stable /root/pf-host-agent \\ +docker.elastic.co/observability/profiling-agent:${hostAgentVersion} /root/pf-host-agent \\ -project-id=1 -secret-token=${secretToken} \\ -collection-agent=${collectionAgentHostPort}`} @@ -124,8 +125,7 @@ docker.elastic.co/observability/profiling-agent:stable /root/pf-host-agent \\ }), content: ( - wget -O pf-host-agent.tgz "https://ela.st/pf-host-agent-amd64" && tar xzf - pf-host-agent.tgz + {`wget -O pf-host-agent.tgz "https://ela.st/pf-host-agent-amd64-${hostAgentVersion}" && tar xzf pf-host-agent.tgz`} ), }, @@ -163,8 +163,11 @@ docker.elastic.co/observability/profiling-agent:stable /root/pf-host-agent \\ 'Open the URL below and download the right DEB package for your CPU architecture:', }), content: ( - - https://ela.st/pf-host-agent-linux + + {`https://ela.st/pf-host-agent-linux-${hostAgentVersion}`} ), }, @@ -213,8 +216,11 @@ docker.elastic.co/observability/profiling-agent:stable /root/pf-host-agent \\ 'Open the URL below and download the right RPM package for your CPU architecture:', }), content: ( - - https://ela.st/pf-host-agent-linux + + {`https://ela.st/pf-host-agent-linux-${hostAgentVersion}`} ), }, @@ -284,11 +290,17 @@ docker.elastic.co/observability/profiling-agent:stable /root/pf-host-agent \\ }, { title: i18n.translate('xpack.profiling.tabs.symbols.step3', { - defaultMessage: 'Run:', + defaultMessage: + 'Fetch the symbols endpoint from the Cloud console, navigating in the Integrations Server section', + }), + }, + { + title: i18n.translate('xpack.profiling.tabs.symbols.step4', { + defaultMessage: 'Run the following command, replacing the placeholders between <>:', }), content: ( - {`./symbtool push-symbols executable --url --api-key {} --help`} + {`./symbtool push-symbols executable --url --api-key --help`} ), },