Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions sentry_sdk/integrations/celery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,14 @@ def apply_async(*args, **kwargs):
# type: (*Any, **Any) -> Any
task = args[0]

from pprint import pprint

print("######### args (producer) #############")
pprint(args)
print("######### kwargs (producer) #############")
pprint(kwargs)
# TODO: this is the producer side. here we can add data from args/kwargs to the span.

# Do not create a span when the task is a Celery Beat task
# (Because we do not have a transaction in that case)
span_mgr = (
Expand Down Expand Up @@ -272,6 +280,17 @@ def _wrap_tracer(task, f):
def _inner(*args, **kwargs):
# type: (*Any, **Any) -> Any
with isolation_scope() as scope:

print("######### args (consumer) #############")
print(args)
print("######### kwargs (consumer) #############")
print(kwargs)

print("######### task #############")
print(task.request.retries)
# TODO: this is where the consumer picks up the task and processes it.
# in the args you find a lot of information about the task that can be added to the transaction

scope._name = "celery"
scope.clear_breadcrumbs()
scope.add_event_processor(_make_event_processor(task, *args, **kwargs))
Expand Down Expand Up @@ -323,6 +342,11 @@ def _wrap_task_call(task, f):
@wraps(f)
def _inner(*args, **kwargs):
# type: (*Any, **Any) -> Any

print("######### args (task call) #############")
print(task.request.retries)
print("######### kwargs (task call) #############")
print(kwargs)
try:
return f(*args, **kwargs)
except Exception:
Expand Down