[APM] Add setup instructions for PHP agent (#91381)

Co-authored-by: Sergey Kleyman <sergey.kleyman@elastic.co>
Co-authored-by: Sergey Kleyman <SergeyKleyman@users.noreply.github.com>
This commit is contained in:
Dario Gieselaar 2021-02-16 17:11:54 +01:00 committed by GitHub
parent a59f49e506
commit 9ae8ba8964
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 64 additions and 0 deletions

View file

@ -47,4 +47,5 @@ export {
createGoAgentInstructions,
createJavaAgentInstructions,
createDotNetAgentInstructions,
createPhpAgentInstructions,
} from './tutorial/instructions/apm_agent_instructions';

View file

@ -27,6 +27,7 @@ import {
createGoAgentInstructions,
createJavaAgentInstructions,
createDotNetAgentInstructions,
createPhpAgentInstructions,
} from '../instructions/apm_agent_instructions';
export function onPremInstructions({
@ -152,6 +153,10 @@ export function onPremInstructions({
id: INSTRUCTION_VARIANT.DOTNET,
instructions: createDotNetAgentInstructions(),
},
{
id: INSTRUCTION_VARIANT.PHP,
instructions: createPhpAgentInstructions(),
},
],
statusCheck: {
title: i18n.translate('apmOss.tutorial.apmAgents.statusCheck.title', {

View file

@ -701,3 +701,54 @@ export const createDotNetAgentInstructions = (apmServerUrl = '', secretToken = '
}),
},
];
export const createPhpAgentInstructions = (apmServerUrl = '', secretToken = '') => [
{
title: i18n.translate('apmOss.tutorial.phpClient.download.title', {
defaultMessage: 'Download the APM agent',
}),
textPre: i18n.translate('apmOss.tutorial.phpClient.download.textPre', {
defaultMessage:
'Download the package corresponding to your platform from [GitHub releases]({githubReleasesLink}).',
values: {
githubReleasesLink: 'https://github.com/elastic/apm-agent-php/releases',
},
}),
},
{
title: i18n.translate('apmOss.tutorial.phpClient.installPackage.title', {
defaultMessage: 'Install the downloaded package',
}),
textPre: i18n.translate('apmOss.tutorial.phpClient.installPackage.textPre', {
defaultMessage: 'For example on Alpine Linux using APK package:',
}),
commands: ['apk add --allow-untrusted <package-file>.apk'],
textPost: i18n.translate('apmOss.tutorial.phpClient.installPackage.textPost', {
defaultMessage:
'See the [documentation]({documentationLink}) for installation commands on other supported platforms and advanced installation.',
values: {
documentationLink: '{config.docs.base_url}guide/en/apm/agent/php/current/setup.html',
},
}),
},
{
title: i18n.translate('apmOss.tutorial.phpClient.configureAgent.title', {
defaultMessage: 'Configure the agent',
}),
textPre: i18n.translate('apmOss.tutorial.phpClient.configureAgent.textPre', {
defaultMessage:
'APM is automatically started when your app boots. Configure the agent either via `php.ini` file:',
}),
commands: `elastic_apm.server_url=http://localhost:8200
elastic_apm.service_name="My service"
`.split('\n'),
textPost: i18n.translate('apmOss.tutorial.phpClient.configure.textPost', {
defaultMessage:
'See the [documentation]({documentationLink}) for configuration options and advanced usage.\n\n',
values: {
documentationLink:
'{config.docs.base_url}guide/en/apm/agent/php/current/configuration.html',
},
}),
},
];

View file

@ -23,6 +23,7 @@ export const INSTRUCTION_VARIANT = {
JAVA: 'java',
DOTNET: 'dotnet',
LINUX: 'linux',
PHP: 'php',
};
const DISPLAY_MAP = {
@ -42,6 +43,7 @@ const DISPLAY_MAP = {
[INSTRUCTION_VARIANT.JAVA]: 'Java',
[INSTRUCTION_VARIANT.DOTNET]: '.NET',
[INSTRUCTION_VARIANT.LINUX]: 'Linux',
[INSTRUCTION_VARIANT.PHP]: 'PHP',
};
/**

View file

@ -18,6 +18,7 @@ import {
createGoAgentInstructions,
createJavaAgentInstructions,
createDotNetAgentInstructions,
createPhpAgentInstructions,
} from '../../../../../src/plugins/apm_oss/server';
import { CloudSetup } from '../../../cloud/server';
@ -105,6 +106,10 @@ function getApmAgentInstructionSet(cloudSetup?: CloudSetup) {
id: INSTRUCTION_VARIANT.DOTNET,
instructions: createDotNetAgentInstructions(apmServerUrl, secretToken),
},
{
id: INSTRUCTION_VARIANT.PHP,
instructions: createPhpAgentInstructions(apmServerUrl, secretToken),
},
],
};
}