Skip to content

Add support for tornado.web #661

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

Merged
merged 34 commits into from
Jan 23, 2020
Merged

Add support for tornado.web #661

merged 34 commits into from
Jan 23, 2020

Conversation

basepi
Copy link
Contributor

@basepi basepi commented Dec 6, 2019

Figured I'd open a draft even though this is barely more than a skeleton so far.

What does this pull request do?

Adds Tornado support (or it will, anyway, once it's done)

Related issues

Refs #598

Copy link
Contributor

@beniwohli beniwohli left a comment

Choose a reason for hiding this comment

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

Great stuff so far!

Copy link
Contributor

@beniwohli beniwohli left a comment

Choose a reason for hiding this comment

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

I like the creates_transactions flag! Good idea. And great job on adding sorely needed comments to AbstractIntrumentedModule!

just a couple more comments :) I'll stop reviewing now until you think it's ready for review

@elastic elastic deleted a comment from houndci-bot Jan 16, 2020
@elastic elastic deleted a comment from houndci-bot Jan 16, 2020
@elastic elastic deleted a comment from houndci-bot Jan 16, 2020
@elastic elastic deleted a comment from houndci-bot Jan 16, 2020
@basepi
Copy link
Contributor Author

basepi commented Jan 16, 2020

This is code complete. I need to work out our support matrix, fix up the test suite (for async errors in py2 mostly), and write up some documentation.

The primary instrumentation point, tornado.web.RequestHandler._execute,
is `async def` in 6.0, and `def` with `@gen.coroutine` in 5.0. I'm
not sure how to decorate both at the moment, so until a community member
asks we can just support 6.0+
@basepi basepi marked this pull request as ready for review January 18, 2020 02:27
@basepi
Copy link
Contributor Author

basepi commented Jan 18, 2020

This is ready for review! We only support tornado 6.0+ (see reasons here.

@beniwohli I'm not sure what's going wrong with the tests -- I added all the exclusions to the jenkins-exclude file, but I'm still getting a bunch of syntax errors in non-3.7 tests due to async def. What am I missing?

@basepi basepi mentioned this pull request Jan 18, 2020
@beniwohli
Copy link
Contributor

beniwohli commented Jan 18, 2020

@basepi the SyntaxErrors are due to pytest's test discovery. Even when excluded via Jenkins excludes, pytest will still cause Python to parse the code. You have to tell pytest to ignore the the code. We currently do this for all files that are prefixed with py3_, as well for all files that are in an asyncio folder, including subfolders.

if [[ "$$PYTHON_VERSION" =~ ^(3.5|3.6|3.7|3.8|nightly|pypy3)$$ ]] ; then \
py.test -v $(PYTEST_ARGS) $(PYTEST_MARKER) $(PYTEST_JUNIT); \
else py.test -v $(PYTEST_ARGS) $(PYTEST_MARKER) $(PYTEST_JUNIT) --ignore-glob='*/py3_*.py' --ignore-glob='*/asyncio/*'; fi

If you move the Tornado tests into tests/contrib/asyncio, it should work.

I'll do a proper code review on Monday :)

Copy link
Contributor

@beniwohli beniwohli left a comment

Choose a reason for hiding this comment

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

Awesome work!

@basepi
Copy link
Contributor Author

basepi commented Jan 21, 2020

Pretty sure the remaining test failures are the same ones as are failing on master, but I'm going to wait until we get them fixed because I like green. :)

@beniwohli
Copy link
Contributor

@basepi I think most failures are due to an import error: https://apm-ci.elastic.co/blue/organizations/jenkins/apm-agent-python%2Fapm-agent-python-mbp/detail/PR-661/19/pipeline/158#step-1296-log-1482

Looks like you might need to move the import of elasticapm.contrib.tornado.utils into the call methods. Not pretty, but I don't see a better solution.

@basepi
Copy link
Contributor Author

basepi commented Jan 21, 2020

Good catch. I saw those client errors and stopped reading before I got to the "good ones."

Fixed now, I think.

Copy link
Member

@bmorelli25 bmorelli25 left a comment

Choose a reason for hiding this comment

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

Docs look good. Sorry for the delay!

@basepi basepi merged commit 307f34d into elastic:master Jan 23, 2020
@beniwohli
Copy link
Contributor

Awesome work getting this done @basepi!

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

Successfully merging this pull request may close these issues.

3 participants