-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support of Predis library as storage adapter #127
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Łukasz Adamczewski <[email protected]>
I'm currently looking into adding |
@@ -586,7 +593,7 @@ private function collectGauges(bool $sortMetrics = true): array | |||
sort($keys); | |||
$gauges = []; | |||
foreach ($keys as $key) { | |||
$raw = $this->redis->hGetAll(str_replace($this->redis->_prefix(''), '', $key)); | |||
$raw = $this->redis->hGetAll(str_replace($this->prefix(''), '', $key)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->prefix('')
is always an empty string for this adater, but $key
contains the prefix to remove.
perhaps $this->removePrefixFromKey($key)
was intended here ?
The same applies to collectHistograms, collectGauges
$raw = $this->redis->hGetAll(str_replace($this->prefix(''), '', $key)); | |
$raw = $this->redis->hGetAll($this->removePrefixFromKey($key)); |
@@ -622,7 +629,7 @@ private function collectCounters(bool $sortMetrics = true): array | |||
sort($keys); | |||
$counters = []; | |||
foreach ($keys as $key) { | |||
$raw = $this->redis->hGetAll(str_replace($this->redis->_prefix(''), '', $key)); | |||
$raw = $this->redis->hGetAll(str_replace($this->prefix(''), '', $key)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$raw = $this->redis->hGetAll(str_replace($this->prefix(''), '', $key)); | |
$raw = $this->redis->hGetAll($this->removePrefixFromKey($key)); |
@@ -403,7 +411,7 @@ private function collectHistograms(): array | |||
sort($keys); | |||
$histograms = []; | |||
foreach ($keys as $key) { | |||
$raw = $this->redis->hGetAll(str_replace($this->redis->_prefix(''), '', $key)); | |||
$raw = $this->redis->hGetAll(str_replace($this->prefix(''), '', $key)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$raw = $this->redis->hGetAll(str_replace($this->prefix(''), '', $key)); | |
$raw = $this->redis->hGetAll($this->removePrefixFromKey($key)); |
Since predis library is a well-known alternative to phpredis, I've decided to add an extension to Redis storage adapter.
Some properties and methods were changed to protected in order to handle slight differences between these 2 libs.
Mostly additional params are passed as an array in phpredis and as single arguments in predis.