Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/sentry/src/Aspect/GuzzleHttpClientAspect.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ public function process(ProceedingJoinPoint $proceedingJoinPoint)

Integration::addBreadcrumb(new Breadcrumb(
Breadcrumb::LEVEL_INFO,
Breadcrumb::TYPE_DEFAULT,
'guzzle',
Breadcrumb::TYPE_HTTP,
'http',
$uri,
$data
));
Expand Down
37 changes: 32 additions & 5 deletions src/sentry/src/Listener/EventHandleListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
use Hyperf\Contract\StdoutLoggerInterface;
use Hyperf\Crontab\Event as CrontabEvent;
use Hyperf\Database\Events as DbEvent;
use Hyperf\DbConnection\Pool\PoolFactory as DbPoolFactory;
use Hyperf\Event\Contract\ListenerInterface;
use Hyperf\Framework\Event\BootApplication;
use Hyperf\HttpServer\Event as HttpEvent;
use Hyperf\HttpServer\Server as HttpServer;
use Hyperf\Kafka\Event as KafkaEvent;
use Hyperf\Redis\Event as RedisEvent;
use Hyperf\Redis\Pool\PoolFactory as RedisPoolFactory;
use Hyperf\RpcServer\Event as RpcEvent;
use Hyperf\RpcServer\Server as RpcServer;
use Hyperf\Server\Event;
Expand Down Expand Up @@ -280,6 +282,17 @@ protected function handleDbQueryExecuted(object $event): void
$data['bindings'] = $event->bindings;
}

try {
$pool = $this->container->get(DbPoolFactory::class)->getPool($event->connectionName);
$data['pool'] = [
'max' => $pool->getOption()->getMaxConnections(),
'waiting' => $pool->getConnectionsInChannel(),
'use' => $pool->getCurrentConnections(),
];
} catch (Throwable $e) {
$this->captureException($e);
}

Integration::addBreadcrumb(new Breadcrumb(
Breadcrumb::LEVEL_INFO,
Breadcrumb::TYPE_DEFAULT,
Expand Down Expand Up @@ -318,16 +331,30 @@ protected function handleRedisCommandExecuted(object $event): void
return;
}

$data = [
'connectionName' => $event->connectionName,
'arguments' => $event->parameters,
'result' => $event->result,
'duration' => $event->time * 1000,
];

try {
$pool = $this->container->get(RedisPoolFactory::class)->getPool($event->connectionName);
$data['pool'] = [
'max' => $pool->getOption()->getMaxConnections(),
'waiting' => $pool->getConnectionsInChannel(),
'use' => $pool->getCurrentConnections(),
];
} catch (Throwable $e) {
$this->captureException($e);
}

Integration::addBreadcrumb(new Breadcrumb(
Breadcrumb::LEVEL_INFO,
Breadcrumb::TYPE_DEFAULT,
'redis',
$event->command,
[
'arguments' => $event->parameters,
'result' => $event->result,
'duration' => $event->time * 1000,
]
$data
));
}

Expand Down