aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/RedisFactory.php
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2022-02-25 16:18:02 +0100
committerJulius Härtl <jus@bitgrid.net>2022-02-28 11:24:41 +0100
commit83717a7800e8854b3f3ba17608157598d1fe28ca (patch)
treeee7e264c35c991fe182853dbf853b95760cd4fa6 /lib/private/RedisFactory.php
parentf13c150a560f31ed3e03833b9ed416d8c7c592f4 (diff)
downloadnextcloud-server-83717a7800e8854b3f3ba17608157598d1fe28ca.tar.gz
nextcloud-server-83717a7800e8854b3f3ba17608157598d1fe28ca.zip
Add event logging for db and redis connection
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib/private/RedisFactory.php')
-rw-r--r--lib/private/RedisFactory.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/private/RedisFactory.php b/lib/private/RedisFactory.php
index 88d22cf9d13..5c38ed0807d 100644
--- a/lib/private/RedisFactory.php
+++ b/lib/private/RedisFactory.php
@@ -26,6 +26,8 @@
*/
namespace OC;
+use OCP\Diagnostics\IEventLogger;
+
class RedisFactory {
public const REDIS_MINIMAL_VERSION = '3.1.3';
public const REDIS_EXTRA_PARAMETERS_MINIMAL_VERSION = '5.3.0';
@@ -33,16 +35,18 @@ class RedisFactory {
/** @var \Redis|\RedisCluster */
private $instance;
- /** @var SystemConfig */
- private $config;
+ private SystemConfig $config;
+
+ private IEventLogger $eventLogger;
/**
* RedisFactory constructor.
*
* @param SystemConfig $config
*/
- public function __construct(SystemConfig $config) {
+ public function __construct(SystemConfig $config, IEventLogger $eventLogger) {
$this->config = $config;
+ $this->eventLogger = $eventLogger;
}
private function create() {
@@ -113,6 +117,7 @@ class RedisFactory {
$port = null;
}
+ $this->eventLogger->start('connect:redis', 'Connect to redis and send AUTH, SELECT');
// Support for older phpredis versions not supporting connectionParameters
if ($connectionParameters !== null) {
// Non-clustered redis requires connection parameters to be wrapped inside `stream`
@@ -141,6 +146,7 @@ class RedisFactory {
if (isset($config['dbindex'])) {
$this->instance->select($config['dbindex']);
}
+ $this->eventLogger->end('connect:redis');
}
}