1
= Daily summary generated from the OOPS database =
3
The analyse script accepts a parameter to generate OOPS summaries directly
6
>>> from oopstools.oops.helpers import generate_summary, load_database
7
>>> prefixes = ["S", "X"]
8
>>> from datetime import date
9
>>> start_date = date(2007, 02, 22)
10
>>> end_date = date(2010, 01, 8)
12
Before generating the summary, let's load the sample data into the database.
14
>>> load_database(start_date, end_date)
15
'Oopses loaded into the database.'
17
And add a bug to the oops database so we can test that a linked bug is
18
correctly displayed in the summary.
20
>>> from oopstools.oops.models import Oops
21
>>> oops = Oops.objects.get(oopsid__exact='OOPS-689S4')
22
>>> oops.oopsinfestation.bug = 2112
23
>>> oops.oopsinfestation.save()
25
Now let's generate the summary.
27
>>> webapp_summary = generate_summary(
28
... prefixes, from_date=start_date, to_date=end_date)
30
>>> from oopstools.oops.helpers import get_section_contents
31
>>> print get_section_contents("Statistics", webapp_summary)
33
* Analyzed period: ...
35
* Average OOPSes per day: ...
40
* 0 Informational Only Errors
41
* 0 User Generated Errors
42
* 0 Unauthorized Errors
45
>>> print get_section_contents("Top 10 Durations", webapp_summary)
46
26.46s OOPS-689S4 FooBar:+questions
47
20.67s OOPS-689S6 FooBar:+bug-text
48
0.28s OOPS-1308X1 https://launchpad.dev/foobar
50
>>> print get_section_contents("Top 10 Statement Counts", webapp_summary)
51
14 OOPS-1308X1 https://launchpad.dev/foobar
52
4 OOPS-689S6 FooBar:+bug-text
53
3 OOPS-689S4 FooBar:+questions
55
4203 OOPS-969XMLP1805 MailingListApplication:MailingListAPIView
56
260 OOPS-894EB74 Archive:+index
57
111 OOPS-1311EC295 Product:+code-index
58
107 OOPS-689S6 FooBar:+bug-text
59
72 OOPS-689S80 FooBarPackage:+translate
62
>>> print get_section_contents("Time Out Counts by Page ID", webapp_summary)
65
>>> print get_section_contents("All Exceptions", webapp_summary)
67
>>> print get_section_contents("All Time Outs", webapp_summary)
69
>>> print get_section_contents("All Soft Time Outs", webapp_summary)
71
Other: 1 Robots: 1 Local: 1
72
1 https://answers.../questions/+index (FooBar:+questions)
75
>>> print get_section_contents(
76
... "All Informational Only Errors", webapp_summary)
78
>>> print get_section_contents("All User Generated Errors", webapp_summary)
80
>>> print get_section_contents("All Unauthorized Errors", webapp_summary)
83
>>> print get_section_contents("All Pages Not Found", webapp_summary)
87
Let's remove the bug from the database, so it won't change the behaviour of
90
>>> oops.oopsinfestation.delete()
92
And reset the database.
94
>>> from oopstools.oops.helpers import reset_database
96
'Oops, DBOopsRootDirectory and Infestation deleted.'