43 m_ganglia_collector = std::make_shared<MetricsCollectorGanglia>(
"master", props);
44 m_collection_interval = props->get_i32(
"Hypertable.Monitoring.Interval");
53 if ((error = m_comm->set_timer(m_collection_interval, shared_from_this())) !=
Error::OK)
61 m_comm->cancel_timer(shared_from_this());
75 m_metrics_process.collect(timestamp, m_ganglia_collector.get());
77 int64_t elapsed_secs = (timestamp - m_last_timestamp) / 1000000000LL;
79 m_ganglia_collector->update(
"operations", m_operations.rate(elapsed_secs));
83 m_ganglia_collector->publish();
86 HT_INFOF(
"Problem publishing Ganglia metrics - %s", e.what());
89 m_last_timestamp = timestamp;
91 if ((error = m_comm->set_timer(m_collection_interval, shared_from_this())) !=
Error::OK)
96 HT_FATALF(
"Unrecognized event - %s", event->to_str().c_str());
static Comm * instance()
Creates/returns singleton instance of the Comm class.
MetricsHandler(PropertiesPtr &props)
Constructor.
Program options handling.
std::shared_ptr< Event > EventPtr
Smart pointer to Event.
void start_collecting()
Starts metrics collection.
const char * get_text(int error)
Returns a descriptive error message.
std::shared_ptr< Properties > PropertiesPtr
Logging routines and macros.
Compatibility Macros for C/C++.
void stop_collecting()
Stops metrics collection.
#define HT_FATALF(msg,...)
virtual void handle(EventPtr &event)
Collects and publishes metrics.
#define HT_INFOF(msg,...)
This is a generic exception class for Hypertable.
Declarations for MetricsHandler.
Error codes, Exception handling, error logging.
int64_t get_ts64()
Returns the current time in nanoseconds as a 64bit number.