Skip to content

Commit

Permalink
log_redis_info (#255)
Browse files Browse the repository at this point in the history
* log_redis_info, fix #254

* uprev

* linting and fix CI
  • Loading branch information
samuelcolvin authored Jul 6, 2021
1 parent 8ee04f9 commit 118308a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:

- run: coverage xml

- uses: codecov/codecov-action@v1.4.1
- uses: codecov/codecov-action@v1.5.2
with:
file: ./coverage.xml
env_vars: PYTHON,OS
Expand Down
15 changes: 11 additions & 4 deletions arq/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,17 @@ async def pool_factory(*args: Any, **kwargs: Any) -> Redis:

async def log_redis_info(redis: Redis, log_func: Callable[[str], Any]) -> None:
with await redis as r:
info, key_count = await asyncio.gather(r.info(), r.dbsize())
info_server, info_memory, info_clients, key_count = await asyncio.gather(
r.info(section='Server'), r.info(section='Memory'), r.info(section='Clients'), r.dbsize(),
)

redis_version = info_server.get('server', {}).get('redis_version', '?')
mem_usage = info_memory.get('memory', {}).get('used_memory_human', '?')
clients_connected = info_clients.get('clients', {}).get('connected_clients', '?')

log_func(
f'redis_version={info["server"]["redis_version"]} '
f'mem_usage={info["memory"]["used_memory_human"]} '
f'clients_connected={info["clients"]["connected_clients"]} '
f'redis_version={redis_version} '
f'mem_usage={mem_usage} '
f'clients_connected={clients_connected} '
f'db_keys={key_count}'
)
2 changes: 1 addition & 1 deletion arq/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__all__ = ('VERSION',)

VERSION = '0.20'
VERSION = '0.21'

0 comments on commit 118308a

Please sign in to comment.