Merge lp://staging/~gary/launchpad/lsprof-on-demand into lp://staging/launchpad

Proposed by Gary Poster
Status: Merged
Approved by: Robert Collins
Approved revision: no longer in the source branch.
Merged at revision: 11465
Proposed branch: lp://staging/~gary/launchpad/lsprof-on-demand
Merge into: lp://staging/launchpad
Diff against target: 1324 lines (+840/-215)
11 files modified
.bzrignore (+1/-0)
configs/development/apidoc-configure-normal.zcml (+6/-0)
configs/development/launchpad-lazr.conf (+3/-0)
lib/canonical/config/schema-lazr.conf (+8/-2)
lib/canonical/launchpad/doc/profiling.txt (+109/-175)
lib/canonical/launchpad/icing/style-3-0.css.in (+28/-1)
lib/canonical/launchpad/webapp/errorlog.py (+16/-12)
lib/lp/services/profile/configure.zcml (+7/-2)
lib/lp/services/profile/profile.pt (+77/-0)
lib/lp/services/profile/profile.py (+131/-23)
lib/lp/services/profile/tests.py (+454/-0)
To merge this branch: bzr merge lp://staging/~gary/launchpad/lsprof-on-demand
Reviewer Review Type Date Requested Status
Robert Collins (community) Approve
Review via email: mp+33849@code.staging.launchpad.net

Commit message

add profiling-in-demand via a ++profile++ URL hook

Description of the change

= Intro =

This branch adds profiling-in-demand via a ++profile++ URL hook, like ++debug++ and ++oops++.

To test, run ``./bin/test -vvm lp.services.profile.tests`` and ``./bin/test -vvt profiling.txt``.

To QA (please do), go to a URL like https://launchpad.dev/++profile++ or https://launchpad.dev/++profile++show/~mark/+archive/ppa and see what you get. Hopefully the help docs that these URLs display will let you help you figure out what is going on, and see what else to experiment with. Also see the profiling.txt document for help, which is also available in apidoc.launchpad.dev in the Launchpad part of the Books section.

This is a significantly over-large diff. I'm sorry. Suggestions on how I could have divided it up are welcome. Requests to actually do so will be acted upon. :-)

I did get Curtis to review and approve some individual parts of this work. I will identify these below.

= Lint =

  ./configs/development/launchpad-lazr.conf
        96: Line exceeds 78 characters.
       115: Line exceeds 78 characters.
       126: Line exceeds 78 characters.
  ./lib/canonical/config/schema-lazr.conf
       493: Line exceeds 78 characters.
       975: Line exceeds 78 characters.

I brought these up with Curtis. He said not to change them. He is adjusting the linter to ignore over-long lines in these files.

  ./lib/canonical/launchpad/icing/style-3-0.css.in
      LOTSA LINES: Line exceeds 78 characters.

I started looking at these many lines. Some of them were example URLs. Others were comments following some sort of regular pattern. I decided I really didn't want to touch that. None of the lines are mine, in any case.

  ./lib/lp/services/profile/profile.pt
         6: junk after document element

This is a file of an HTML snippet. I assume that's why the linter is unhappy. Is it what it is.

= File-by-File Comments =

.bzrignore

  The new addition is the output of chameleon, a page template
  implementation to which we plan to switch, and which I used because it
  was convenient for a template.

configs/development/apidoc-configure-normal.zcml

  This adds the revised file to the apidoc Books section.

configs/development/launchpad-lazr.conf

  As is explained in other files, this means that profiling is allowed
  with the ++profile++ url segment in development.

lib/canonical/config/schema-lazr.conf

  (No comment)

lib/canonical/launchpad/doc/profiling.txt

  I converted this to ReST and tried to make the parts of the document that
  described the pieces I was changing more like an end-user help document.
  The actual tests here are now part of the new unit tests.

lib/canonical/launchpad/icing/style-3-0.css.in

  Curtis has reviewed and approved of the placement and abstract content of
  this CSS (though he did not see the actual visual result).

lib/canonical/launchpad/webapp/errorlog.py

  Most of the changes in this file are to make lint happy.

  The ony real changes are that calling "raising" and "handling" returns the
  generated OOPS. That has handy and seemed reasonable.

lib/lp/services/profile/configure.zcml

  I don't need the "for" lines because I do the declaration in-line in the
  Python now.

lib/lp/services/profile/profile.pt

  This is a raw Chameleon page template. These templates have Python expressions as their default, which was convenient.

lib/lp/services/profile/profile.py

  The comments in get_desired_profile_actions explain what I consider to be
  the more unusual choices I made.

lib/lp/services/profile/tests.py

  I appear to have gotten tired of writing docstrings for the tests towards
  the end. I'm not sure if we require them. Lemme know if you want them.
  I tried to make the method names descriptive enough.

To post a comment you must log in.
Revision history for this message
Robert Collins (lifeless) wrote :

This is awesome, thanks for doing it. We discussed some stuff on IRC, but its all future-stuff. +1

review: Approve
Revision history for this message
Robert Collins (lifeless) wrote :

11:43 < lifeless> gary_poster: there was one other thing
11:43 < lifeless> the 'tests are not setting stuff up so ignore it' squicks me; I realise why, and the pragmatic need, but I'd like to be able to put a ratchet on those tests and eliminate the badness.
11:44 < gary_poster> lifeless: not clear what you mean yet?
11:44 < gary_poster> oh!
11:44 < gary_poster> yeah that was annoying
11:44 < gary_poster> what do you have in mind for ratcheting?
11:44 < lifeless> well
11:44 < lifeless> depends on how widespread it is I guess
11:45 < lifeless> if its only a few root causes, like some test helpers, we could just do warning.warn() in a branch, and iterate on the branch till its done.
11:45 < lifeless> if its more substantial, perhaps starting the test suite could empty a file
11:45 < lifeless> and each occurence be logged (one line per)
11:46 < lifeless> and the total number of lines reported at the end
11:46 < gary_poster> between a few and several. I have to run though. Please copy that in to the MP and I'll act on it tomorrow.
11:46 < lifeless> lint could report if that file is longer than N

This can be done in a separate branch; or just chat with me your monday about this (it affects other things in webapp.* too, I suspect). I was running into remarkable pain with a similar cause, and so was Martin Pool with his flags stuff.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.