add a per-request GUID and log as it travels through background services

see: https://github.com/ansible/awx/issues/9329
This commit is contained in:
Ryan Petrello
2021-02-16 12:33:54 -05:00
parent b4956de6e4
commit 3cc3cf1f80
13 changed files with 93 additions and 13 deletions

View File

@@ -16,6 +16,7 @@ from queue import Full as QueueFull, Empty as QueueEmpty
from django.conf import settings
from django.db import connection as django_connection, connections
from django.core.cache import cache as django_cache
from django_guid.middleware import GuidMiddleware
from jinja2 import Template
import psutil
@@ -445,6 +446,8 @@ class AutoscalePool(WorkerPool):
return super(AutoscalePool, self).up()
def write(self, preferred_queue, body):
if 'guid' in body:
GuidMiddleware.set_guid(body['guid'])
try:
# when the cluster heartbeat occurs, clean up internally
if isinstance(body, dict) and 'cluster_node_heartbeat' in body['task']: