Skip to content

Commit

Permalink
Develop swap redis asyncio commits (#913)
Browse files Browse the repository at this point in the history
* Revert "Redis asyncio testing (#881)" (#911)

* Revert "Redis asyncio testing (#881)"

This reverts commit 05cff1b.

* Add spublish to list of commands

* Fix redis.asyncio sync operations wrapper (#782)

* Fix redis.asyncio sync operations wrapper

* Add clean ups

* Fixes:
- `loop` -> noqa
- catch `TimeoutError` on `asyncio.timeout`

* Added separate instrumentation for redis.asyncio.client (#808)

* Added separate instrumentation for redis.asyncio.client

Merge main branch updates

Add tests for newrelic/config.py (#860)

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

* Modify redis tests

* removed redis.asyncio from aioredis instrumentation

removed aioredis instrumentation in redis asyncio client

removed redis.asyncio from aioredis instrumentation

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Lalleh Rafeei <lrafeei@newrelic.com>
Co-authored-by: Lalleh Rafeei <84813886+lrafeei@users.noreply.github.com>

* Modify tests

* Tweak tests and instrumentation

* Tweak tests to separate aioredis and redis.asyncio

* Correctly separate commands to sync/async

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Ahmed <ahmedhropewala@gmail.com>
Co-authored-by: Lalleh Rafeei <lrafeei@newrelic.com>
Co-authored-by: Lalleh Rafeei <84813886+lrafeei@users.noreply.github.com>

* Remove formatting in import

---------

Co-authored-by: Błażej Cyrzon <36710760+bc291@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: Ahmed <ahmedhropewala@gmail.com>
  • Loading branch information
4 people authored Aug 28, 2023
1 parent 3988ecc commit 0baf8d5
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions newrelic/hooks/datastore_aioredis.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from newrelic.api.datastore_trace import DatastoreTrace
from newrelic.api.time_trace import current_trace
from newrelic.api.transaction import current_transaction
Expand Down Expand Up @@ -60,6 +59,7 @@ def _nr_wrapper_AioRedis_method_(wrapped, instance, args, kwargs):
# Method will return synchronously without executing,
# it will be added to the command stack and run later.
aioredis_version = get_package_version_tuple("aioredis")

# This conditional is for versions of aioredis that are outside
# New Relic's supportability window but will still work. New
# Relic does not provide testing/support for this. In order to
Expand Down Expand Up @@ -139,7 +139,6 @@ async def wrap_Connection_send_command(wrapped, instance, args, kwargs):
):
return await wrapped(*args, **kwargs)


# This wrapper is for versions of aioredis that are outside
# New Relic's supportability window but will still work. New
# Relic does not provide testing/support for this. In order to
Expand Down
2 changes: 1 addition & 1 deletion newrelic/hooks/datastore_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from newrelic.api.transaction import current_transaction
from newrelic.common.object_wrapper import function_wrapper, wrap_function_wrapper


_redis_client_sync_methods = {
"acl_dryrun",
"auth",
Expand Down Expand Up @@ -612,7 +613,6 @@ def instrument_asyncio_redis_client(module):
if hasattr(class_, operation):
_wrap_asyncio_Redis_method_wrapper(module, "Redis", operation)


def instrument_redis_commands_core(module):
_instrument_redis_commands_module(module, "CoreCommands")

Expand Down
2 changes: 0 additions & 2 deletions tests/datastore_aioredis/test_execute_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# limitations under the License.

import pytest

# import aioredis
from conftest import AIOREDIS_VERSION, loop # noqa # pylint: disable=E0611,W0611
from testing_support.db_settings import redis_settings
from testing_support.fixtures import override_application_settings
Expand Down
2 changes: 1 addition & 1 deletion tests/datastore_redis/test_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,4 @@ async def _test_pubsub():
await future

loop.run_until_complete(_test_pubsub())
assert messages_received == ["Hello", "World", "NOPE"]
assert messages_received == ["Hello", "World", "NOPE"]

0 comments on commit 0baf8d5

Please sign in to comment.