1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-27 09:25:10 +03:00

better broadcast websocket logging

* Make quiter the daphne logs by raising the level to INFO instead of
DEBUG
* Output the django channels name of broadcast clients. This way, if the
queue gets backed up, we can find it in redis.
This commit is contained in:
chris meyers 2020-04-17 17:16:54 -04:00
parent 4787e69afb
commit 8592bf3e39
2 changed files with 9 additions and 8 deletions

View File

@ -95,19 +95,16 @@ class BroadcastConsumer(AsyncJsonWebsocketConsumer):
try:
WebsocketSecretAuthHelper.is_authorized(self.scope)
except Exception:
# TODO: log ip of connected client
logger.warn("Broadcast client failed to authorize for reason.")
logger.warn(f"client '{self.channel_name}' failed to authorize against the broadcast endpoint.")
await self.close()
return
# TODO: log ip of connected client
logger.info(f"Broadcast client connected.")
await self.accept()
await self.channel_layer.group_add(settings.BROADCAST_WEBSOCKET_GROUP_NAME, self.channel_name)
logger.info(f"client '{self.channel_name}' joined the broadcast group.")
async def disconnect(self, code):
# TODO: log ip of disconnected client
logger.info("Client disconnected")
logger.info("client '{self.channel_name}' disconnected from the broadcast group.")
await self.channel_layer.group_discard(settings.BROADCAST_WEBSOCKET_GROUP_NAME, self.channel_name)
async def internal_message(self, event):

View File

@ -1106,9 +1106,9 @@ LOGGING = {
'handlers': ['console', 'file', 'tower_warnings'],
'level': 'WARNING',
},
'celery': { # for celerybeat connection warnings
'daphne': {
'handlers': ['console', 'file', 'tower_warnings'],
'level': 'WARNING',
'level': 'INFO',
},
'rest_framework.request': {
'handlers': ['console', 'file', 'tower_warnings'],
@ -1139,6 +1139,10 @@ LOGGING = {
'awx.main.dispatch': {
'handlers': ['dispatcher'],
},
'awx.main.consumers': {
'handlers': ['console', 'file', 'tower_warnings'],
'level': 'INFO',
},
'awx.main.wsbroadcast': {
'handlers': ['wsbroadcast'],
},