Skip to content

Commit

Permalink
adding fleet section
Browse files Browse the repository at this point in the history
  • Loading branch information
cauemarcondes committed May 27, 2021
1 parent 92d34b1 commit 3f484a7
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/plugins/home/common/instruction_variant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const INSTRUCTION_VARIANT = {
DOTNET: 'dotnet',
LINUX: 'linux',
PHP: 'php',
FLEET: 'fleet',
};

const DISPLAY_MAP = {
Expand All @@ -44,6 +45,7 @@ const DISPLAY_MAP = {
[INSTRUCTION_VARIANT.DOTNET]: '.NET',
[INSTRUCTION_VARIANT.LINUX]: 'Linux',
[INSTRUCTION_VARIANT.PHP]: 'PHP',
[INSTRUCTION_VARIANT.FLEET]: 'Elastic APM (beta) in Fleet',
};

/**
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/home/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ export const plugin = (initContext: PluginInitializerContext) => new HomeServerP

export { INSTRUCTION_VARIANT } from '../common/instruction_variant';
export { TutorialsCategory } from './services/tutorials';
export type { ArtifactsSchema } from './services/tutorials';
export type { ArtifactsSchema, TutorialSchema, InstructionSetSchema } from './services/tutorials';
2 changes: 1 addition & 1 deletion x-pack/plugins/apm/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ export class APMPlugin
kibanaVersion: this.initContext.env.packageInfo.version,
});
}

plugins.home?.tutorials.registerTutorial(
tutorialProvider({
isEnabled: this.currentConfig['xpack.apm.ui.enabled'],
Expand All @@ -114,6 +113,7 @@ export class APMPlugin
sourcemapIndices: this.currentConfig['apm_oss.sourcemapIndices'],
transactionIndices: this.currentConfig['apm_oss.transactionIndices'],
},
basePath: core.http.basePath,
})
);

Expand Down
18 changes: 14 additions & 4 deletions x-pack/plugins/apm/server/tutorial/envs/elastic_cloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
*/

import { i18n } from '@kbn/i18n';
import { INSTRUCTION_VARIANT } from '../../../../../../src/plugins/home/server';
import {
INSTRUCTION_VARIANT,
TutorialSchema,
InstructionSetSchema,
} from '../../../../../../src/plugins/home/server';

import {
createNodeAgentInstructions,
Expand All @@ -22,7 +26,9 @@ import {
} from '../instructions/apm_agent_instructions';
import { CloudSetup } from '../../../../cloud/server';

export function createElasticCloudInstructions(cloudSetup?: CloudSetup) {
export function createElasticCloudInstructions(
cloudSetup?: CloudSetup
): TutorialSchema['elasticCloud'] {
const apmServerUrl = cloudSetup?.apm.url;
const instructionSets = [];

Expand All @@ -37,7 +43,9 @@ export function createElasticCloudInstructions(cloudSetup?: CloudSetup) {
};
}

function getApmServerInstructionSet(cloudSetup?: CloudSetup) {
function getApmServerInstructionSet(
cloudSetup?: CloudSetup
): InstructionSetSchema {
const cloudId = cloudSetup?.cloudId;
return {
title: i18n.translate('xpack.apm.tutorial.apmServer.title', {
Expand All @@ -61,7 +69,9 @@ function getApmServerInstructionSet(cloudSetup?: CloudSetup) {
};
}

function getApmAgentInstructionSet(cloudSetup?: CloudSetup) {
function getApmAgentInstructionSet(
cloudSetup?: CloudSetup
): InstructionSetSchema {
const apmServerUrl = cloudSetup?.apm.url;
const secretToken = cloudSetup?.apm.secretToken;

Expand Down
37 changes: 35 additions & 2 deletions x-pack/plugins/apm/server/tutorial/envs/on_prem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
*/

import { i18n } from '@kbn/i18n';
import { INSTRUCTION_VARIANT } from '../../../../../../src/plugins/home/server';
import { IBasePath } from 'kibana/server';
import url from 'url';
import {
INSTRUCTION_VARIANT,
TutorialSchema,
} from '../../../../../../src/plugins/home/server';
import {
createWindowsServerInstructions,
createEditConfig,
Expand Down Expand Up @@ -35,13 +40,15 @@ export function onPremInstructions({
metricsIndices,
sourcemapIndices,
onboardingIndices,
basePath,
}: {
errorIndices: string;
transactionIndices: string;
metricsIndices: string;
sourcemapIndices: string;
onboardingIndices: string;
}) {
basePath: IBasePath;
}): TutorialSchema['onPrem'] {
const EDIT_CONFIG = createEditConfig();
const START_SERVER_UNIX = createStartServerUnix();
const START_SERVER_UNIX_SYSV = createStartServerUnixSysv();
Expand All @@ -66,6 +73,32 @@ export function onPremInstructions({
iconType: 'alert',
},
instructionVariants: [
{
id: INSTRUCTION_VARIANT.FLEET,
instructions: [
{
title: i18n.translate(
'xpack.apm.tutorial.apmServer.fleet.title',
{
defaultMessage:
'Elastic APM (beta) now available in Fleet!',
}
),
textPre: i18n.translate(
'xpack.apm.tutorial.apmServer.fleet.message',
{
defaultMessage:
'The [APM integration]({apmIntegrationTest}) installs Elasticsearch templates and Ingest Node pipelines for APM data.',
values: {
apmIntegrationTest: `${url.format(
basePath.prepend('/app/fleet#/policies')
)}`,
},
}
),
},
],
},
{
id: INSTRUCTION_VARIANT.OSX,
instructions: [
Expand Down
8 changes: 6 additions & 2 deletions x-pack/plugins/apm/server/tutorial/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
*/

import { i18n } from '@kbn/i18n';
import { IBasePath } from 'kibana/server';
import { onPremInstructions } from './envs/on_prem';
import { createElasticCloudInstructions } from './envs/elastic_cloud';
import apmIndexPattern from './index_pattern.json';
import { CloudSetup } from '../../../cloud/server';
import {
ArtifactsSchema,
TutorialsCategory,
TutorialSchema,
} from '../../../../../src/plugins/home/server';
import { APM_STATIC_INDEX_PATTERN_ID } from '../../common/index_pattern_constants';

Expand All @@ -27,6 +29,7 @@ export const tutorialProvider = ({
indexPatternTitle,
indices,
cloud,
basePath,
}: {
isEnabled: boolean;
indexPatternTitle: string;
Expand All @@ -38,6 +41,7 @@ export const tutorialProvider = ({
sourcemapIndices: string;
onboardingIndices: string;
};
basePath: IBasePath;
}) => () => {
const savedObjects = [
{
Expand Down Expand Up @@ -102,7 +106,7 @@ It allows you to monitor the performance of thousands of applications in real ti
),
euiIconType: 'apmApp',
artifacts,
onPrem: onPremInstructions(indices),
onPrem: onPremInstructions({ ...indices, basePath }),
elasticCloud: createElasticCloudInstructions(cloud),
previewImagePath: '/plugins/apm/assets/apm.png',
savedObjects,
Expand All @@ -113,5 +117,5 @@ It allows you to monitor the performance of thousands of applications in real ti
'An APM index pattern is required for some features in the APM UI.',
}
),
};
} as TutorialSchema;
};

0 comments on commit 3f484a7

Please sign in to comment.