mirror of
https://github.com/ansible/awx.git
synced 2026-05-16 13:57:39 -02:30
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:
@@ -95,19 +95,16 @@ class BroadcastConsumer(AsyncJsonWebsocketConsumer):
|
|||||||
try:
|
try:
|
||||||
WebsocketSecretAuthHelper.is_authorized(self.scope)
|
WebsocketSecretAuthHelper.is_authorized(self.scope)
|
||||||
except Exception:
|
except Exception:
|
||||||
# TODO: log ip of connected client
|
logger.warn(f"client '{self.channel_name}' failed to authorize against the broadcast endpoint.")
|
||||||
logger.warn("Broadcast client failed to authorize for reason.")
|
|
||||||
await self.close()
|
await self.close()
|
||||||
return
|
return
|
||||||
|
|
||||||
# TODO: log ip of connected client
|
|
||||||
logger.info(f"Broadcast client connected.")
|
|
||||||
await self.accept()
|
await self.accept()
|
||||||
await self.channel_layer.group_add(settings.BROADCAST_WEBSOCKET_GROUP_NAME, self.channel_name)
|
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):
|
async def disconnect(self, code):
|
||||||
# TODO: log ip of disconnected client
|
logger.info("client '{self.channel_name}' disconnected from the broadcast group.")
|
||||||
logger.info("Client disconnected")
|
|
||||||
await self.channel_layer.group_discard(settings.BROADCAST_WEBSOCKET_GROUP_NAME, self.channel_name)
|
await self.channel_layer.group_discard(settings.BROADCAST_WEBSOCKET_GROUP_NAME, self.channel_name)
|
||||||
|
|
||||||
async def internal_message(self, event):
|
async def internal_message(self, event):
|
||||||
|
|||||||
@@ -1106,9 +1106,9 @@ LOGGING = {
|
|||||||
'handlers': ['console', 'file', 'tower_warnings'],
|
'handlers': ['console', 'file', 'tower_warnings'],
|
||||||
'level': 'WARNING',
|
'level': 'WARNING',
|
||||||
},
|
},
|
||||||
'celery': { # for celerybeat connection warnings
|
'daphne': {
|
||||||
'handlers': ['console', 'file', 'tower_warnings'],
|
'handlers': ['console', 'file', 'tower_warnings'],
|
||||||
'level': 'WARNING',
|
'level': 'INFO',
|
||||||
},
|
},
|
||||||
'rest_framework.request': {
|
'rest_framework.request': {
|
||||||
'handlers': ['console', 'file', 'tower_warnings'],
|
'handlers': ['console', 'file', 'tower_warnings'],
|
||||||
@@ -1139,6 +1139,10 @@ LOGGING = {
|
|||||||
'awx.main.dispatch': {
|
'awx.main.dispatch': {
|
||||||
'handlers': ['dispatcher'],
|
'handlers': ['dispatcher'],
|
||||||
},
|
},
|
||||||
|
'awx.main.consumers': {
|
||||||
|
'handlers': ['console', 'file', 'tower_warnings'],
|
||||||
|
'level': 'INFO',
|
||||||
|
},
|
||||||
'awx.main.wsbroadcast': {
|
'awx.main.wsbroadcast': {
|
||||||
'handlers': ['wsbroadcast'],
|
'handlers': ['wsbroadcast'],
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user