hhxsv5 / laravel-s

LaravelS is an out-of-the-box adapter between Laravel/Lumen and Swoole.
MIT License
3.82k stars 470 forks source link

How to connect new relic or blackfire? #329

Open juslintek opened 3 years ago

juslintek commented 3 years ago

Hi, has anyone tried setting up a new relic or Blackfire? And how did it went, what step you needed to take? If for example worker serves more than single requests then start and exit worker events aren't too helpful. :)

What is the best approach for production profiling :-)

juslintek commented 3 years ago

I've connected it with https://github.com/upscalesoftware/swoole-newrelic, but had to do it like that:

  1. create an EventHandler, name it whatever you like, I've named it AttachNewRelicMiddleware, code looks like this:
    
    <?php

namespace App\LaravelS\EventsHandlers;

use Hhxsv5\LaravelS\Swoole\Events\ServerStartInterface; use Swoole\Http\Server; use Upscale\Swoole\Newrelic;

class AttachNewRelicMiddleware implements ServerStartInterface { /**

namespace App\Providers;

use Illuminate\Support\Facades\Event;

class EventServiceProvider extends ServiceProvider { /**



And that's it. Compared to generic implementation its complicated. Guess it is very similar with Blackfire. :-) Everything else comes from general New Relic setup tutorial.