[Users] New Feature - Global Statistics Management support

Bogdan-Andrei Iancu bogdan at voice-system.ro
Wed Jan 25 12:18:22 CET 2006


Hi everybody,

A new feature is present on the development version of openser - Global 
Statistics Management support: the core includes a Statistics Manager 
which roll is to collect statistics variables from all over openser and 
to offer management support (to create and operate them); it also 
provides a single, centralized point of access to allow external apps or 
internal modules to get any statistics.

How it works? the core and the module exports different statistics 
variables (via the module interface). The Statistics Manager (SM) offers 
support for auto-initialization, for updating ans resetting variables.
The statistics variables are kept into shared mem to be accessible to 
all processes. Synchronization support is offered by SM.

Statistic variable capabilities
-------------------------------
     be defined with:
         NO_RESET (it cannot be reset -ex. used mem, register 
subscribers, etc)
         NO_SYNC (it will not be synchronized during ops; by their 
nature, some variables are already synchronized)
     be updated (added with new val)
     be reset (set to zero if allowed).


Accessing the statistics
-------------------------

The SM export two FIFO functions for offering access to the statistics:
    "get_statistics all" - gets all statistics
    "get_statistics stat_name"  - gets the value of the stat_name variable
    "get_statistics module_name:" - get all statistics exported by 
module "module name"; to get statistics from core, use "core" as module_name
    "reset_statistics stat_name" - sets to 0 the value of the stat_name 
variable


The SM internally offers an API to be used by other modules interested 
in accessing the statistics. Ex: a future snmp module



Current statistics
------------------

For the moment only a few core statistics are defined (we can easily add 
them in time):
    received requests : "rcv_reqs"
    received replies : "rcv_rpls"
    dropped requests (by scripts or post-script callbacks) : "drp_reqs"
    dropped replies (by scripts or post-script callbacks) : "drp_rpls"
    error requests (basic parsing failed) : "err_reqs"
    error replies (bassic parsing failed) : "err_rpls"


How to use it
--------------

first to need to enable its compiling - enable the -DSTATISTICS flag in 
Makefile.def (by default is disabled).
Recompile and run openser.
Use fifo to get the statistics. Ex:
    openserctl fifo get_statistics all
    openserctl fifo get_statistics core:
    openserctl fifo get_statistics rcv_reqs



Next steps
-----------

optimization of the SM (better locking for sync, usage of atomic ops if 
possible)

replace old statistics (see stats.c) - the code is not compiling since 
it depends on some snmp stuff...

replace local module statistics (sl,tm,usrloc) with sttistics via SM

add more statistics...ideas are welcomed

new module to implement dynamic statistics variables to be used from 
script.



regards,
bogdan








More information about the Users mailing list