Rework which loggers we sent to OTEL

* Send all propagate=False loggers to OTEL AND the awx logger
This commit is contained in:
Chris Meyers 2024-05-31 10:11:02 -04:00 committed by Chris Meyers
parent cae42653bf
commit 6df47c8449

View File

@ -51,11 +51,18 @@ LOGGING['handlers']['otel'] |= {
'class': 'awx.main.utils.handlers.OTLPHandler',
'endpoint': 'http://otel:4317',
}
# Add otel log handler to all log handlers
# Add otel log handler to all log handlers where propagate is False
for name in LOGGING['loggers'].keys():
handler = LOGGING['loggers'][name].get('handlers', [])
if 'otel' not in handler:
LOGGING['loggers'][name].get('handlers', []).append('otel')
if not LOGGING['loggers'][name].get('propagate', True):
handler = LOGGING['loggers'][name].get('handlers', [])
if 'otel' not in handler:
LOGGING['loggers'][name].get('handlers', []).append('otel')
# Everything without explicit propagate=False ends up logging to 'awx' so add it
handler = LOGGING['loggers']['awx'].get('handlers', [])
if 'otel' not in handler:
LOGGING['loggers']['awx'].get('handlers', []).append('otel')
{% endif %}
BROADCAST_WEBSOCKET_PORT = 8013