Skip to content

Commit

Permalink
Adds Valkey support
Browse files Browse the repository at this point in the history
  • Loading branch information
jairhenrique committed Oct 10, 2024
1 parent 573d5f0 commit f99e64d
Show file tree
Hide file tree
Showing 16 changed files with 2,691 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
- redis
- rediscluster
- solr
- valkey

steps:
- name: Success
Expand Down Expand Up @@ -1198,3 +1199,65 @@ jobs:
name: coverage-${{ github.job }}-${{ strategy.job-index }}
path: ./**/.coverage.*
retention-days: 1

valkey:
env:
TOTAL_GROUPS: 2

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

runs-on: ubuntu-latest
container:
image: ghcr.io/newrelic/newrelic-python-agent-ci:latest
options: >-
--add-host=host.docker.internal:host-gateway
timeout-minutes: 30
services:
valkey:
image: valkey
ports:
- 8080:6379
- 8081:6379
# Set health checks to wait until valkey has started
options: >-
--health-cmd "valkey-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 4.1.1

- name: Fetch git tags
run: |
git config --global --add safe.directory "$GITHUB_WORKSPACE"
git fetch --tags origin
- name: Configure pip cache
run: |
mkdir -p /github/home/.cache/pip
chown -R $(whoami) /github/home/.cache/pip
- 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@5d5d22a31266ced268874388b861e4b58bb5c2f3 # 4.3.1
with:
name: coverage-${{ github.job }}-${{ strategy.job-index }}
path: ./**/.coverage.*
retention-days: 1
54 changes: 54 additions & 0 deletions newrelic/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3621,6 +3621,60 @@ def _process_module_builtin_defaults():
"redis.commands.graph.commands", "newrelic.hooks.datastore_redis", "instrument_redis_commands_graph_commands"
)

_process_module_definition(
"valkey.asyncio.client", "newrelic.hooks.datastore_valkey", "instrument_asyncio_valkey_client"
)

_process_module_definition(
"valkey.asyncio.commands", "newrelic.hooks.datastore_valkey", "instrument_asyncio_valkey_client"
)

_process_module_definition(
"valkey.asyncio.connection", "newrelic.hooks.datastore_valkey", "instrument_asyncio_valkey_connection"
)

_process_module_definition(
"valkey.connection",
"newrelic.hooks.datastore_valkey",
"instrument_valkey_connection",
)
_process_module_definition("valkey.client", "newrelic.hooks.datastore_valkey", "instrument_valkey_client")

_process_module_definition(
"valkey.commands.cluster", "newrelic.hooks.datastore_valkey", "instrument_valkey_commands_cluster"
)

_process_module_definition(
"valkey.commands.core", "newrelic.hooks.datastore_valkey", "instrument_valkey_commands_core"
)

_process_module_definition(
"valkey.commands.sentinel", "newrelic.hooks.datastore_valkey", "instrument_valkey_commands_sentinel"
)

_process_module_definition(
"valkey.commands.json.commands", "newrelic.hooks.datastore_valkey", "instrument_valkey_commands_json_commands"
)

_process_module_definition(
"valkey.commands.search.commands", "newrelic.hooks.datastore_valkey", "instrument_valkey_commands_search_commands"
)

_process_module_definition(
"valkey.commands.timeseries.commands",
"newrelic.hooks.datastore_valkey",
"instrument_valkey_commands_timeseries_commands",
)

_process_module_definition(
"valkey.commands.bf.commands", "newrelic.hooks.datastore_valkey", "instrument_valkey_commands_bf_commands"
)

_process_module_definition(
"valkey.commands.graph.commands", "newrelic.hooks.datastore_valkey", "instrument_valkey_commands_graph_commands"
)


_process_module_definition("motor", "newrelic.hooks.datastore_motor", "patch_motor")

_process_module_definition(
Expand Down
Loading

0 comments on commit f99e64d

Please sign in to comment.