58
loading...
This website collects cookies to deliver better user experience
composer require inspector-apm/inspector-symfony
inspector.yaml
configuration file in your config/packages
directory, and put the ingestion_key field inside:inspector:
ingestion_key: [your-ingestion-key]
php bin/console inspector:test
class BlogController extends AbstractController
{
/**
* @Route("/posts/{slug}", methods="GET", name="blog_post")
*/
public function postShow(Post $post): Response
{
$tags = this->externalService->get('tags');
return $this->render('blog/post_show.html.twig', compact('post', 'tags'));
}
}
use Inspector\Inspector;
class BlogController extends AbstractController
{
/**
* @Route("/posts/{slug}", methods="GET", name="blog_post")
*/
public function postShow(Post $post, Inspector $inspector): Response
{
$tags = $inspector->addSegment(function () {
return this->externalService->get('tags'); // return value will be transparently returned back.
}, 'http');
return $this->render('blog/post_show.html.twig', compact('post', 'tags'));
}
}
try {
// Your dangerous external call here...
} catch (GuzzleException $exception) {
$inspector->reportException($exception)
}