anarres (
anarres) wrote in
dw_dev_training2010-05-08 01:26 pm
Entry tags:
Questions about the statistics system
Hi all! I'm getting ready to start my GSoC project on Usage and Business Statistics, and I'm just starting to realize how much stuff I don't know! I hope this is the right place to post some questions about the statistics system:
1. How can I use the stats system modules in a perl script? I would like to write a simple script like this as a way of learning about how the stats system works:
--------------
use DW::StatStore;
use DW::StatData;
use DW::StatData::AccountsByType;
my $accounts_by_type = DW::StatData::AccountsByType->load_latest( DW::StatStore->get( "accounts" ) );
# MORE CODE...
--------------
but if I do this within my Dreamhack perl complains that it can't find the modules I asked it to use (even though exactly the same code works fine within /stats/site.bml!) I've tried adding an absolute path to the modules, but it turns out that these depend on a bunch of LJ modules which I can't find.
2. How can I get my Dreamhack to display /admin/stats.bml? (This is only displayed to users with admin priviledges).
3. What are 'crumbs'? I've seen this word in a couple of places, and I've no idea what it is.
4. Just to check, is it the case that if I'm editing a BML page, I should convert it to Template Toolkit?
5. /stats.bml uses the old legacy stats system - is it going to be replaced, or left as it is? If it's going to stay, should I add graphs to it (i.e. display the info on this page in graph form - apart from Age Distribution, which already has a graph)?.
1. How can I use the stats system modules in a perl script? I would like to write a simple script like this as a way of learning about how the stats system works:
--------------
use DW::StatStore;
use DW::StatData;
use DW::StatData::AccountsByType;
my $accounts_by_type = DW::StatData::AccountsByType->load_latest( DW::StatStore->get( "accounts" ) );
# MORE CODE...
--------------
but if I do this within my Dreamhack perl complains that it can't find the modules I asked it to use (even though exactly the same code works fine within /stats/site.bml!) I've tried adding an absolute path to the modules, but it turns out that these depend on a bunch of LJ modules which I can't find.
2. How can I get my Dreamhack to display /admin/stats.bml? (This is only displayed to users with admin priviledges).
3. What are 'crumbs'? I've seen this word in a couple of places, and I've no idea what it is.
4. Just to check, is it the case that if I'm editing a BML page, I should convert it to Template Toolkit?
5. /stats.bml uses the old legacy stats system - is it going to be replaced, or left as it is? If it's going to stay, should I add graphs to it (i.e. display the info on this page in graph form - apart from Age Distribution, which already has a graph)?.
no subject
require "$ENV{'LJHOME'}/cgi-bin/ljlib.pl";
(I copied that from one of the scripts in /bin)
2. You should be able to grant yourself admin privileges on your dev box by visiting the /admin page and looking at the options available.
3. I've never used crumbs, but my understanding is that LJ implemented them to track how users moved between different areas of the site. I don't know if DW is tracking them or not.
4. You don't have to, but in general, we are moving in that direction, so conversion would be a good thing. (I personally don't understand TT yet.)
5. I think that's a question for
Hope this helps!
Correction re #1
Re: Correction re #1
---
use lib "$ENV{LJHOME}/cgi-bin";
use StatData;
use StatStore;
my $accounts_by_type = DW::StatData::AccountsByType->load_latest( DW::StatStore->get( "accounts" ) );
---
and got the error: Undefined subroutine &LJ::MemCache::get called at /dreamhack/home/8214-anarres/dw/cgi-bin/LJ/Typemap.pm line 180.
Re: Correction re #1
Oh, and just in case, is the use StatData; a pasto for use DW::StatData; ? (and ditto for StatStore)
Re: Correction re #1
HOME /dreamhack/home/8214-anarres LJHOME /dreamhack/home/8214-anarres/dw
which I think is probably right? But I've just noticed that my /stats/site.bml just shows a blank page - but it was working before, after you showed me how to turn on stats collection. (I've checked that etc/stats-collectin.conf and bin/worker/stats-collection have the lines suggested in http://wiki.dwscoalition.org/notes/Stats_Design). So I'm worried that somewhere along the way I must have done something to make it stop working :-P
(Looks for a lazy solution) I need to bring my dreamhack up to date anyway, and if I caused the problem by fiddling with something somewhere, maybe updating my dreamhack would solve that?
Ah, and sorry, I had left out the DW:: in DW::StatData, and ditto for StatStore, above.
Re: Correction re #1
use LJ::MemCache;
I'm now getting a different error message: it's complaining that it can't call the method "get" on an undefined value. I think this is real progress!
Re: Correction re #1
Re: Correction re #1
http://pastebin.com/pTC16zfj
Using LJ:::MemCache
Background discussion: http://dw-dev.dreamwidth.org/57740.html.
Re: Using LJ:::MemCache
Re: Correction re #1
Re: Correction re #1
Re: Correction re #1
no subject
Re #5: the plan is that eventually, those stats it provides that the new system doesn't provide will get converted and merged in, at which point graphs for them would be nice. But that's low-priority.
no subject
no subject