Collects and publishes Hyperspace metrics. More...
#include <MetricsHandler.h>
Public Member Functions | |
MetricsHandler (PropertiesPtr &props) | |
Constructor. More... | |
virtual | ~MetricsHandler () |
Destructor. More... | |
void | start_collecting () |
Starts metrics collection. More... | |
void | stop_collecting () |
Stops metrics collection. More... | |
virtual void | handle (EventPtr &event) |
Collects and publishes metrics. More... | |
void | request_increment () |
Increments request count. More... | |
Public Member Functions inherited from Hypertable::DispatchHandler | |
virtual | ~DispatchHandler () |
Destructor. More... | |
Private Attributes | |
Comm * | m_comm |
Comm layer. More... | |
MetricsCollectorGangliaPtr | m_ganglia_collector |
Ganglia metrics collector. More... | |
MetricsProcess | m_metrics_process |
General process metrics tracker. More... | |
int64_t | m_last_timestamp |
Timestamp of last metrics collection More... | |
int32_t | m_collection_interval {} |
Metrics collection interval More... | |
interval_metric< int64_t > | m_requests {} |
Hyperspace requests More... | |
Collects and publishes Hyperspace metrics.
This class acts as the timer dispatch handler for periodic metrics collection for Hyperspace.
Definition at line 51 of file MetricsHandler.h.
MetricsHandler::MetricsHandler | ( | PropertiesPtr & | props | ) |
Constructor.
Initializes m_collection_interval to the property Hypertable.Monitoring.Interval
and allocates a Ganglia collector object, initializing it with "hyperspace" and Hypertable.Metrics.Ganglia.Port
. Lastly, calls Comm::set_timer() to register a timer for m_collection_interval milliseconds in the future and passes this
as the timer handler.
props | Properties object |
Definition at line 44 of file MetricsHandler.cc.
|
virtual |
|
virtual |
Collects and publishes metrics.
This method updates the requests/s
and general process metrics and publishes them via m_ganglia_collector. After metrics have been collected, the timer is re-registered for m_collection_interval milliseconds in the future.
event | Comm layer timer event |
Implements Hypertable::DispatchHandler.
Definition at line 66 of file MetricsHandler.cc.
|
inline |
Increments request count.
Increments m_requests which is used in computing requests/s.
Definition at line 85 of file MetricsHandler.h.
void MetricsHandler::start_collecting | ( | ) |
Starts metrics collection.
Definition at line 54 of file MetricsHandler.cc.
void MetricsHandler::stop_collecting | ( | ) |
Stops metrics collection.
Definition at line 60 of file MetricsHandler.cc.
|
private |
Metrics collection interval
Definition at line 104 of file MetricsHandler.h.
|
private |
Comm layer.
Definition at line 92 of file MetricsHandler.h.
|
private |
Ganglia metrics collector.
Definition at line 95 of file MetricsHandler.h.
|
private |
Timestamp of last metrics collection
Definition at line 101 of file MetricsHandler.h.
|
private |
General process metrics tracker.
Definition at line 98 of file MetricsHandler.h.
|
private |
Hyperspace requests
Definition at line 107 of file MetricsHandler.h.