Diff for "LoggingOopses"

Not logged in - Log In / Register

Differences between revisions 6 and 10 (spanning 4 versions)
Revision 6 as of 2009-10-29 06:55:39
Size: 4067
Editor: jtv
Comment:
Revision 10 as of 2009-10-29 07:26:12
Size: 5076
Editor: jtv
Comment:
Deletions are marked like this. Additions are marked like this.
Line 8: Line 8:
 * Your Launchpad login name is "me."
Line 19: Line 20:
The first thing you do is pick a code for your oopses. Oops codes should be: The first thing you do is pick a code for your oopses. The code is included in the file names for oops reports, and will be the first indication that an oops was generated by your script.

Oops codes should be:
Line 88: Line 91:
You need to add configuration items to the production configs as well. Make your changes in a branch of {{{lp-production-configs}}}, separate from the {{{bug-999999}}} branch: You need to add configuration items to the production configs as well. Make your changes in a branch of {{{lp-production-configs}}}, separate from the {{{bug-999999}}} branch.

This is not a regular {{{launchpad}}} branch but once from a separate project, so create your local branch somewhere ''outside'' the directory (usually called {{{lp-branches}}}) where you keep your regular Launchpad branches! So
:
Line 91: Line 96:
bzr branch lp:~launchpad-pqm/lp-production-configs/trunk production-configs-bug-999999 cd ~/canonical
# (Or wherever, as long as it isn't where your Launchpad branches are.)

# Set up a place for lp-production-configs branches.
mkdir -p lp-production-configs
cd lp-production-configs
bzr branch lp:~launchpad-pqm/lp-production-configs/trunk

# Create your working branch.
bzr branch trunk production-configs-bug-999999
cd production-configs-bug-999999
Line 108: Line 123:
Now propose this branch for merging and get it reviewed. Once it's approved, submit to PQM for landing. Commit the changes and push your branch:
{{{
bzr push lp:~me/lp-production-configs/production-configs-bug-999999
}}}

Now propose this branch for merging into {{{lp:~launchpad-pqm/lp-production-configs}}}. This is not one of the default options; select ''Other:'' and paste the branch URL.

'''TODO: Who needs to review this branch?'''

Once the merge proposal has been approved, submit to PQM for landing.

Logging Oopses

WARNING: Work in progress. Needs improvement. If you think you know better, you probably do—so hit Edit!

This page describes how to add oops logging to your script. All fatal errors that need operator or developer attention should be logged as oopses.

Assumptions for examples:

  • Your Launchpad login name is "me."
  • The script you're working on is called frobnicate.

  • Your oopses have a prefix code of FROB.
  • Adding the oops logging is fixing bug 999999.
  • You're working in a branch of devel or db-devel called bug-999999.

Where you see these in the examples, replace them with whatever you've got.

Choosing an oops code

TODO: How exactly are oops codes chosen?

The first thing you do is pick a code for your oopses. The code is included in the file names for oops reports, and will be the first indication that an oops was generated by your script.

Oops codes should be:

  • All upper-case ASCII letters: [A-Z]+

  • Short, typically 2—4 letters.
  • Unique.

Code

The oops logging machinery comes from Zope, and is lightly extended in Lazr. It was designed for web applications, so expect some twists and turns as you try to squeeze a script error into the mould of a web request.

TODO: Verify that bit of possible nonsense.

TODO: Describe what's needed in the code.

Configuration

In your branch

You'll need to add some configuration items to the configuration files in configs/. This is in the bug-999999 branch.

TODO: Refer to configs documentation.

Your script must have a configuration section in configs/schema-lazr.conf. It should probably look a lot like this:

[frobnicate]
dbuser: frobnicate
storm_cache: generational
storm_cache_size: 500

If the section does not exist yet, this snippet should be a good start for creating it.

To this section, add blank default config items for your oopses:

oops_prefix: none
error_dir: none
copy_to_zlog: false

TODO: Explain what these do.

TODO: Can map multiple scripts' oopses to one error_dir.

The specific values will go into specific configs for various setups. Here, if the configuration files do not have frobnicate sections, just create them by adding the header:

[frobnicate]

In configs/development/launchpad-lazr.conf add these to the frobnicate section:

oops_prefix: FROB
error_dir: /var/tmp/frobnicate.test

Note the "T" prefix to the oops code, and the ".test" suffix to the oops directory.

Similarly, in configs/testrunner/launchpad-lazr.conf, under in the frobnicate header, add:

oops_prefix: TFROB

The testrunner configuration is derived from the development one, so no need to specify the same error_dir again here.

Once you've configured and programmed your oopses, you can run your tests to trigger them and you will see the oops reports appearing in /var/tmp/frobnicate.test/, neatly categorized by date. Since they're in /var/tmp/, they'll be cleaned up on reboot.

In the production world

You need to add configuration items to the production configs as well. Make your changes in a branch of lp-production-configs, separate from the bug-999999 branch.

This is not a regular launchpad branch but once from a separate project, so create your local branch somewhere outside the directory (usually called lp-branches) where you keep your regular Launchpad branches! So:

cd ~/canonical
# (Or wherever, as long as it isn't where your Launchpad branches are.)

# Set up a place for lp-production-configs branches.
mkdir -p lp-production-configs
cd lp-production-configs
bzr branch lp:~launchpad-pqm/lp-production-configs/trunk

# Create your working branch.
bzr branch trunk production-configs-bug-999999
cd production-configs-bug-999999

Now make your changes in production-configs-bug-999999. Add the following snippet to staging-lazr.conf, in the config section for your script. If the section did not exist, create an empty one.

oops_prefix: SFROB
error_dir: /srv/staging.launchpad.net/staging-logs/frobnicate

TODO: A different hostname may be appropriate.

To production/launchpad-lazr.conf, add this to the frobnicate section:

oops_prefix: FROB
error_dir: /srv/launchpad.net/production-logs/frobnicate

Commit the changes and push your branch:

bzr push lp:~me/lp-production-configs/production-configs-bug-999999

Now propose this branch for merging into lp:~launchpad-pqm/lp-production-configs. This is not one of the default options; select Other: and paste the branch URL.

TODO: Who needs to review this branch?

Once the merge proposal has been approved, submit to PQM for landing.

TODO: How to submit to PQM?

TODO: What's the loadtest config for?

LoggingOopses (last edited 2011-10-31 10:43:45 by lifeless)