Events

Config Example

//Events
'events' => [
    'redis:pool:change' => [
        function ($event) {
            $count = $event->getData('count');

            if (\App\components\Config::get('redis.report_pool_change')) {
                if (extension_loaded('swoole')) {
                    \App\components\utils\swoole\Counter::incr('monitor:pool:redis', $count);
                }
            }
        },
    ],
    'mysql:pool:change' => [
        function ($event) {
            $count = $event->getData('count');

            if (\App\components\Config::get('mysql.report_pool_change')) {
                if (extension_loaded('swoole')) {
                    \App\components\utils\swoole\Counter::incr('monitor:pool:mysql', $count);
                }
            }
        },
    ],
    'amqp:pool:change' => [
        function ($event) {
            $count = $event->getData('count');

            if (\App\components\Config::get('amqp.report_pool_change')) {
                if (extension_loaded('swoole')) {
                    \App\components\utils\swoole\Counter::incr('monitor:pool:amqp', $count);
                }
            }
        },
    ],
]

Last updated