snyder
metrics library for C++11
 All Classes Functions Variables
Public Member Functions
Snyder::MetricsRegistry Class Reference

central metrics registry. You can have multiple of those and each instance will have their own set of metrics. More...

#include <metrics_registry.h>

List of all members.

Public Member Functions

void Reset ()
 reset/clear all metrics
MetricsSnapshot Snapshot ()
 get a snapshot of the current state of metrics
int Increment (const std::string &name)
 method to increment a metric by 1
int Increment (const std::string &name, uint64_t count)
 method to increment a metric by a given count
int Decrement (const std::string &name)
 method to decrement a metric by 1. If the result would be negative, the counter is set to 0.
int Decrement (const std::string &name, uint64_t count)
 method to decrement a metric by a given count. If the result would be negative, the counter is set to 0.
MetricsStore GetCounters ()
 method to get the MetricsStore backing counters. This will return by value thus locking the mutex for the duration it takes to copy the data structure.
void ResetCounters ()
 reset/clear all counters
int Gauge (const std::string &name, uint64_t value)
 method to record a gauge value
MetricsStore GetGauges ()
 method to get the MetricsStore backing gauges. This will return by value thus locking the mutex for the duration it takes to copy the data structure.
void ResetGauges ()
 reset/clear all gauges

Detailed Description

central metrics registry. You can have multiple of those and each instance will have their own set of metrics.


Member Function Documentation

int MetricsRegistry::Decrement ( const std::string &  name)

method to decrement a metric by 1. If the result would be negative, the counter is set to 0.

Parameters:
namethe name of the counter to decrement
Returns:
int 0 on success, 1 if count is out of range
int MetricsRegistry::Decrement ( const std::string &  name,
uint64_t  count 
)

method to decrement a metric by a given count. If the result would be negative, the counter is set to 0.

Parameters:
namethe name of the counter to increment
countinteger to decrement the counter by
Returns:
int 0 on success
int MetricsRegistry::Gauge ( const std::string &  name,
uint64_t  value 
)

method to record a gauge value

Parameters:
namethe name of the gauge to record
valuethe value of the gauge to record
Returns:
int 0 on success, 1 if value is out of range
MetricsStore MetricsRegistry::GetCounters ( )

method to get the MetricsStore backing counters. This will return by value thus locking the mutex for the duration it takes to copy the data structure.

Returns:
MetricsStore
MetricsStore MetricsRegistry::GetGauges ( )

method to get the MetricsStore backing gauges. This will return by value thus locking the mutex for the duration it takes to copy the data structure.

Returns:
MetricsStore
int MetricsRegistry::Increment ( const std::string &  name)

method to increment a metric by 1

Parameters:
namethe name of the counter to increment
Returns:
int 0 on success
int MetricsRegistry::Increment ( const std::string &  name,
uint64_t  count 
)

method to increment a metric by a given count

Parameters:
namethe name of the counter to increment
countinteger to increment the counter by
Returns:
int 0 on success

reset/clear all metrics

Returns:
void

reset/clear all counters

Returns:
void

reset/clear all gauges

Returns:
void

get a snapshot of the current state of metrics

Returns:
MetricsSnapshot

The documentation for this class was generated from the following files:
 All Classes Functions Variables