-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Debugging and Performance Profiling
Are you seeing an error on an Open Library page?
The first thing you should do is check the applications streaming error logs:
docker compose logs --tail=10 -f web
Next, you can add ?debug=true
to the problematic url in order to reveal the stack trace or profile data.
This trick is especially useful when you see a nebulous error like:
"Sorry. There seems to be a problem with what you were just looking at. We've noted the error 2019-02-05/193353339339 and will look into it as soon as possible. Head for home?"
If the request is a POST, use the browser to inspect the HTML form element and add ?debug=true
to the action
url. If/when the request fails, you should see a useful stack trace.
BETA: See https://github.com/internetarchive/openlibrary/pull/2097
Using a debugger is one of the best ways to understand how code works and to find bug fixes. We use VS Code (along with its Python extension) to remote debug into the docker container; we can't use regular debugging because the docker container behaves like a virtual machine.
To use:
-
docker compose up -d
as usual and login as admin. (Note this has to be done before changing the docker-compose file; see https://github.com/internetarchive/openlibrary/issues/2122 ) - Open the repo in VS Code --
code .
- Edit around line 8 of
compose.yaml
to sayworkers 1
instead of4
docker compose up -d
- Go to http://localhost:8080/admin/attach_debugger and click "Start"
- Go to the debug panel (Ctrl+Shift+D) in VS Code, and click "Python: Attach"
- Debug!
Is a page taking a long time to load? Add _profile=true
to the url in order to include a profile report. This will give you a report of both the front-end (client side) and the back-end (server side) load times. For a more granular breakdown of the client, follow the developer tools guide in your respective browser, e.g. https://developers.google.com/web/tools/chrome-devtools/network-performance.
You can run a webpagetest via https://www.webpagetest.org/result/180907_EQ_f494162d3f798fbe574d1350cf68de89 in order to obtain a better picture of openlibrary.org's performance on various devices given constraints
Getting Started & Contributing
- Setting up your developer environment
- Using
git
in Open Library - Finding good
First Issues
- Code Recipes
- Testing Your Code, Debugging & Performance Profiling
- Loading Production Site Data ↦ Dev Instance
- Submitting good Pull Requests
- Asking Questions on Gitter Chat
- Joining the Community Slack
- Attending Weekly Community Calls @ 9a PT
- Applying to Google Summer of Code & Fellowship Opportunities
Developer Resources
- FAQs: Frequently Asked Questions
- Front-end Guide: JS, CSS, HTML
- Internationalization
- Infogami & Data Model
- Solr Search Engine Manual
- Imports
- BookWorm / Affiliate Server
- Writing Bots
Developer Guides
- Developing the My Books & Reading Log
- Developing the Books page
- Understanding the "Read" Button
- Using cache
- Creating and Logging into New Users
- Feature Flagging
Other Portals
- Design
- Librarianship
- Communications
- Staff (internal)
Legacy
Old Getting Started
Orphaned Editions Planning
Canonical Books Page