Author image Peter Karman
and 1 contributors

NAME

Dezi::Stats - log statistics for your Dezi server

SYNOPSIS

 # example Dezi server application
 use Dezi::Server;
 use Plack::Runner;
 use Dezi::Stats;
 
 my $app = Dezi::Server->app({
    engine_config   => { 
        type    => 'Lucy',
        index   => ['path/to/your/index'],
    },
    stats_logger => Dezi::Stats->new(
        type        => 'DBI',
        dsn         => "DBI:mysql:database=$database;host=$hostname;port=$port",
        username    => 'myuser',
        password    => 'mysecret',
    ),
 });
 
 my $runner = Plack::Runner->new();
 $runner->run($app);

DESCRIPTION

Dezi::Stats logs statistics about requests to a Dezi server. There are multiple backend storage options, including DBI-based storage (MySQL, Postgresql, SQLite, etc), file-based, etc.

METHODS

new( config )

Returns a new Dezi::Stats object. config should be a series of key/value pairs (a hash). Supported config params are:

type

The backend storage type. Defaults to 'File' (see Dezi::Stats::File).

dsn

If type is DBI then the dsn value will be passed directly to the DBI->connect() method.

username

If type is DBI then the username value will be passed directly to the DBI->connect() method.

password

If type is DBI then the password value will be passed directly to the DBI->connect() method.

table_name

If type is DBI then the table_name value will be used to insert rows. Defaults to dezi_stats.

quote

If type is DBI then the quote value will be used to quote column names on insert. Defaults to false.

quote_char

If type is DBI then the quote_char value will be used when quote is true. Defaults to backtick.

path

If type is File then the path value is the filesystem path to the log file. See Dezi::Stats::File.

init_store

All subclasses must implement this abstract method. Called internally in new().

log( plack_request, sos_response )

Required method for Search::OpenSearch::Server stats_logger() API.

Expects 2 objects: the current Plack::Request and the resulting Search::OpenSearch::Response.

Calls insert() after pulling data from the request and the response.

insert( hash_ref )

Called by log. All subclasses must implement this abstract method.

AUTHOR

Peter Karman, <karman at cpan.org>

BUGS

Please report any bugs or feature requests to bug-dezi-stats at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Dezi-Stats. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Dezi::Stats

You can also look for information at:

COPYRIGHT & LICENSE

Copyright 2012 Peter Karman.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.