PHP code example of samuelbednarcik / elastic-apm-agent
1. Go to this page and download the library: Download samuelbednarcik/elastic-apm-agent library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
samuelbednarcik / elastic-apm-agent example snippets
$config = new AgentConfiguration();
$config->setServiceName('name-of-your-project');
$config->setServerUrl('http://localhost:8200'); // elastic apm server
// create metadata which will be applied to the transaction
$metadata = new Metadata();
$metadata->setService(
MetadataBuilder::buildService($config->getServiceName())
);
$config->setMetadata($metadata);
$agent = new Agent(
$config,
new Client(),
new ElasticAPMSerializer()
);