RTBKit
0.9
Open-source framework to create real-time ad bidding systems.
|
#include <carbon_connector.h>
Public Types | |
typedef std::function< void(const std::vector< StatReading > &)> | OutputFn |
Public Member Functions | |
MultiAggregator (const std::string &path, const OutputFn &output=OutputFn(), double dumpInterval=1.0, std::function< void()> onStop=std::function< void()>()) | |
void | open (const std::string &path, const OutputFn &output=OutputFn(), double dumpInterval=1.0, std::function< void()> onStop=std::function< void()>()) |
virtual void | doStat (const std::vector< StatReading > &value) const |
void | record (const std::string &stat, EventType type=ET_COUNT, float value=1.0) |
void | recordLevel (const std::string &stat, float level) |
void | recordOccurrence (const std::string &stat) |
void | recordQuantity (const std::string &stat, float quantity) |
void | recordOutcome (const std::string &stat, float measure) |
void | dumpSync (std::ostream &stream) const |
void | dump () |
void | stop () |
Public Attributes | |
OutputFn | outputFn |
Protected Attributes | |
std::string | prefix |
std::function< void()> | onStop |
std::function< void()> | onPreShutdown |
std::function< void()> | onPostShutdown |
Aggregates multiple stats together.
Definition at line 32 of file carbon_connector.h.
void Datacratic::MultiAggregator::doStat | ( | const std::vector< StatReading > & | value | ) | const [virtual] |
Function to be called when the stat is to be done. Default will call the OutputFn.
Reimplemented in Datacratic::CarbonConnector.
Definition at line 96 of file carbon_connector.cc.
void Datacratic::MultiAggregator::dump | ( | ) |
Wake up and dump the data. Asynchronous; this signals the dumping thread to do the actual dump.
Definition at line 165 of file carbon_connector.cc.
void Datacratic::MultiAggregator::dumpSync | ( | std::ostream & | stream | ) | const |
Dump synchronously (taking the lock). This should only be used in testing or debugging, not when connected to Carbon.
Definition at line 177 of file carbon_connector.cc.
void Datacratic::MultiAggregator::record | ( | const std::string & | stat, |
EventType | type = ET_COUNT , |
||
float | value = 1.0 |
||
) |
Record, generic version.
Definition at line 118 of file carbon_connector.cc.
void Datacratic::MultiAggregator::recordLevel | ( | const std::string & | stat, |
float | level | ||
) |
Record the level of a something. The stat will record the mean, minimum and maximum level over the second.
Lock-free (except the first time it's called for each name) and thread safe.
Definition at line 134 of file carbon_connector.cc.
void Datacratic::MultiAggregator::recordOccurrence | ( | const std::string & | stat | ) |
Simplest interface: record that a particular event occurred. The stat will record the total count for each second. Lock-free and thread safe.
Definition at line 142 of file carbon_connector.cc.
void Datacratic::MultiAggregator::recordOutcome | ( | const std::string & | stat, |
float | measure | ||
) |
Record that a given outcome from an independent process. These will be represented in Carbon with mean, max, etc.
Definition at line 157 of file carbon_connector.cc.
void Datacratic::MultiAggregator::recordQuantity | ( | const std::string & | stat, |
float | quantity | ||
) |
Record that something happened. The stat will record the total amount in each second.
Definition at line 149 of file carbon_connector.cc.
void Datacratic::MultiAggregator::stop | ( | ) |
Stop the dumping.
Definition at line 89 of file carbon_connector.cc.