diff --git a/frappe/utils/background_jobs.py b/frappe/utils/background_jobs.py index 2b791783b8c..fc1f72b080b 100755 --- a/frappe/utils/background_jobs.py +++ b/frappe/utils/background_jobs.py @@ -22,7 +22,7 @@ import frappe import frappe.monitor from frappe import _ -from frappe.utils import CallbackManager, cint, cstr, get_bench_id +from frappe.utils import CallbackManager, cint, get_bench_id from frappe.utils.commands import log from frappe.utils.deprecations import deprecation_warning from frappe.utils.redis_queue import RedisQueue @@ -130,12 +130,18 @@ def enqueue( if not timeout: timeout = get_queues_timeout().get(queue) or 300 + # Prepare a more readable name than + if isinstance(method, Callable): + method_name = f"{method.__module__}.{method.__qualname__}" + else: + method_name = method + queue_args = { "site": frappe.local.site, "user": frappe.session.user, - "method": method, + "method": method_name, "event": event, - "job_name": job_name or cstr(method), + "job_name": job_name or method_name, "is_async": is_async, "kwargs": kwargs, } @@ -606,7 +612,6 @@ def _start_sentry(): from sentry_sdk.integrations.dedupe import DedupeIntegration from sentry_sdk.integrations.excepthook import ExcepthookIntegration from sentry_sdk.integrations.modules import ModulesIntegration - from sentry_sdk.integrations.rq import RqIntegration from frappe.utils.sentry import FrappeIntegration, before_send @@ -616,7 +621,6 @@ def _start_sentry(): DedupeIntegration(), ModulesIntegration(), ArgvIntegration(), - RqIntegration(), ] experiments = {} diff --git a/frappe/utils/sentry.py b/frappe/utils/sentry.py index c0e9dd806fa..157b8bd8cd1 100644 --- a/frappe/utils/sentry.py +++ b/frappe/utils/sentry.py @@ -59,6 +59,7 @@ def set_scope(scope): waitdiff = datetime.utcnow() - job.enqueued_at context.uuid = job.id context.wait = waitdiff.total_seconds() + context.kwargs = kwargs scope.set_extra("job", context) scope.set_transaction_name(transaction_name)