Collect metrics only if statistics are enabled.
This commit is contained in:
parent
81ee07f003
commit
9c41cf32a2
|
|
@ -49,7 +49,9 @@ class TriggerEvent extends Controller
|
|||
$request->appId, $request->socket_id, $channelName, (object) $payload
|
||||
);
|
||||
|
||||
StatisticsCollector::apiMessage($request->appId);
|
||||
if ($this->app->statisticsEnabled) {
|
||||
StatisticsCollector::apiMessage($request->appId);
|
||||
}
|
||||
|
||||
DashboardLogger::log($request->appId, DashboardLogger::TYPE_API_MESSAGE, [
|
||||
'event' => $request->name,
|
||||
|
|
|
|||
|
|
@ -56,7 +56,9 @@ class WebSocketHandler implements MessageComponentInterface
|
|||
/** @var \GuzzleHttp\Psr7\Request $request */
|
||||
$request = $connection->httpRequest;
|
||||
|
||||
StatisticsCollector::connection($connection->app->id);
|
||||
if ($connection->app->statisticsEnabled) {
|
||||
StatisticsCollector::connection($connection->app->id);
|
||||
}
|
||||
|
||||
$this->channelManager->subscribeToApp($connection->app->id);
|
||||
|
||||
|
|
@ -88,7 +90,9 @@ class WebSocketHandler implements MessageComponentInterface
|
|||
$message, $connection, $this->channelManager
|
||||
)->respond();
|
||||
|
||||
StatisticsCollector::webSocketMessage($connection->app->id);
|
||||
if ($connection->app->statisticsEnabled) {
|
||||
StatisticsCollector::webSocketMessage($connection->app->id);
|
||||
}
|
||||
|
||||
WebSocketMessageReceived::dispatch(
|
||||
$connection->app->id,
|
||||
|
|
@ -109,7 +113,9 @@ class WebSocketHandler implements MessageComponentInterface
|
|||
->unsubscribeFromAllChannels($connection)
|
||||
->then(function (bool $unsubscribed) use ($connection) {
|
||||
if (isset($connection->app)) {
|
||||
StatisticsCollector::disconnection($connection->app->id);
|
||||
if ($connection->app->statisticsEnabled) {
|
||||
StatisticsCollector::disconnection($connection->app->id);
|
||||
}
|
||||
|
||||
$this->channelManager->unsubscribeFromApp($connection->app->id);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue