Difference between revisions of "Stats Design"
From Dreamwidth Notes
m (Add category) |
(→Displaying statistics: Sync with current committed code status) |
||
Line 59: | Line 59: | ||
== Displaying statistics == | == Displaying statistics == | ||
− | * [http://hg.dwscoalition.org/dw-free/file/tip/ | + | * [http://hg.dwscoalition.org/dw-free/file/tip/views/stats/site.tt views/stats/site.tt] (public stats) |
− | * [http://hg.dwscoalition.org/dw-free/file/tip/ | + | * [http://hg.dwscoalition.org/dw-free/file/tip/views/admin/stats.tt views/admin/stats.tt] (restricted stats) |
+ | * [http://hg.dwscoalition.org/dw-free/file/tip/cgi-bin/DW/Controller/SiteStats.pm DW::Controller::SiteStats.pm] (the stats page controller for both public and restricted stats) | ||
+ | * [http://hg.dwscoalition.org/dw-free/file/tip/cgi-bin/DW/Controller/Graphs.pm DW::Controller::Graphs.pm] (the stats graphs controller for both public and restricted stats) | ||
− | + | [Category: Development]] | |
− | + | ||
− | + |
Revision as of 15:32, 17 September 2010
This is a a loosely organized collection of notes and links for the Stats feature design. (Note: this is for the new stats system only - there's an existing legacy system too.)
Bug 2717 and its dependent bugs
Contents
Table definitions
CREATE TABLE statkeylist ( statkeyid INT UNSIGNED NOT NULL AUTO_INCREMENT, name VARCHAR(255) DEFAULT NULL, PRIMARY KEY (statkeyid), UNIQUE KEY (name) ) CREATE TABLE site_stats ( category_id INT UNSIGNED NOT NULL, key_id INT UNSIGNED NOT NULL, insert_time INT UNSIGNED NOT NULL, VALUE INT UNSIGNED NOT NULL, -- FIXME: This is good for retrieving data for a single category+key, but -- maybe not as good if we want all keys for the category, with a limit on -- time (ie, last 5 entries, or last 2 weeks). Do we need an extra index? INDEX (category_id, key_id, insert_time) )
Storing and retrieving statistics
Statistics items
Collecting statistics
This works by massaging, aggregating, and or compiling (as appropriate) data from various places and storing the results using DW::StatStore.
1. etc/stats-collection.conf should contain something like:
## collect and store all stats under the accounts category ## hangs if you don't enclose the asterisk in quotes # accounts: "*" ## collect and store only these stats under the accounts category # accounts: [ identity, personal, redirect ] accounts: "*" active: "*" paid: "*"
2. bin/worker/stats-collection is the utility that handles stats collection. Run at least once per 24 hours, either from your crontab or by listing it in etc/workers.conf.
3. (only needed if you chose to use etc/workers.conf): add a line to the "all" section reading:
stats-collection: 1
Displaying statistics
- views/stats/site.tt (public stats)
- views/admin/stats.tt (restricted stats)
- DW::Controller::SiteStats.pm (the stats page controller for both public and restricted stats)
- DW::Controller::Graphs.pm (the stats graphs controller for both public and restricted stats)
[Category: Development]]