-
Notifications
You must be signed in to change notification settings - Fork 60
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
feat(redis): Add mget/mset support #156
Conversation
Can one of the admins verify this patch? |
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.
Hello there and thanks so much for engaging on this issue. It's great to see the test case updated as well, thanks!!
0459472
to
4ddcf01
Compare
Thanks @zsistla 😄 I know that even if this PR is accepted, it may take a long time for NR team to release a new version of the extension. So, do you know if it's safe to run my own agent build in production? Of course, I cannot take the responsibility of my changes, but at least is it technically feasible? Does the extension require some "internal signature" preventing to run invalid agent build in production? I would be interested to be able to run some private beta version, waiting for next official versions in this case. By the way, if this PR needs some rework, feel free to give me some hints about how to proceed 👍 |
@b-viguier , we always welcome more test cases/updates to ensure proper functionality :) One think I just noticed was that we have recently moved to the convention of opening all PRs against the Additionally, to your question about internal signature/invalid build: there is none. It's totally open source, so if you build, for instance, off of the 9.17.1 branch, it is complete and should give you all the functionality of the latest release. :) regards and thanks again! |
4ddcf01
to
f08d8fc
Compare
Done ✅
Good news! I will give it a try 👍 |
f08d8fc
to
49b56ad
Compare
ok jenkins |
@@ -83,6 +86,10 @@ function test_basic() { | |||
tap_equal(1, $redis->del($key), 'delete key'); | |||
tap_equal(0, $redis->del($key), 'delete missing key'); | |||
|
|||
tap_assert($redis->mset([$key => 'bar']), 'mset key'); | |||
tap_equal(['bar'], $redis->mget($key), 'mget 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.
Hi @b-viguier ,
Looks like the tests caught an error in the testcase:
Warning: Redis::mget() expects parameter 1 to be array, string given
mget
is expecting an array. I think if you put $key
in brackets [$key]
it should work.
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.
Thanks @zsistla, you're totally right! It's fixed now 👍
I'm really annoyed, because I did my best to run tests locally and I didn't notice anything wrong 😕 … I'm using the Docker image stored in Github actions: https://github.com/newrelic/newrelic-php-agent/blob/main/.github/actions/ubuntu20-build-action/Dockerfile
The output is very dense, did I miss something? Furthermore, I didn't find where the CI reported the error, are you using tools internal to NR?
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.
Thanks @b-viguier,
No worries. There are two sets of tests, the unit tests and our integration tests.
The output from the unit tests can be seen in the github CI output, but we're still in the process of moving from our old CI to github actions for the CI, so the integration tests are are still run internally.
49b56ad
to
b5d9867
Compare
ok jenkins |
Hi @b-viguier , in Currently, it's expecting 8 redis calls, but you added three more so we need to update that number to 11. Also, delete was called one more time, so we increment the number to 4 and add mget/mset sections because now we can se mget/mset thanks to your instrumentation :) Something like this should do it:
Also, in |
b5d9867
to
c57acff
Compare
Thanks for you help @zsistla , I think I got it 👍 |
ok jenkins |
1 similar comment
ok jenkins |
:) Thanks, @b-viguier, it's looking great with one caveat.... While we don't support 5.3 anymore, we are still testing against it, and that PHP version showed some incompatibility with the mget/mset format. There's a
|
c57acff
to
3af8e0d
Compare
ok jenkins |
Hi @b-viguier , it's looking great. |
3af8e0d
to
990a9c8
Compare
Sorry, I forgot the second file 😕 |
ok jenkins |
--- subject: PHP agent releaseDate: '2021-08-23' version: 9.18.1.303 downloadLink: 'https://download.newrelic.com/php_agent/archive/9.18.1.303' --- ## New Relic PHP Agent v9.18.1 ## ### New Features ### * [Added](newrelic/newrelic-php-agent#162) a docker development environment. It's now possible for contributors to both develop and test (unit tests and integration tests) without setting up a specific environment on their own system. Please see our [documentation](https://github.com/newrelic/newrelic-php-agent/blob/main/docs/dev_environment.md) for more information. * [Route caching in `Laravel 7.x` is now supported!](newrelic/newrelic-php-agent#174). Transaction naming now works with routes cached via `php artisan route:cache`. @stockalexander, thanks for your contribution! * `Redis::mget` and `Redis::mset` [functions are now supported](newrelic/newrelic-php-agent#156). @b-viguier, thanks for your contribution! ### Bug Fixes ### * [Fixed](newrelic/newrelic-php-agent#161) instances where a memory leak was occurring with our `curl multi` instrumentation. * [Fixed](newrelic/newrelic-php-agent#176) an issue where a supportability metric used to track an edge case was causing a segfault. * [Fixed](newrelic/newrelic-php-agent#87) an issue where PHP versions with an unknown API version were incorrectly handled during Debian package install. * [Fixed](newrelic/newrelic-php-agent#164) instances where `parent.transportDuration` values are `0` for transactions between two PHP applications instrumented through distributed tracing. @b-viguier, thanks for your contribution! * [Fixed](newrelic/newrelic-php-agent#158) an issue where the `newrelic.ini` configuration file was incorrectly installed. @b-viguier, thanks for your contribution! ### Support Statement ### * New Relic recommends that you upgrade the agent regularly and at a minimum every 3 months. As of this release, the oldest supported version is [8.6.0](/docs/release-notes/agent-release-notes/php-release-notes/php-agent-860238/).
--- subject: PHP agent releaseDate: '2021-08-23' version: 9.18.1.303 downloadLink: 'https://download.newrelic.com/php_agent/archive/9.18.1.303' --- ## New Relic PHP Agent v9.18.1 ## ### New Features ### * [Added](newrelic/newrelic-php-agent#162) a docker development environment. It's now possible for contributors to both develop and test (unit tests and integration tests) without setting up a specific environment on their own system. Please see our [documentation](https://github.com/newrelic/newrelic-php-agent/blob/main/docs/dev_environment.md) for more information. * [Route caching in `Laravel 7.x` is now supported!](newrelic/newrelic-php-agent#174). Transaction naming now works with routes cached via `php artisan route:cache`. @stockalexander, thanks for your contribution! * `Redis::mget` and `Redis::mset` [functions are now supported](newrelic/newrelic-php-agent#156). @b-viguier, thanks for your contribution! ### Bug Fixes ### * [Fixed](newrelic/newrelic-php-agent#161) instances where a memory leak was occurring with our `curl multi` instrumentation. * [Fixed](newrelic/newrelic-php-agent#176) an issue where a supportability metric used to track an edge case was causing a segfault. * [Fixed](newrelic/newrelic-php-agent#87) an issue where PHP versions with an unknown API version were incorrectly handled during Debian package install. * [Fixed](newrelic/newrelic-php-agent#164) instances where `parent.transportDuration` values are `0` for transactions between two PHP applications instrumented through distributed tracing. @b-viguier, thanks for your contribution! * [Fixed](newrelic/newrelic-php-agent#158) an issue where the `newrelic.ini` configuration file was incorrectly installed. @b-viguier, thanks for your contribution! ### Support Statement ### * New Relic recommends that you upgrade the agent regularly and at a minimum every 3 months. As of this release, the oldest supported version is [8.6.0](/docs/release-notes/agent-release-notes/php-release-notes/php-agent-860238/).
Add support for
Redis::mget
andRedis::mset
functions, as suggested in #130To be honest, I copied/pasted some code from existing
Redis::get
andRedis::set
support 😅