Package coprs :: Module rmodels :: Class TimedStatEvents
[hide private]
[frames] | no frames]

Class TimedStatEvents

source code


Wraps hset structure, where: **key** - name of event, fix prefix specifying events type **member** - bucket representing one day **score** - events count

Instance Methods [hide private]

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
 
gen_days_interval(cls, min_ts, max_ts)
Generate list of days bucket names which contains...
source code
 
add_event(cls, rconnect, name, timestamp, count=1, prefix=None)
Stoted new event to redist :param rconnect: Connection to a redis :type rconnect: StrictRedis :param name: statistics name :param timestamp: timestamp of event :param count: number of events, default=1 :param prefix: prefix for statistics, default is None
source code
 
get_count(cls, rconnect, name, day_min=None, prefix=None, day_max=None)
Count total event occurency between day_min and day_max :param rconnect: Connection to a redis :type rconnect: StrictRedis :param name: statistics name :param day_min: default: seven days ago :param day_max: default: tomorrow :param prefix: prefix for statistics, default is None
source code
 
trim_before(cls, rconnect, name, threshold_timestamp, prefix=None)
Removes all records occured before `threshold_timestamp` :param rconnect: StrictRedis :param name: statistics name :param threshold_timestamp: int :param prefix: prefix for statistics, default is None
source code

Inherited from GenericRedisModel (private): _get_key

Static Methods [hide private]
 
timestamp_to_day(ut)
:param ut: unix timestamp :type ut: float :return: name for the day bucket
source code
Class Variables [hide private]
  _KEY_BASE = 'copr:tse'
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

gen_days_interval(cls, min_ts, max_ts)
Class Method

source code 

Generate list of days bucket names which contains
    all events between `min_ts` and `max_ts`
:param min_ts: min unix timestamp
:param max_ts: max unix timestamp
:rtype: list

get_count(cls, rconnect, name, day_min=None, prefix=None, day_max=None)
Class Method

source code 

Count total event occurency between day_min and day_max :param rconnect: Connection to a redis :type rconnect: StrictRedis :param name: statistics name :param day_min: default: seven days ago :param day_max: default: tomorrow :param prefix: prefix for statistics, default is None

:rtype: int