Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add comments for args and kwargs #2962

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions sentry_sdk/integrations/celery/__init__.py
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