diff --git a/src/core_plugins/kibana/server/tutorials/apm/apm_client_instructions.js b/src/core_plugins/kibana/server/tutorials/apm/apm_client_instructions.js index 183cf26a6679e..138bebdc57998 100644 --- a/src/core_plugins/kibana/server/tutorials/apm/apm_client_instructions.js +++ b/src/core_plugins/kibana/server/tutorials/apm/apm_client_instructions.js @@ -17,123 +17,198 @@ * under the License. */ -/* eslint-disable max-len */ +import { i18n } from '@kbn/i18n'; export const createNodeClientInstructions = () => [ { - title: 'Install the APM agent', - textPre: 'Install the APM agent for Node.js as a dependency to your application.', + title: i18n.translate('kbn.server.tutorials.apm.nodeClient.install.title', { + defaultMessage: 'Install the APM agent', + }), + textPre: i18n.translate('kbn.server.tutorials.apm.nodeClient.install.textPre', { + defaultMessage: 'Install the APM agent for Node.js as a dependency to your application.', + }), commands: ['npm install elastic-apm-node --save'], }, { - title: 'Configure the agent', - textPre: - 'Agents are libraries that run inside of your application process.' + - ' APM services are created programmatically based on the `serviceName`.' + - ' This agent supports a vararity of frameworks but can also be used with your custom stack.', - commands: `// Add this to the VERY top of the first file loaded in your app + title: i18n.translate('kbn.server.tutorials.apm.nodeClient.configure.title', { + defaultMessage: 'Configure the agent', + }), + textPre: i18n.translate('kbn.server.tutorials.apm.nodeClient.configure.textPre', { + defaultMessage: 'Agents are libraries that run inside of your application process. \ +APM services are created programmatically based on the `serviceName`. \ +This agent supports a vararity of frameworks but can also be used with your custom stack.', + }), + commands: `// ${i18n.translate('kbn.server.tutorials.apm.nodeClient.configure.commands.addThisToTheFileTopComment', { + defaultMessage: 'Add this to the VERY top of the first file loaded in your app', + })} var apm = require('elastic-apm-node').start({curlyOpen} - // Override service name from package.json - // Allowed characters: a-z, A-Z, 0-9, -, _, and space + // ${i18n.translate('kbn.server.tutorials.apm.nodeClient.configure.commands.setRequiredServiceNameComment', { + defaultMessage: 'Override service name from package.json', + })} + // ${i18n.translate('kbn.server.tutorials.apm.nodeClient.configure.commands.allowedCharactersComment', { + defaultMessage: 'Allowed characters: a-z, A-Z, 0-9, -, _, and space', + })} serviceName: '', - // Use if APM Server requires a token + // ${i18n.translate('kbn.server.tutorials.apm.nodeClient.configure.commands.useIfApmRequiresTokenComment', { + defaultMessage: 'Use if APM Server requires a token', + })} secretToken: '', - // Set custom APM Server URL (default: http://localhost:8200) + // ${i18n.translate('kbn.server.tutorials.apm.nodeClient.configure.commands.setCustomApmServerUrlComment', { + defaultMessage: 'Set custom APM Server URL (default: {defaultApmServerUrl})', + values: { defaultApmServerUrl: 'http://localhost:8200' }, + })} serverUrl: '' {curlyClose})`.split('\n'), - textPost: `See [the documentation]({config.docs.base_url}guide/en/apm/agent/nodejs/1.x/index.html) for advanced usage, including how to use with [Babel/ES Modules]({config.docs.base_url}guide/en/apm/agent/nodejs/1.x/advanced-setup.html#es-modules).`, + textPost: i18n.translate('kbn.server.tutorials.apm.nodeClient.configure.textPost', { + defaultMessage: 'See [the documentation]({documentationLink}) for advanced usage, including how to use with \ +[Babel/ES Modules]({babelEsModulesLink}).', + values: { + documentationLink: '{config.docs.base_url}guide/en/apm/agent/nodejs/1.x/index.html', + babelEsModulesLink: '{config.docs.base_url}guide/en/apm/agent/nodejs/1.x/advanced-setup.html#es-modules', + }, + }), }, ]; export const createDjangoClientInstructions = () => [ { - title: 'Install the APM agent', - textPre: 'Install the APM agent for Python as a dependency.', + title: i18n.translate('kbn.server.tutorials.apm.djangoClient.install.title', { + defaultMessage: 'Install the APM agent', + }), + textPre: i18n.translate('kbn.server.tutorials.apm.djangoClient.install.textPre', { + defaultMessage: 'Install the APM agent for Python as a dependency.', + }), commands: ['$ pip install elastic-apm'], }, { - title: 'Configure the agent', - textPre: - 'Agents are libraries that run inside of your application process.' + - ' APM services are created programmatically based on the `SERVICE_NAME`.', - commands: `# Add the agent to the installed apps + title: i18n.translate('kbn.server.tutorials.apm.djangoClient.configure.title', { + defaultMessage: 'Configure the agent', + }), + textPre: i18n.translate('kbn.server.tutorials.apm.djangoClient.configure.textPre', { + defaultMessage: 'Agents are libraries that run inside of your application process. \ +APM services are created programmatically based on the `SERVICE_NAME`.', + }), + commands: `# ${i18n.translate('kbn.server.tutorials.apm.djangoClient.configure.commands.addAgentComment', { + defaultMessage: 'Add the agent to the installed apps', + })} INSTALLED_APPS = ( 'elasticapm.contrib.django', # ... ) ELASTIC_APM = {curlyOpen} - # Set required service name. Allowed characters: - # a-z, A-Z, 0-9, -, _, and space + # ${i18n.translate('kbn.server.tutorials.apm.djangoClient.configure.commands.setRequiredServiceNameComment', { + defaultMessage: 'Set required service name. Allowed characters:', + })} + # ${i18n.translate('kbn.server.tutorials.apm.djangoClient.configure.commands.allowedCharactersComment', { + defaultMessage: 'a-z, A-Z, 0-9, -, _, and space', + })} 'SERVICE_NAME': '', - # Use if APM Server requires a token + # ${i18n.translate('kbn.server.tutorials.apm.djangoClient.configure.commands.useIfApmServerRequiresTokenComment', { + defaultMessage: 'Use if APM Server requires a token', + })} 'SECRET_TOKEN': '', - # Set custom APM Server URL (default: http://localhost:8200) + # ${i18n.translate('kbn.server.tutorials.apm.djangoClient.configure.commands.setCustomApmServerUrlComment', { + defaultMessage: 'Set custom APM Server URL (default: {defaultApmServerUrl})', + values: { defaultApmServerUrl: 'http://localhost:8200' }, + })} 'SERVER_URL': '', {curlyClose} -# To send performance metrics, add our tracing middleware: +# ${i18n.translate('kbn.server.tutorials.apm.djangoClient.configure.commands.addTracingMiddlewareComment', { + defaultMessage: 'To send performance metrics, add our tracing middleware:', + })} MIDDLEWARE = ( 'elasticapm.contrib.django.middleware.TracingMiddleware', #... )`.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/python/2.x/django-support.html) for advanced usage.', + textPost: i18n.translate('kbn.server.tutorials.apm.djangoClient.configure.textPost', { + defaultMessage: 'See the [documentation]({documentationLink}) for advanced usage.', + values: { documentationLink: '{config.docs.base_url}guide/en/apm/agent/python/2.x/django-support.html' }, + }), }, ]; export const createFlaskClientInstructions = () => [ { - title: 'Install the APM agent', - textPre: 'Install the APM agent for Python as a dependency.', + title: i18n.translate('kbn.server.tutorials.apm.flaskClient.install.title', { + defaultMessage: 'Install the APM agent', + }), + textPre: i18n.translate('kbn.server.tutorials.apm.flaskClient.install.textPre', { + defaultMessage: 'Install the APM agent for Python as a dependency.', + }), commands: ['$ pip install elastic-apm[flask]'], }, { - title: 'Configure the agent', - textPre: - 'Agents are libraries that run inside of your application process.' + - ' APM services are created programmatically based on the `SERVICE_NAME`.', - commands: `# initialize using environment variables + title: i18n.translate('kbn.server.tutorials.apm.flaskClient.configure.title', { + defaultMessage: 'Configure the agent', + }), + textPre: i18n.translate('kbn.server.tutorials.apm.flaskClient.configure.textPre', { + defaultMessage: 'Agents are libraries that run inside of your application process. \ +APM services are created programmatically based on the `SERVICE_NAME`.', + }), + commands: `# ${i18n.translate('kbn.server.tutorials.apm.flaskClient.configure.commands.initializeUsingEnvironmentVariablesComment', { + defaultMessage: 'initialize using environment variables', + })} from elasticapm.contrib.flask import ElasticAPM app = Flask(__name__) apm = ElasticAPM(app) -# or configure to use ELASTIC_APM in your application's settings +# ${i18n.translate('kbn.server.tutorials.apm.flaskClient.configure.commands.configureElasticApmComment', { + defaultMessage: 'or configure to use ELASTIC_APM in your application\'s settings', + })} from elasticapm.contrib.flask import ElasticAPM app.config['ELASTIC_APM'] = {curlyOpen} - # Set required service name. Allowed characters: - # a-z, A-Z, 0-9, -, _, and space + # ${i18n.translate('kbn.server.tutorials.apm.flaskClient.configure.commands.setRequiredServiceNameComment', { + defaultMessage: 'Set required service name. Allowed characters:', + })} + # ${i18n.translate('kbn.server.tutorials.apm.flaskClient.configure.commands.allowedCharactersComment', { + defaultMessage: 'a-z, A-Z, 0-9, -, _, and space', + })} 'SERVICE_NAME': '', - # Use if APM Server requires a token + # ${i18n.translate('kbn.server.tutorials.apm.flaskClient.configure.commands.useIfApmServerRequiresTokenComment', { + defaultMessage: 'Use if APM Server requires a token', + })} 'SECRET_TOKEN': '', - # Set custom APM Server URL (default: http://localhost:8200) + # ${i18n.translate('kbn.server.tutorials.apm.flaskClient.configure.commands.setCustomApmServerUrlComment', { + defaultMessage: 'Set custom APM Server URL (default: {defaultApmServerUrl})', + values: { defaultApmServerUrl: 'http://localhost:8200' }, + })} 'SERVER_URL': '', {curlyClose} apm = ElasticAPM(app)`.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/python/2.x/flask-support.html) for advanced usage.', + textPost: i18n.translate('kbn.server.tutorials.apm.flaskClient.configure.textPost', { + defaultMessage: 'See the [documentation]({documentationLink}) for advanced usage.', + values: { documentationLink: '{config.docs.base_url}guide/en/apm/agent/python/2.x/flask-support.html' }, + }), }, ]; export const createRailsClientInstructions = () => [ { - title: 'Install the APM agent', - textPre: 'Add the agent to your Gemfile.', + title: i18n.translate('kbn.server.tutorials.apm.railsClient.install.title', { + defaultMessage: 'Install the APM agent', + }), + textPre: i18n.translate('kbn.server.tutorials.apm.railsClient.install.textPre', { + defaultMessage: 'Add the agent to your Gemfile.', + }), commands: [`gem 'elastic-apm'`], }, { - title: 'Configure the agent', - textPre: - 'APM is automatically started when your app boots. Configure the agent, by creating the config file `config/elastic_apm.yml`', + title: i18n.translate('kbn.server.tutorials.apm.railsClient.configure.title', { + defaultMessage: 'Configure the agent', + }), + textPre: i18n.translate('kbn.server.tutorials.apm.railsClient.configure.textPre', { + defaultMessage: 'APM is automatically started when your app boots. Configure the agent, by creating the config file {configFile}', + values: { configFile: '`config/elastic_apm.yml`' }, + }), commands: `# config/elastic_apm.yml: # Set service name - allowed characters: a-z, A-Z, 0-9, -, _ and space @@ -145,22 +220,30 @@ export const createRailsClientInstructions = () => [ # Set custom APM Server URL (default: http://localhost:8200) # server_url: 'http://localhost:8200'`.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/ruby/1.x/index.html) for configuration options and advanced usage.\n\n', + textPost: i18n.translate('kbn.server.tutorials.apm.railsClient.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/ruby/1.x/index.html' }, + }), }, ]; export const createRackClientInstructions = () => [ { - title: 'Install the APM agent', - textPre: 'Add the agent to your Gemfile.', + title: i18n.translate('kbn.server.tutorials.apm.rackClient.install.title', { + defaultMessage: 'Install the APM agent', + }), + textPre: i18n.translate('kbn.server.tutorials.apm.rackClient.install.textPre', { + defaultMessage: 'Add the agent to your Gemfile.', + }), commands: [`gem 'elastic-apm'`], }, { - title: 'Configure the agent', - textPre: - 'For Rack or a compatible framework (e.g. Sinatra), include the middleware in your app and start the agent.', + title: i18n.translate('kbn.server.tutorials.apm.rackClient.configure.title', { + defaultMessage: 'Configure the agent', + }), + textPre: i18n.translate('kbn.server.tutorials.apm.rackClient.configure.textPre', { + defaultMessage: 'For Rack or a compatible framework (e.g. Sinatra), include the middleware in your app and start the agent.', + }), commands: `# config.ru require 'sinatra/base' @@ -171,8 +254,12 @@ export const createRackClientInstructions = () => [ end ElasticAPM.start( - app: MySinatraApp, # required - config_file: '' # optional, defaults to config/elastic_apm.yml + app: MySinatraApp, # ${i18n.translate('kbn.server.tutorials.apm.rackClient.configure.commands.requiredComment', { + defaultMessage: 'required', + })} + config_file: '' # ${i18n.translate('kbn.server.tutorials.apm.rackClient.configure.commands.optionalComment', { + defaultMessage: 'optional, defaults to config/elastic_apm.yml', + })} ) run MySinatraApp @@ -180,90 +267,146 @@ export const createRackClientInstructions = () => [ at_exit {curlyOpen} ElasticAPM.stop {curlyClose}`.split('\n'), }, { - title: 'Create config file', - textPre: 'Create a config file `config/elastic_apm.yml`:', + title: i18n.translate('kbn.server.tutorials.apm.rackClient.createConfig.title', { + defaultMessage: 'Create config file', + }), + textPre: i18n.translate('kbn.server.tutorials.apm.rackClient.createConfig.textPre', { + defaultMessage: 'Create a config file {configFile}:', + values: { configFile: '`config/elastic_apm.yml`' }, + }), commands: `# config/elastic_apm.yml: -# Set service name - allowed characters: a-z, A-Z, 0-9, -, _ and space -# Defaults to the name of your Rack app's class. +# ${i18n.translate('kbn.server.tutorials.apm.rackClient.createConfig.commands.setServiceNameComment', { + defaultMessage: 'Set service name - allowed characters: a-z, A-Z, 0-9, -, _ and space', + })} +# ${i18n.translate('kbn.server.tutorials.apm.rackClient.createConfig.commands.defaultsToTheNameOfRackAppClassComment', { + defaultMessage: 'Defaults to the name of your Rack app\'s class.', + })} # service_name: 'my-service' -# Use if APM Server requires a token +# ${i18n.translate('kbn.server.tutorials.apm.rackClient.createConfig.commands.useIfApmServerRequiresTokenComment', { + defaultMessage: 'Use if APM Server requires a token', + })} # secret_token: '' -# Set custom APM Server URL (default: http://localhost:8200) +# ${i18n.translate('kbn.server.tutorials.apm.rackClient.createConfig.commands.setCustomApmServerComment', { + defaultMessage: 'Set custom APM Server URL (default: {defaultServerUrl})', + values: { defaultServerUrl: 'http://localhost:8200' }, + })} # server_url: 'http://localhost:8200'`.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/ruby/1.x/index.html) for configuration options and advanced usage.\n\n', + textPost: i18n.translate('kbn.server.tutorials.apm.rackClient.createConfig.textPost', { + defaultMessage: 'See the [documentation]({documentationLink}) for configuration options and advanced usage.\n\n', + values: { documentationLink: '{config.docs.base_url}guide/en/apm/agent/ruby/1.x/index.html' }, + }), }, ]; export const createJsClientInstructions = () => [ { - title: 'Enable Real User Monitoring support in the APM server', - textPre: - 'Please refer to [the documentation]({config.docs.base_url}guide/en/apm/server/{config.docs.version}/rum.html).', + title: i18n.translate('kbn.server.tutorials.apm.jsClient.enableRealUserMonitoring.title', { + defaultMessage: 'Enable Real User Monitoring support in the APM server', + }), + textPre: i18n.translate('kbn.server.tutorials.apm.jsClient.enableRealUserMonitoring.textPre', { + defaultMessage: 'Please refer to [the documentation]({documentationLink}).', + values: { documentationLink: '{config.docs.base_url}guide/en/apm/server/{config.docs.version}/rum.html' }, + }), }, { - title: 'Install the APM agent', - textPre: 'Install the APM agent for JavaScript as a dependency to your application:', + title: i18n.translate('kbn.server.tutorials.apm.jsClient.install.title', { + defaultMessage: 'Install the APM agent', + }), + textPre: i18n.translate('kbn.server.tutorials.apm.jsClient.install.textPre', { + defaultMessage: 'Install the APM agent for JavaScript as a dependency to your application:', + }), commands: [`npm install elastic-apm-js-base --save`], }, { - title: 'Configure the agent', - textPre: 'Agents are libraries that run inside of your application.', + title: i18n.translate('kbn.server.tutorials.apm.jsClient.configure.title', { + defaultMessage: 'Configure the agent', + }), + textPre: i18n.translate('kbn.server.tutorials.apm.jsClient.configure.textPre', { + defaultMessage: 'Agents are libraries that run inside of your application.', + }), commands: `import {curlyOpen} init as initApm {curlyClose} from 'elastic-apm-js-base' var apm = initApm({curlyOpen} - // Set required service name (allowed characters: a-z, A-Z, 0-9, -, _, and space) + // ${i18n.translate('kbn.server.tutorials.apm.jsClient.configure.commands.setRequiredServiceNameComment', { + defaultMessage: 'Set required service name (allowed characters: a-z, A-Z, 0-9, -, _, and space)', + })} serviceName: '', - // Set custom APM Server URL (default: http://localhost:8200) + // ${i18n.translate('kbn.server.tutorials.apm.jsClient.configure.commands.setCustomApmServerUrlComment', { + defaultMessage: 'Set custom APM Server URL (default: {defaultApmServerUrl})', + values: { defaultApmServerUrl: 'http://localhost:8200' }, + })} serverUrl: '', - // Set service version (required for sourcemap feature) + // ${i18n.translate('kbn.server.tutorials.apm.jsClient.configure.commands.setServiceVersionComment', { + defaultMessage: 'Set service version (required for sourcemap feature)', + })} serviceVersion: '' {curlyClose})`.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/js-base/current/index.html) for advanced usage.', + textPost: i18n.translate('kbn.server.tutorials.apm.jsClient.configure.textPost', { + defaultMessage: 'See the [documentation]({documentationLink}) for advanced usage.', + values: { documentationLink: '{config.docs.base_url}guide/en/apm/agent/js-base/current/index.html' }, + }), }, ]; export const createGoClientInstructions = () => [ { - title: 'Install the APM agent', - textPre: 'Install the APM agent packages for Go.', + title: i18n.translate('kbn.server.tutorials.apm.goClient.install.title', { + defaultMessage: 'Install the APM agent', + }), + textPre: i18n.translate('kbn.server.tutorials.apm.goClient.install.textPre', { + defaultMessage: 'Install the APM agent packages for Go.', + }), commands: ['go get github.com/elastic/apm-agent-go'], }, { - title: 'Configure the agent', - textPre: - 'Agents are libraries that run inside of your application process.' + - ' APM services are created programmatically based on the executable ' + - ' file name, or the `ELASTIC_APM_SERVICE_NAME` environment variable.', - commands: `# Initialize using environment variables: - -# Set the service name. Allowed characters: # a-z, A-Z, 0-9, -, _, and space. -# If ELASTIC_APM_SERVICE_NAME is not specified, the executable name will be used. + title: i18n.translate('kbn.server.tutorials.apm.goClient.configure.title', { + defaultMessage: 'Configure the agent', + }), + textPre: i18n.translate('kbn.server.tutorials.apm.goClient.configure.textPre', { + defaultMessage: 'Agents are libraries that run inside of your application process. \ +APM services are created programmatically based on the executable \ +file name, or the `ELASTIC_APM_SERVICE_NAME` environment variable.', + }), + commands: `# ${i18n.translate('kbn.server.tutorials.apm.goClient.configure.commands.initializeUsingEnvironmentVariablesComment', { + defaultMessage: 'Initialize using environment variables:', + })} + +# ${i18n.translate('kbn.server.tutorials.apm.goClient.configure.commands.setServiceNameComment', { + defaultMessage: 'Set the service name. Allowed characters: # a-z, A-Z, 0-9, -, _, and space.', + })} +# ${i18n.translate('kbn.server.tutorials.apm.goClient.configure.commands.usedExecutableNameComment', { + defaultMessage: 'If ELASTIC_APM_SERVICE_NAME is not specified, the executable name will be used.', + })} export ELASTIC_APM_SERVICE_NAME= -# Set the APM Server URL. If unspecified, the agent will effectively be disabled. +# ${i18n.translate('kbn.server.tutorials.apm.goClient.configure.commands.setAmpServerUrlComment', { + defaultMessage: 'Set the APM Server URL. If unspecified, the agent will effectively be disabled.', + })} export ELASTIC_APM_SERVER_URL= -# Set if APM Server requires a token. +# ${i18n.translate('kbn.server.tutorials.apm.goClient.configure.commands.setIfAmpServerRequiresTokenComment', { + defaultMessage: 'Set if APM Server requires a token.', + })} export ELASTIC_APM_SECRET_TOKEN= `.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/go/current/configuration.html) for advanced configuration.', + textPost: i18n.translate('kbn.server.tutorials.apm.goClient.configure.textPost', { + defaultMessage: 'See the [documentation]({documenationLink}) for advanced configuration.', + values: { documenationLink: '{config.docs.base_url}guide/en/apm/agent/go/current/configuration.html' }, + }), }, { - title: 'Instrument your application', - textPre: - 'Instrument your Go application by using one of the provided instrumentation modules or ' + - 'by using the tracer API directly.', + title: i18n.translate('kbn.server.tutorials.apm.goClient.instrument.title', { + defaultMessage: 'Instrument your application', + }), + textPre: i18n.translate('kbn.server.tutorials.apm.goClient.instrument.textPre', { + defaultMessage: 'Instrument your Go application by using one of the provided instrumentation modules or \ +by using the tracer API directly.', + }), commands: ` import ( "net/http" @@ -277,37 +420,46 @@ func main() {curlyOpen} http.ListenAndServe(":8080", apmhttp.Wrap(mux)) {curlyClose} `.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/go/current/instrumenting-source.html) for a detailed ' + - 'guide to instrumenting Go source code.\n\n' + - '**Warning: The Go agent is currently in Beta and not meant for production use.**', + textPost: i18n.translate('kbn.server.tutorials.apm.goClient.instrument.textPost', { + defaultMessage: 'See the [documentation]({documentationLink}) for a detailed \ +guide to instrumenting Go source code.\n\n\ +**Warning: The Go agent is currently in Beta and not meant for production use.**', + values: { documentationLink: '{config.docs.base_url}guide/en/apm/agent/go/current/instrumenting-source.html' }, + }), }, ]; export const createJavaClientInstructions = () => [ { - title: 'Download the APM agent', - textPre: - 'Download the agent jar from [Maven Central](http://search.maven.org/#search%7Cga%7C1%7Ca%3Aelastic-apm-agent). ' + - 'Do **not** add the agent as a dependency to your application.', + title: i18n.translate('kbn.server.tutorials.apm.javaClient.download.title', { + defaultMessage: 'Download the APM agent', + }), + textPre: i18n.translate('kbn.server.tutorials.apm.javaClient.download.textPre', { + defaultMessage: 'Download the agent jar from [Maven Central]({mavenCentralLink}). \ +Do **not** add the agent as a dependency to your application.', + values: { mavenCentralLink: 'http://search.maven.org/#search%7Cga%7C1%7Ca%3Aelastic-apm-agent' }, + }), }, { - title: 'Start your application with the javaagent flag', - textPre: - 'Add the `-javaagent` flag and configure the agent with system properties.\n' + - '\n' + - ' * Set required service name (allowed characters: a-z, A-Z, 0-9, -, _, and space)\n' + - ' * Set custom APM Server URL (default: http://localhost:8200)\n' + - ' * Set the base package of your application', + title: i18n.translate('kbn.server.tutorials.apm.javaClient.startApplication.title', { + defaultMessage: 'Start your application with the javaagent flag', + }), + textPre: i18n.translate('kbn.server.tutorials.apm.javaClient.startApplication.textPre', { + defaultMessage: 'Add the `-javaagent` flag and configure the agent with system properties.\n\n \ +* Set required service name (allowed characters: a-z, A-Z, 0-9, -, _, and space)\n \ +* Set custom APM Server URL (default: {customApmServerUrl})\n \ +* Set the base package of your application', + values: { customApmServerUrl: 'http://localhost:8200' }, + }), commands: `java -javaagent:/path/to/elastic-apm-agent-.jar \\ -Delastic.apm.service_name=my-application \\ -Delastic.apm.server_url=http://localhost:8200 \\ -Delastic.apm.application_packages=org.example \\ -jar my-application.jar`.split('\n'), - textPost: - 'See the [documentation]' + - '({config.docs.base_url}guide/en/apm/agent/java/current/index.html) for configuration options and advanced usage.\n\n' + - '**Warning: The Java agent is currently in Beta and not meant for production use.**', + textPost: i18n.translate('kbn.server.tutorials.apm.javaClient.startApplication.textPost', { + defaultMessage: 'See the [documentation]({documenationLink}) for configuration options and advanced \ +usage.\n\n**Warning: The Java agent is currently in Beta and not meant for production use.**', + values: { documenationLink: '{config.docs.base_url}guide/en/apm/agent/java/current/index.html' }, + }), }, ]; diff --git a/src/core_plugins/kibana/server/tutorials/apm/apm_server_instructions.js b/src/core_plugins/kibana/server/tutorials/apm/apm_server_instructions.js index 59d4d5fe75c1b..2826aca5194db 100644 --- a/src/core_plugins/kibana/server/tutorials/apm/apm_server_instructions.js +++ b/src/core_plugins/kibana/server/tutorials/apm/apm_server_instructions.js @@ -17,11 +17,16 @@ * under the License. */ +import { i18n } from '@kbn/i18n'; + export const createEditConfig = () => ({ - title: 'Edit the configuration', - textPre: - `If you're using an X-Pack secured version of Elastic Stack, you must specify` + - ' credentials in the `apm-server.yml` config file.', + title: i18n.translate('kbn.server.tutorials.apm.editConfig.title', { + defaultMessage: 'Edit the configuration', + }), + textPre: i18n.translate('kbn.server.tutorials.apm.editConfig.textPre', { + defaultMessage: 'If you\'re using an X-Pack secured version of Elastic Stack, you must specify \ +credentials in the `apm-server.yml` config file.', + }), commands: [ 'output.elasticsearch:', ' hosts: [""]', @@ -31,8 +36,12 @@ export const createEditConfig = () => ({ }); const createStartServer = () => ({ - title: 'Start APM Server', - textPre: 'The server processes and stores application performance metrics in Elasticsearch.', + title: i18n.translate('kbn.server.tutorials.apm.startServer.title', { + defaultMessage: 'Start APM Server', + }), + textPre: i18n.translate('kbn.server.tutorials.apm.startServer.textPre', { + defaultMessage: 'The server processes and stores application performance metrics in Elasticsearch.', + }), }); export function createStartServerUnix() { @@ -45,7 +54,9 @@ export function createStartServerUnix() { }; } -const createDownloadServerTitle = () => 'Download and unpack APM Server'; +const createDownloadServerTitle = () => i18n.translate('kbn.server.tutorials.apm.downloadServer.title', { + defaultMessage: 'Download and unpack APM Server', +}); export const createDownloadServerOsx = () => ({ title: createDownloadServerTitle(), @@ -62,8 +73,10 @@ export const createDownloadServerDeb = () => ({ 'curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-{config.kibana.version}-amd64.deb', 'sudo dpkg -i apm-server-{config.kibana.version}-amd64.deb', ], - textPost: - 'Looking for the 32-bit packages? See the [Download page]({config.docs.base_url}downloads/apm/apm-server).', + textPost: i18n.translate('kbn.server.tutorials.apm.downloadServerTitle', { + defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({downloadPageLink}).', + values: { downloadPageLink: '{config.docs.base_url}downloads/apm/apm-server' }, + }), }); export const createDownloadServerRpm = () => ({ @@ -72,8 +85,10 @@ export const createDownloadServerRpm = () => ({ 'curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-{config.kibana.version}-x86_64.rpm', 'sudo rpm -vi apm-server-{config.kibana.version}-x86_64.rpm', ], - textPost: - 'Looking for the 32-bit packages? See the [Download page]({config.docs.base_url}downloads/apm/apm-server).', + textPost: i18n.translate('kbn.server.tutorials.apm.downloadServerRpm', { + defaultMessage: 'Looking for the 32-bit packages? See the [Download page]({downloadPageLink}).', + values: { downloadPageLink: '{config.docs.base_url}downloads/apm/apm-server' }, + }), }); export function createWindowsServerInstructions() { @@ -82,20 +97,32 @@ export function createWindowsServerInstructions() { return [ { title: createDownloadServerTitle(), - textPre: - '1. Download the APM Server Windows zip file from the [Download page](https://www.elastic.co/downloads/apm/apm-server).\n' + - '2. Extract the contents of the zip file into `C:\\Program Files`.\n' + - '3. Rename the `apm-server-{config.kibana.version}-windows` directory to `APM-Server`.\n' + - '4. Open a PowerShell prompt as an Administrator (right-click the PowerShell icon and select' + - ' **Run As Administrator**). If you are running Windows XP, you might need to download and install PowerShell.\n' + - '5. From the PowerShell prompt, run the following commands to install APM Server as a Windows service:', + textPre: i18n.translate('kbn.server.tutorials.apm.windowsServerInstructions.textPre', { + defaultMessage: '1. Download the APM Server Windows zip file from the \ +[Download page]({downloadPageLink}).\n2. Extract the contents of \ +the zip file into {zipFileExtractFolder}.\n3. Rename the {apmServerDirectory} \ +directory to `APM-Server`.\n4. Open a PowerShell prompt as an Administrator \ +(right-click the PowerShell icon and select \ +**Run As Administrator**). If you are running Windows XP, you might need to download and install \ +PowerShell.\n5. From the PowerShell prompt, run the following commands to install APM Server as a Windows service:', + values: { + downloadPageLink: 'https://www.elastic.co/downloads/apm/apm-server', + zipFileExtractFolder: '`C:\\Program Files`', + apmServerDirectory: '`apm-server-{config.kibana.version}-windows`', + } + }), commands: [ `PS > cd 'C:\\Program Files\\APM-Server'`, `PS C:\\Program Files\\APM-Server> .\\install-service-apm-server.ps1`, ], - textPost: - 'Note: If script execution is disabled on your system, you need to set the execution policy for the current session' + - ' to allow the script to run. For example: `PowerShell.exe -ExecutionPolicy UnRestricted -File .\\install-service-apm-server.ps1`.', + textPost: i18n.translate('kbn.server.tutorials.apm.windowsServerInstructions.textPost', { + defaultMessage: 'Note: If script execution is disabled on your system, \ +you need to set the execution policy for the current session \ +to allow the script to run. For example: {command}.', + values: { + command: '`PowerShell.exe -ExecutionPolicy UnRestricted -File .\\install-service-apm-server.ps1`' + } + }), }, createEditConfig(), { diff --git a/src/core_plugins/kibana/server/tutorials/apm/elastic_cloud.js b/src/core_plugins/kibana/server/tutorials/apm/elastic_cloud.js index 4bce847b082e7..0a18d06d3fc81 100644 --- a/src/core_plugins/kibana/server/tutorials/apm/elastic_cloud.js +++ b/src/core_plugins/kibana/server/tutorials/apm/elastic_cloud.js @@ -17,6 +17,7 @@ * under the License. */ +import { i18n } from '@kbn/i18n'; import { INSTRUCTION_VARIANT } from '../../../common/tutorials/instruction_variant'; import { @@ -31,9 +32,13 @@ import { } from './apm_client_instructions'; const createServerUrlInstruction = () => ({ - title: 'APM Server endpoint', - textPre: `Retrieve the APM Server URL from the Deployments section on the Elastic Cloud dashboard. - You will also need the APM Server secret token, which was generated on deployment.`, + title: i18n.translate('kbn.server.tutorials.apm.serverUrlInstruction.title', { + defaultMessage: 'APM Server endpoint', + }), + textPre: i18n.translate('kbn.server.tutorials.apm.serverUrlInstruction.textPre', { + defaultMessage: 'Retrieve the APM Server URL from the Deployments section on the Elastic Cloud dashboard. \ +You will also need the APM Server secret token, which was generated on deployment.', + }), }); export function createElasticCloudInstructions() { @@ -42,7 +47,9 @@ export function createElasticCloudInstructions() { return { instructionSets: [ { - title: 'APM Agents', + title: i18n.translate('kbn.server.tutorials.apm.elasticCloudInstructions.title', { + defaultMessage: 'APM Agents', + }), instructionVariants: [ { id: INSTRUCTION_VARIANT.NODE, diff --git a/src/core_plugins/kibana/server/tutorials/apm/index.js b/src/core_plugins/kibana/server/tutorials/apm/index.js index fb92e9acb9609..512805a4231dd 100644 --- a/src/core_plugins/kibana/server/tutorials/apm/index.js +++ b/src/core_plugins/kibana/server/tutorials/apm/index.js @@ -17,12 +17,15 @@ * under the License. */ +import { i18n } from '@kbn/i18n'; import { TUTORIAL_CATEGORY } from '../../../common/tutorials/tutorial_category'; import { onPremInstructions } from './on_prem'; import { createElasticCloudInstructions } from './elastic_cloud'; import { getSavedObjects } from './saved_objects/get_saved_objects'; -const apmIntro = 'Collect in-depth performance metrics and errors from inside your applications.'; +const apmIntro = i18n.translate('kbn.server.tutorials.apm.introduction', { + defaultMessage: 'Collect in-depth performance metrics and errors from inside your applications.', +}); function isEnabled(config) { const ENABLED_KEY = 'xpack.apm.ui.enabled'; @@ -41,7 +44,9 @@ export function apmSpecProvider(server) { dashboards: [ { id: '8d3ed660-7828-11e7-8c47-65b845b5cfb3', - linkLabel: 'APM dashboard', + linkLabel: i18n.translate('kbn.server.tutorials.apm.specProvider.artifacts.dashboards.linkLabel', { + defaultMessage: 'APM dashboard', + }), isOverview: true, }, ], @@ -50,28 +55,35 @@ export function apmSpecProvider(server) { if (isEnabled(config)) { artifacts.application = { path: '/app/apm', - label: 'Launch APM', + label: i18n.translate('kbn.server.tutorials.apm.specProvider.artifacts.application.label', { + defaultMessage: 'Launch APM', + }), }; } return { id: 'apm', - name: 'APM', + name: i18n.translate('kbn.server.tutorials.apm.specProvider.name', { + defaultMessage: 'APM', + }), category: TUTORIAL_CATEGORY.OTHER, shortDescription: apmIntro, - longDescription: - 'Application Performance Monitoring (APM) collects in-depth' + - ' performance metrics and errors from inside your application.' + - ' It allows you to monitor the performance of thousands of applications in real time.' + - ' [Learn more]({config.docs.base_url}guide/en/apm/get-started/{config.docs.version}/index.html).', + longDescription: i18n.translate('kbn.server.tutorials.apm.specProvider.longDescription', { + defaultMessage: 'Application Performance Monitoring (APM) collects in-depth \ +performance metrics and errors from inside your application. \ +It allows you to monitor the performance of thousands of applications in real time. \ +[Learn more]({learnMoreLink}).', + values: { learnMoreLink: '{config.docs.base_url}guide/en/apm/get-started/{config.docs.version}/index.html' }, + }), euiIconType: 'apmApp', artifacts: artifacts, onPrem: onPremInstructions(apmIndexPattern), elasticCloud: createElasticCloudInstructions(), previewImagePath: '/plugins/kibana/home/tutorial_resources/apm/apm.png', savedObjects: getSavedObjects(apmIndexPattern), - savedObjectsInstallMsg: - 'Load index pattern, visualizations, and pre-defined dashboards.' + - ' An index pattern is required for some features in the APM UI.', + savedObjectsInstallMsg: i18n.translate('kbn.server.tutorials.apm.specProvider.savedObjectsInstallMsg', { + defaultMessage: 'Load index pattern, visualizations, and pre-defined dashboards. \ +An index pattern is required for some features in the APM UI.', + }), }; } diff --git a/src/core_plugins/kibana/server/tutorials/apm/on_prem.js b/src/core_plugins/kibana/server/tutorials/apm/on_prem.js index b1a3938592e73..a75ce27384b21 100644 --- a/src/core_plugins/kibana/server/tutorials/apm/on_prem.js +++ b/src/core_plugins/kibana/server/tutorials/apm/on_prem.js @@ -17,6 +17,7 @@ * under the License. */ +import { i18n } from '@kbn/i18n'; import { INSTRUCTION_VARIANT } from '../../../common/tutorials/instruction_variant'; import { createWindowsServerInstructions, @@ -44,7 +45,9 @@ export function onPremInstructions(apmIndexPattern) { return { instructionSets: [ { - title: 'APM Server', + title: i18n.translate('kbn.server.tutorials.apm.apmServer.title', { + defaultMessage: 'APM Server', + }), instructionVariants: [ { id: INSTRUCTION_VARIANT.OSX, @@ -64,11 +67,21 @@ export function onPremInstructions(apmIndexPattern) { }, ], statusCheck: { - title: 'APM Server status', - text: 'Make sure APM Server is running before you start implementing the APM agents.', - btnLabel: 'Check APM Server status', - success: 'You have correctly setup APM-Server', - error: 'APM-Server has still not connected to Elasticsearch', + title: i18n.translate('kbn.server.tutorials.apm.apmServer.statusCheck.title', { + defaultMessage: 'APM Server status', + }), + text: i18n.translate('kbn.server.tutorials.apm.apmServer.statusCheck.text', { + defaultMessage: 'Make sure APM Server is running before you start implementing the APM agents.', + }), + btnLabel: i18n.translate('kbn.server.tutorials.apm.apmServer.statusCheck.btnLabel', { + defaultMessage: 'Check APM Server status', + }), + success: i18n.translate('kbn.server.tutorials.apm.apmServer.statusCheck.successMessage', { + defaultMessage: 'You have correctly setup APM-Server', + }), + error: i18n.translate('kbn.server.tutorials.apm.apmServer.statusCheck.errorMessage', { + defaultMessage: 'APM-Server has still not connected to Elasticsearch', + }), esHitsCheck: { index: apmIndexPattern, query: { @@ -84,7 +97,9 @@ export function onPremInstructions(apmIndexPattern) { }, }, { - title: 'APM Agents', + title: i18n.translate('kbn.server.tutorials.apm.apmAgents.title', { + defaultMessage: 'APM Agents', + }), instructionVariants: [ { id: INSTRUCTION_VARIANT.NODE, @@ -120,11 +135,21 @@ export function onPremInstructions(apmIndexPattern) { }, ], statusCheck: { - title: 'Agent status', - text: 'Make sure your application is running and the agents are sending data.', - btnLabel: 'Check agent status', - success: 'Data successfully received from one or more agents', - error: `No data has been received from agents yet`, + title: i18n.translate('kbn.server.tutorials.apm.apmAgents.statusCheck.title', { + defaultMessage: 'Agent status', + }), + text: i18n.translate('kbn.server.tutorials.apm.apmAgents.statusCheck.text', { + defaultMessage: 'Make sure your application is running and the agents are sending data.', + }), + btnLabel: i18n.translate('kbn.server.tutorials.apm.apmAgents.statusCheck.btnLabel', { + defaultMessage: 'Check agent status', + }), + success: i18n.translate('kbn.server.tutorials.apm.apmAgents.statusCheck.successMessage', { + defaultMessage: 'Data successfully received from one or more agents', + }), + error: i18n.translate('kbn.server.tutorials.apm.apmAgents.statusCheck.errorMessage', { + defaultMessage: 'No data has been received from agents yet', + }), esHitsCheck: { index: apmIndexPattern, query: {