Use Django 2.0 DB instrumentation too#358
Use Django 2.0 DB instrumentation too#358zoidyzoidzoid wants to merge 18 commits intocensus-instrumentation:masterfrom
Conversation
|
@zoidbergwill if you add some tests to show |
|
Sorry for the delay. Will update this week. |
| span) | ||
|
|
||
| if django.VERSION >= (2,): | ||
| connection.execute_wrappers.append(self._trace_db_call) |
There was a problem hiding this comment.
Would this re-append even if the connection already has self._trace_db_call?
I tested out locally and it seems like this is the case, I added a simple check to ensure it doesn't do so in a naive way (just checking if it is already in connection.execute_wrappers) although I'm sure there is a better way to do so.
There was a problem hiding this comment.
Possibly using https://docs.djangoproject.com/en/2.1/ref/signals/#connection-created might be appropriate?
|
@zoidbergwill, would you update the PR and fix the tests? I can review and get this merged. |
|
Hi @reyang Thanks, I'll take a look at updating this PR and addressing the comments and fixing the tests this week |
8026400 to
e26626f
Compare
|
I'm not sure where the source of googleapis/nox is, but we need to add Python 3.7 support to it. If someone can link it to me, I'm happy to make a PR to do it. |
|
Also, a caveat of the current Travis CI and Circle CI config, with my current changes which allow people to use Django 1.11 or 2, we're not testing both, which we should. |
|
Whoops, I need to fix Django 1 support. |
…encensus-python into django-db-instrumentation
…rgwill/opencensus-python into django-db-instrumentation
|
There are two CI error:
|
|
@zoidbergwill thanks for working on this! Regarding supporting Python3.7 in CI, and testing against both Django v1 and v2, let's address them separately. I think we need a major improvement on the CI process:
@c24t and I are working on GA release, we would definitely love to make improvements once we get out of the fire. For this PR, you can focus on v2 test. I think the downside is that we're lacking CI protection for Django v1 for a while. |
|
Sorry, I've been lazily pushing to test stuff on CircleCI because I was lazy to get a |
|
I'm working on fixing the tests for Django 2.0+ and 1.11. I'll take a look at code coverage today or tomorrow too. With the other work towards GA and other improvements, do we have issues for all of them? I'd be keen to help. Problem 1 and 2 would be awesome to improve, since running tests faster is always useful, and having more thorough feedback about what's failing and passing in an overview would be great. Re: problem 3
I saw #202 covers similar stuff, which would be great for the Django support too. Using a Travis CI matrix would help too. For problem 4, that sounds useful to improve and fix, also making it easier to run certain system tests with less configuration would be great. |
|
@zoidbergwill you can find all the GA related issues using the |
|
@zoidbergwill would you fix the coverage test failures? Thanks. |
…encensus-python into django-db-instrumentation
|
@reyang Sorry about the delay. I'll work on fixing the coverage test failures this week. |
…encensus-python into django-db-instrumentation
|
I'm struggling to get my tests to pass locally, and/or improving the coverage. From my code and tests it should be 100%. I think for some reason my tracer isn't initialising, but I'll have another look later. |
|
Kindly paging @timgraham to take a look too. |
|
What's the policy on Django version support? At this point, Django < 1.11 is unsupported (no security updates) so I'll do a detailed review after that decision and perhaps send a PR with cleanups that can precede this. |
We intend to follow https://www.djangoproject.com/download/#supported-versions - the Django version we support in OpenCensus should align with the supported (including LTS) Django versions. |
|
Great. I created #694 with clean ups to remove support for Django < 1.11. As far as I can tell, the remaining change is this PR don't really "add support for Django 2.0+" but merely add a new feature that requires Django 2.0+. I haven't seen anything obvious in the current code that won't work with Django 2.0, 2.1, or 2.2, but I'll check the tests with those versions. |
|
This PR has been superseded by #697. |
|
Not entirely. There's a a new feature in this PR (see the changes to the middleware) that hasn't been implemented in #697. |
|
@timgraham you're right, there is database part. @zoidbergwill please rebase and reopen the PR if you plan to continue. Thanks! |
Closes #356
I'm not sure whether we want to use the
{mysql,postgresql,sqlite3}.queryor a standardsql.query?I'm also probably missing some other useful attributes we could add, like affected rows and last inserted ID.
Though it doesn't seem like we have recommended/standard attributes for databases/sql attributes, yet.
I also still need to add tests, and make it fail gracefully on Django <2.0.