1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-02 17:06:09 +00:00

fix(logs): a job's rows carry the address it was asked from, and a cancel its own user

A job keeps the client address of its submission (Operation.client_ip,
migration operations.0003); the rows the worker writes for it, including the
migration's and the VM delete's own rows, carry it. A cancel is written under
the user who asked and from their address, also when an administrator
cancels another user's job; a running job's cancel gets a row when asked,
and its end a row when it stops. A resolution carries the administrator's
address.
This commit is contained in:
catborise 2026-11-07 14:25:18 +03:00
parent e9e514a7e9
commit 21b83062f7
9 changed files with 85 additions and 14 deletions

View file

@ -5,6 +5,9 @@ import contextvars
import logging
current_request = contextvars.ContextVar("current_request", default=None)
# the client address while a request is handled, reset when it is answered
# (current_request stays for Django's log line): the Logs rows of the jobs it submits
request_ip = contextvars.ContextVar("request_ip", default=None)
class RequestFilter(logging.Filter):