pdns  4.5.1
About: PowerDNS daemon - a high performance authoritative nameserver.
  Fossies Dox: pdns-4.5.1.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

StatBag Class Reference

use this to gather and query statistics More...

#include <statbag.hh>

Collaboration diagram for StatBag:
[legend]

Public Member Functions

 StatBag ()
 Naked constructor. You need to declare keys before this class becomes useful. More...
 
 ~StatBag ()
 
void declare (const string &key, const string &descrip="", StatType statType=StatType::counter)
 Before you can store or access a key, you need to declare it. More...
 
void declare (const string &key, const string &descrip, func_t func, StatType statType)
 Before you can store or access a key, you need to declare it. More...
 
void declareRing (const string &name, const string &title, unsigned int size=10000)
  More...
 
void declareComboRing (const string &name, const string &help, unsigned int size=10000)
  More...
 
void declareDNSNameQTypeRing (const string &name, const string &help, unsigned int size=10000)
  More...
 
vector< pair< string, unsigned int > > getRing (const string &name)
  More...
 
string getRingTitle (const string &name)
  More...
 
void ringAccount (const char *name, const string &item)
  More...
 
void ringAccount (const char *name, const ComboAddress &item)
  More...
 
void ringAccount (const char *name, const DNSName &dnsname, const QType &qtype)
  More...
 
void doRings ()
  More...
 
vector< string > listRings ()
  More...
 
bool ringExists (const string &name)
  More...
 
void resetRing (const string &name)
  More...
 
void resizeRing (const string &name, unsigned int newsize)
  More...
 
uint64_t getRingSize (const string &name)
  More...
 
uint64_t getRingEntriesCount (const string &name)
  More...
 
string directory (const string &prefix="")
 Returns a list of all data stored. If prefix is given, only stats named with this prefix are returned. More...
 
vector< string > getEntries ()
 returns a vector with datums (items) More...
 
string getDescrip (const string &item)
 Returns the description of this datum/item. More...
 
StatType getStatType (const string &item)
 Returns the stats type for the metrics endpoint. More...
 
void exists (const string &key)
 call this function to throw an exception in case a key does not exist More...
 
void deposit (const string &key, int value)
 increment the statistics behind this key by value amount More...
 
void inc (const string &key)
 increase this key's value by one More...
 
void set (const string &key, unsigned long value)
 set this key's value More...
 
unsigned long read (const string &key)
 read the value behind this key More...
 
unsigned long readZero (const string &key)
 read the value behind this key, and zero it afterwards More...
 
AtomicCountergetPointer (const string &key)
 get a direct pointer to the value behind a key. Use this for high performance increments More...
 
string getValueStr (const string &key)
 read a value behind a key, and return it as a string More...
 
string getValueStrZero (const string &key)
 read a value behind a key, and return it as a string, and zero afterwards More...
 
void blacklist (const string &str)
  More...
 

Public Attributes

bool d_allowRedeclare
  More...
 

Private Types

typedef boost::function< uint64_t(const std::string &)> func_t
 
typedef map< string, func_tfuncstats_t
 

Private Member Functions

void registerRingStats (const string &name)
  More...
 

Private Attributes

map< string, std::unique_ptr< AtomicCounter > > d_stats
  More...
 
map< string, string > d_keyDescriptions
  More...
 
map< string, StatTyped_statTypes
  More...
 
map< string, StatRing< string, CIStringCompare > > d_rings
  More...
 
map< string, StatRing< SComboAddress > > d_comboRings
  More...
 
map< string, StatRing< std::tuple< DNSName, QType > > > d_dnsnameqtyperings
  More...
 
funcstats_t d_funcstats
  More...
 
bool d_doRings
  More...
 
std::set< string > d_blacklist
  More...
 

Detailed Description

use this to gather and query statistics

Definition at line 71 of file statbag.hh.


The documentation for this class was generated from the following files: