Intallation
Connect your Symfony application to Inspector.
- PHP >= 7.2
- Symfony ^4.4 | ^5.2 | ^6.0
Type the command below in your terminal to install the latest version of the bundle:
composer require inspector-apm/inspector-symfony
Create the
inspector.yaml
configuration file in your config/packages
directory, and put the ingestion_key
field inside:inspector:
ingestion_key: '%env(INSPECTOR_INGESTION_KEY)%'
Add the new variable in your production env file:
INSPECTOR_INGESTION_KEY=xxx
Execute the Symfony command below to check if your app can send data to inspector correctly:
php bin/console inspector:test
Inspector instance is binded in the Symfony service container. In your controller, you can type-hint an argument with the Inspector's class name to get a concrete Inspector instance.
namespace App\Controller;
use Inspector\Inspector;
use Symfony\Component\HttpFoundation\Response;
class ProductController
{
/**
* @Route("/products")
*/
public function list(Inspector $inspector): Response
{
$inspector->addSegment(function () {
sleep(1);
}, 'example-type');
// ...
}
}
Last modified 10mo ago