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

[celery] fixing ddtrace-run broke celery support #469

Merged
merged 2 commits into from
May 29, 2018

Conversation

alxch-
Copy link
Contributor

@alxch- alxch- commented May 22, 2018

This PR solves this issue : when patching celery with the ddtrace-run command, the import fails silently and Celery is not patched. The exception raised is 'module' object has no attribute 'argv', stemming from the way our tracer patches libraries: argv is not passed, and causes the fail celery import as the library needs it.

The PR replaces argv when it is required.

I have tested this change with a Celery app and a pymysql app, it seems to work fine.

@alxch- alxch- requested review from SeanOC and palazzem May 22, 2018 20:23
@alxch- alxch- added this to the 0.12.1 milestone May 22, 2018
@alxch-
Copy link
Contributor Author

alxch- commented May 22, 2018

After a discussion with @SeanOC we thought about a way to test if this fix would break a CLI with arguments. I tested it with this code in a test.py file:

import sys
print(sys.argv)

And then I ran the command : ddtrace-run test.py foo bar. The result is ['test.py', 'foo', 'bar']. So it confirms that this fix does not break CLI when used with ddtrace-run, and that this change should be fine.

Copy link

@SeanOC SeanOC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants