IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Getting started
edit
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.
Getting started
editUsing Package Managers
editInstall the APM agent for JavaScript as a dependency to your application:
npm install elastic-apm-js-base --save
Configure the agent:
import { init as initApm } from 'elastic-apm-js-base' const apm = initApm({ // Set required service name (allowed characters: a-z, A-Z, 0-9, -, _, and space) serviceName: '', // Set custom APM Server URL (default: http://localhost:8200) serverUrl: 'http://localhost:8200', // Set service version (required for sourcemap feature) serviceVersion: '' })
Using Script Tags
editAdd a <script> tag to the HTML page and use the elasticApm
global object to load and initialize the agent:
<script src="https://your-cdn-host.com/path/to/elastic-apm-js-base.umd.min.js" crossorigin></script> <script> elasticApm.init({ serviceName: '', serverUrl: 'http://localhost:8200' }) </script>
Currently our minified JavaScript bundle is about 16KB (gzipped).
Was this helpful?
Thank you for your feedback.