45 m_ganglia_collector = std::make_shared<MetricsCollectorGanglia>(
"hyperspace", props);
46 m_collection_interval = props->get_i32(
"Hypertable.Monitoring.Interval");
56 if ((error = m_comm->set_timer(m_collection_interval, shared_from_this())) !=
Error::OK)
62 m_comm->cancel_timer(handler);
73 m_metrics_process.collect(timestamp, m_ganglia_collector.get());
75 int64_t elapsed_secs = (timestamp - m_last_timestamp) / 1000000000LL;
77 m_ganglia_collector->update(
"requests", m_requests.rate(elapsed_secs));
81 m_ganglia_collector->publish();
84 HT_INFOF(
"Problem publishing Ganglia metrics - %s", e.what());
87 m_last_timestamp = timestamp;
89 if ((error = m_comm->set_timer(m_collection_interval, shared_from_this())) !=
Error::OK)
94 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 ~MetricsHandler()
Destructor.
virtual void handle(EventPtr &event)
Collects and publishes metrics.
#define HT_INFOF(msg,...)
This is a generic exception class for Hypertable.
std::shared_ptr< DispatchHandler > DispatchHandlerPtr
Smart pointer to DispatchHandler.
Declarations for MetricsHandler.
Error codes, Exception handling, error logging.
int64_t get_ts64()
Returns the current time in nanoseconds as a 64bit number.