Skip to content

Commit

Permalink
Merge branch 'main' into postgres-other-function
Browse files Browse the repository at this point in the history
  • Loading branch information
lrafeei authored Aug 2, 2023
2 parents 04648b7 + 08eec5e commit 412efc4
Show file tree
Hide file tree
Showing 9 changed files with 526 additions and 208 deletions.
100 changes: 100 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
- postgres
- rabbitmq
- redis
- rediscluster
- solr

steps:
Expand Down Expand Up @@ -384,6 +385,105 @@ jobs:
path: ./**/.coverage.*
retention-days: 1

rediscluster:
env:
TOTAL_GROUPS: 1

strategy:
fail-fast: false
matrix:
group-number: [1]

runs-on: ubuntu-20.04
container:
image: ghcr.io/newrelic/newrelic-python-agent-ci:latest
options: >-
--add-host=host.docker.internal:host-gateway
timeout-minutes: 30

services:
redis1:
image: hmstepanek/redis-cluster-node:1.0.0
ports:
- 6379:6379
- 16379:16379
options: >-
--add-host=host.docker.internal:host-gateway
redis2:
image: hmstepanek/redis-cluster-node:1.0.0
ports:
- 6380:6379
- 16380:16379
options: >-
--add-host=host.docker.internal:host-gateway
redis3:
image: hmstepanek/redis-cluster-node:1.0.0
ports:
- 6381:6379
- 16381:16379
options: >-
--add-host=host.docker.internal:host-gateway
redis4:
image: hmstepanek/redis-cluster-node:1.0.0
ports:
- 6382:6379
- 16382:16379
options: >-
--add-host=host.docker.internal:host-gateway
redis5:
image: hmstepanek/redis-cluster-node:1.0.0
ports:
- 6383:6379
- 16383:16379
options: >-
--add-host=host.docker.internal:host-gateway
redis6:
image: hmstepanek/redis-cluster-node:1.0.0
ports:
- 6384:6379
- 16384:16379
options: >-
--add-host=host.docker.internal:host-gateway
cluster-setup:
image: hmstepanek/redis-cluster:1.0.0
options: >-
--add-host=host.docker.internal:host-gateway
steps:
- uses: actions/checkout@v3

- name: Fetch git tags
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git fetch --tags origin
- name: Get Environments
id: get-envs
run: |
echo "envs=$(tox -l | grep '^${{ github.job }}\-' | ./.github/workflows/get-envs.py)" >> $GITHUB_OUTPUT
env:
GROUP_NUMBER: ${{ matrix.group-number }}

- name: Test
run: |
tox -vv -e ${{ steps.get-envs.outputs.envs }} -p auto
env:
TOX_PARALLEL_NO_SPINNER: 1
PY_COLORS: 0

- name: Upload Coverage Artifacts
uses: actions/upload-artifact@v3
with:
name: coverage-${{ github.job }}-${{ strategy.job-index }}
path: ./**/.coverage.*
retention-days: 1

redis:
env:
TOTAL_GROUPS: 2
Expand Down
4 changes: 4 additions & 0 deletions newrelic/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2849,6 +2849,10 @@ def _process_module_builtin_defaults():
)
_process_module_definition("redis.client", "newrelic.hooks.datastore_redis", "instrument_redis_client")

_process_module_definition(
"redis.commands.cluster", "newrelic.hooks.datastore_redis", "instrument_redis_commands_cluster"
)

_process_module_definition(
"redis.commands.core", "newrelic.hooks.datastore_redis", "instrument_redis_commands_core"
)
Expand Down
4 changes: 4 additions & 0 deletions newrelic/hooks/datastore_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,10 @@ def instrument_redis_commands_bf_commands(module):
_instrument_redis_commands_module(module, "TOPKCommands")


def instrument_redis_commands_cluster(module):
_instrument_redis_commands_module(module, "RedisClusterCommands")


def _instrument_redis_commands_module(module, class_name):
for name in _redis_client_methods:
if hasattr(module, class_name):
Expand Down
Loading

0 comments on commit 412efc4

Please sign in to comment.