Hi Matt, I'm not aware of any community maintained solution for this. However, interestingly, what you've suggested (including some contextual stack information in a query comment) is something that was suggested by Cal Henderson at the very first DjangoCon.
I'm not sure Ned's "global request object" is necessary to make this happen, though; it should be enough to just get the current stack at the time the database code is invoked, roll back a few frames until you hit user-space code, and use that file and line number as the comment. I'd certainly be interested in seeing a patch that does this. Yours, Russ Magee %-) On Tue, Oct 23, 2012 at 4:52 AM, Matt McClure <matthewlmccl...@gmail.com>wrote: > From time to time the pager goes off, and I need to find the source of a > given query hitting MySQL. It might be poorly performing, or flooding MySQL > in high volume. In any case, I'd love some instrumentation that could point > me at a lead in my Django site that's more specific than a given user or IP > address. I'm considering adding a comment to the query that includes some > part of the call stack, possibly based on Ned Batchelder's "global request" > code[1]. Is there a community maintained solution to similar problems > already in the wild? Or failing that, an approach that the community would > like to include in Django? > > [1]: http://nedbatchelder.com/blog/201008/global_django_requests.html > > -- > Matt McClure > http://www.matthewlmcclure.com > http://www.mapmyfitness.com/profile/matthewlmcclure > > -- > You received this message because you are subscribed to the Google Groups > "Django developers" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/django-developers/-/PAcaIZ8CvlUJ. > To post to this group, send email to django-developers@googlegroups.com. > To unsubscribe from this group, send email to > django-developers+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-developers?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.