Commit 271833f
committed
Make Caliper an optionally loaded plugin that interfaces with webwork2 via hooks.
This means that the Caliper code does not need to be directly in the
primary webwork2 code, and those that don't use Caliper don't have to
even have it checking to see if it is enabled. Just leave the
`Mojolicious::WeBWorK::Plugin::Caliper` plugin commented out in
`webwork2.mojolicious.yml`. If you want to allow the usage of Caliper on
your server, then uncomment that plugin. Caliper can be configured per
course in `course.conf` files if the plugin is enabled.
This `hook` approach is also extendable. Other plugins, even those not
directly in the webwork2 repository could utilize these hooks. The
hooks added in this pull request are when user logs in or out, when an
answer is submitted in a regular assignment, and when a page change,
preview, or submission occurs in a test. Additional hooks could also be
added for further extendability with plugins in the future.
The `$caliper{base_url}` option no longer exists. Those using Caliper
just need to make sure that the `$server_root_url` and `$webwork_url`
are set correctly in `site.conf`. The point is that anyone using
webwork2 should do that anyway, so the `$caliper{base_url}` setting was
redundant.
The Caliper packages are heavily updated. The packages all use
signatures. Instead of passing both the course environment and database
handle everywhere, just pass the controller which has both of those. In
addition, doing so gives access to do things better. For example, the
environment variable usage (`HTTP_X_FORWARDED_FOR`, `REMOTE_ADDR`,
`HTTP_CLIENT_IP`, `HTTP_USER_AGENT`, and `HTTP_HOST` in
`Caliper/Entity.pm` and `HTTP_REFERER` in `Caliper/Event.pm`) was
clearly broken and not working since the switch to Mojolicious. Since
the controller is now available in those places the things those
environment variables used to provide with modperl and apache can now be
obtained from the controller.
`Mojo::UserAgent` is used instead of `HTTP::Async`. This is the only
place that the outdated and unmaintained `HTTP::Async` package is used.
So drop that dependency.
The UUIDs used now use `create_uuid_as_string` from the `UUID::Tiny`
package, instead of the `Data::UUID` package and essentially
`Data::UUID->new->create_str`. This is done for two reasons. First,
this is the only use of this dependency. So that is another dependency
not needed by webwork2. Second, the Caliper specification recommends
using version 4 UUIDs and `Data::UUID` does not generate version 4
UUIDs, but `UUID::Tiny` does.
The problem source is no longer sent in Caliper events. That really
should never have been done. That is a large amount of data and is not
needed. This means that even those that do not use Caliper have to
endure the additional server load required to transmit that back from
the rendering process to the main process. It also makes the Caliper
events much larger in size than they should be. The source file is still
sent and that really should be all that is needed. The source can be
looked up in the file.
Other than not sending the problem source, everything else sent by the
Caliper implementation is the same. So the implementation still meets
the 1EdTech Caliper specification as much as it did before (the problem
source is certainly not something the specification insists on or is
even considered in the specification). See https://www.imsglobal.org/spec/caliper/v1p2.1 parent c1a3ac1 commit 271833f
16 files changed
Lines changed: 553 additions & 678 deletions
File tree
- bin
- conf
- lib
- Caliper
- Mojolicious/WeBWorK/Plugin
- WeBWorK
- ContentGenerator
- Utils
- templates/ContentGenerator
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
113 | 112 | | |
114 | 113 | | |
115 | 114 | | |
| |||
133 | 132 | | |
134 | 133 | | |
135 | 134 | | |
136 | | - | |
137 | 135 | | |
138 | 136 | | |
139 | 137 | | |
| |||
231 | 229 | | |
232 | 230 | | |
233 | 231 | | |
234 | | - | |
235 | | - | |
| 232 | + | |
| 233 | + | |
236 | 234 | | |
237 | | - | |
238 | | - | |
239 | | - | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
240 | 238 | | |
241 | | - | |
| 239 | + | |
242 | 240 | | |
243 | | - | |
| 241 | + | |
244 | 242 | | |
245 | | - | |
| 243 | + | |
246 | 244 | | |
247 | 245 | | |
248 | 246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | 74 | | |
76 | 75 | | |
77 | 76 | | |
| |||
94 | 93 | | |
95 | 94 | | |
96 | 95 | | |
97 | | - | |
98 | 96 | | |
99 | 97 | | |
100 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | 132 | | |
139 | 133 | | |
140 | 134 | | |
| |||
283 | 277 | | |
284 | 278 | | |
285 | 279 | | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | 280 | | |
292 | 281 | | |
293 | 282 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
721 | 721 | | |
722 | 722 | | |
723 | 723 | | |
724 | | - | |
725 | | - | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
731 | 735 | | |
732 | 736 | | |
733 | | - | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
742 | | - | |
743 | | - | |
744 | | - | |
745 | | - | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
746 | 753 | | |
747 | 754 | | |
748 | 755 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
| 2 | + | |
9 | 3 | | |
10 | 4 | | |
11 | 5 | | |
12 | | - | |
| 6 | + | |
13 | 7 | | |
14 | | - | |
15 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
16 | 11 | | |
17 | 12 | | |
18 | 13 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 14 | + | |
| 15 | + | |
29 | 16 | | |
30 | | - | |
31 | | - | |
| 17 | + | |
32 | 18 | | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 19 | + | |
| 20 | + | |
37 | 21 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 22 | + | |
44 | 23 | | |
45 | 24 | | |
46 | 25 | | |
0 commit comments