[WIP] update celery context
The current implementation of the celery client prevents the ability to pass context on a per process basis. We have found that being able to tag and filter based on the arguments or key word arguments is immensely helpful in tracking down where failures are in the system.
@ryan-s Mind adding a small test? :) I forgot starting the comment with a thank you.
@ryan-s It's hard to see from the logs (a problem with xdist maybe), but this is still failing three tests:
_______________________________________________________________________ CeleryTestCase.test_context_args ________________________________________________________________________
Traceback (most recent call last):
File "/Users/ashwoods/Documents/Code/sentry/raven-python/tests/contrib/test_celery.py", line 53, in test_context_args
assert self.client.context
AssertionError: assert <Context: {}>
+ where <Context: {}> = <raven.utils.testutils.InMemoryClient object at 0x10eac3e48>.context
+ where <raven.utils.testutils.InMemoryClient object at 0x10eac3e48> = <tests.contrib.test_celery.CeleryTestCase testMethod=test_context_args>.client
______________________________________________________________________ CeleryTestCase.test_context_kwargs _______________________________________________________________________
Traceback (most recent call last):
File "/Users/ashwoods/Documents/Code/sentry/raven-python/tests/contrib/test_celery.py", line 60, in test_context_kwargs
assert self.client.context
AssertionError: assert <Context: {}>
+ where <Context: {}> = <raven.utils.testutils.InMemoryClient object at 0x10e68d048>.context
+ where <raven.utils.testutils.InMemoryClient object at 0x10e68d048> = <tests.contrib.test_celery.CeleryTestCase testMethod=test_context_kwargs>.client
__________________________________________________________________________ CeleryTestCase.test_simple ___________________________________________________________________________
Traceback (most recent call last):
File "/Users/ashwoods/Documents/Code/sentry/raven-python/tests/contrib/test_celery.py", line 36, in test_simple
assert event['culprit'] == 'dummy_task'
KeyError: 'culprit'
@ashwoods Ill be circling back to this next week. Getting the client to update the context in the logging with the mocks has been problematic. It's also becoming clear that Im conflating the logger and the celery handlers concepts, so I'm going to look to see if there is a more elegant way to handle this.
@ryan-s thx, let me know if there is anything I can do to help.