diff --git a/src/plugins/home/public/application/components/tutorial/instruction_set.js b/src/plugins/home/public/application/components/tutorial/instruction_set.js index ada9b63b06b9d..250e42c1988db 100644 --- a/src/plugins/home/public/application/components/tutorial/instruction_set.js +++ b/src/plugins/home/public/application/components/tutorial/instruction_set.js @@ -299,6 +299,7 @@ const statusCheckConfigShape = PropTypes.shape({ title: PropTypes.string, text: PropTypes.string, btnLabel: PropTypes.string, + customStatusCheck: PropTypes.string, }); InstructionSetUi.propTypes = { diff --git a/src/plugins/home/public/application/components/tutorial/tutorial.js b/src/plugins/home/public/application/components/tutorial/tutorial.js index 81a75d8881e2d..bb8c92fb4f80c 100644 --- a/src/plugins/home/public/application/components/tutorial/tutorial.js +++ b/src/plugins/home/public/application/components/tutorial/tutorial.js @@ -171,17 +171,31 @@ class TutorialUi extends React.Component { checkInstructionSetStatus = async (instructionSetIndex) => { const instructionSet = this.getInstructionSets()[instructionSetIndex]; const esHitsCheckConfig = _.get(instructionSet, `statusCheck.esHitsCheck`); + const customStatusCheck = _.get(instructionSet, `statusCheck.customStatusCheck`); - if (esHitsCheckConfig) { - const statusCheckState = await this.fetchEsHitsStatus(esHitsCheckConfig); + const [esHitsStatusCheck, apmFleetStatusCheck] = await Promise.all([ + ...(esHitsCheckConfig ? [this.fetchEsHitsStatus(esHitsCheckConfig)] : []), + ...(customStatusCheck === 'apm-fleet-check' ? [this.fetchApmFleetStatus()] : []), + ]); - this.setState((prevState) => ({ - statusCheckStates: { - ...prevState.statusCheckStates, - [instructionSetIndex]: statusCheckState, - }, - })); - } + const nextStatusCheckState = + esHitsStatusCheck === StatusCheckStates.HAS_DATA || + apmFleetStatusCheck === StatusCheckStates.HAS_DATA + ? StatusCheckStates.HAS_DATA + : StatusCheckStates.NO_DATA; + + this.setState((prevState) => ({ + statusCheckStates: { + ...prevState.statusCheckStates, + [instructionSetIndex]: nextStatusCheckState, + }, + })); + }; + + fetchApmFleetStatus = async () => { + const { http } = getServices(); + const response = await http.get('/api/apm/fleet/has_data'); + return response?.hasData === true ? StatusCheckStates.HAS_DATA : StatusCheckStates.NO_DATA; }; /** diff --git a/src/plugins/home/server/services/tutorials/lib/tutorial_schema.ts b/src/plugins/home/server/services/tutorials/lib/tutorial_schema.ts index 89c5c78e82490..63ee2e85cb2b4 100644 --- a/src/plugins/home/server/services/tutorials/lib/tutorial_schema.ts +++ b/src/plugins/home/server/services/tutorials/lib/tutorial_schema.ts @@ -49,6 +49,7 @@ const statusCheckSchema = schema.object({ index: schema.oneOf([schema.string(), schema.arrayOf(schema.string())]), query: schema.recordOf(schema.string(), schema.any()), }), + customStatusCheck: schema.maybe(schema.string()), }); const instructionSchema = schema.object({ diff --git a/x-pack/plugins/apm/server/tutorial/envs/on_prem.ts b/x-pack/plugins/apm/server/tutorial/envs/on_prem.ts index 3b1367e64bd06..700126f1b5e8b 100644 --- a/x-pack/plugins/apm/server/tutorial/envs/on_prem.ts +++ b/x-pack/plugins/apm/server/tutorial/envs/on_prem.ts @@ -135,6 +135,7 @@ export function onPremInstructions({ 'No APM Server detected. Please make sure it is running and you have updated to 7.0 or higher.', } ), + customStatusCheck: 'apm-fleet-check', esHitsCheck: { index: onboardingIndices, query: {