-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add Redis adapter #37
Open
vamsiikrishna
wants to merge
12
commits into
beberlei:3.x
Choose a base branch
from
vamsiikrishna:master
base: 3.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
225ae56
Add Redis adapter
vamsiikrishna d8f4615
move credis to suggest
vamsiikrishna 89f2a0a
Renamed Redis Class to CRedis
vamsiikrishna 334dbb2
Merge remote-tracking branch 'upstream/master'
vamsiikrishna a027ce8
call type as credis
vamsiikrishna 4d15181
updated example
vamsiikrishna 7264ce0
added support for credis in bundle
vamsiikrishna d5c3961
Add credis to require-dev
vamsiikrishna 690b737
Merge remote-tracking branch 'upstream/master'
vamsiikrishna fbb7c33
cx fix
vamsiikrishna d109bb5
Changes
vamsiikrishna abe9a43
Merge remote-tracking branch 'upstream/master'
vamsiikrishna File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
require_once __DIR__.'/../vendor/autoload.php'; | ||
|
||
$credis = new Credis_Client(); | ||
|
||
$metrics = \Beberlei\Metrics\Factory::create('credis', array( | ||
'credis_client' => $credis, | ||
)); | ||
|
||
while (true) { | ||
$metrics->increment('foo.bar'); | ||
$metrics->decrement('foo.baz'); | ||
$metrics->measure('foo', rand(1, 10)); | ||
usleep(10000); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
/** | ||
* Beberlei Metrics. | ||
* | ||
* LICENSE | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this package in the file LICENSE.txt. | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to kontakt@beberlei.de so I can send you a copy immediately. | ||
*/ | ||
namespace Beberlei\Metrics\Collector; | ||
|
||
use Credis_Client; | ||
|
||
class CRedis implements Collector | ||
{ | ||
/** @var \Credis_Client */ | ||
private $credis_client; | ||
|
||
public function __construct(Credis_Client $credis_client) | ||
{ | ||
$this->credis_client = $credis_client; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function increment($variable) | ||
{ | ||
$this->credis_client->incr($variable); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function decrement($variable) | ||
{ | ||
$this->credis_client->decr($variable); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function timing($variable, $time) | ||
{ | ||
$this->credis_client->set($variable, $time); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function measure($variable, $value) | ||
{ | ||
$this->credis_client->set($variable, $value); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function flush() | ||
{ | ||
// No Need to Implement flush() method for now. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
https://redis.io/commands/incr/
Once you reach the limit of 2 pow 63 + 1, you will get an error
https://stackoverflow.com/questions/36861472/what-happens-when-int64-maxvalue-is-exceded-with-redis-incr