0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MetricsHandler.h
Go to the documentation of this file.
1 /* -*- c++ -*-
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 3
9  * of the License, or any later version.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
26 
27 #ifndef Master_MetricsHandler_h
28 #define Master_MetricsHandler_h
29 
30 #include <AsyncComm/Comm.h>
32 
34 #include <Common/MetricsProcess.h>
35 #include <Common/Properties.h>
36 #include <Common/metrics>
37 
38 #include <memory>
39 #include <mutex>
40 
41 namespace Hypertable {
42 
45 
49  public:
50 
57 
60  virtual ~MetricsHandler() {};
61 
63  void start_collecting();
64 
66  void stop_collecting();
67 
74  virtual void handle(EventPtr &event);
75 
79  m_operations.current++;
80  }
81 
82  private:
83 
85  Comm *m_comm {};
86 
89 
92 
95 
98 
100  interval_metric<int64_t> m_operations {};
101 
103  bool m_started {};
104  };
105 
107  typedef std::shared_ptr<MetricsHandler> MetricsHandlerPtr;
108 
110 }
111 
112 #endif // Master_MetricsHandler_h
std::shared_ptr< MetricsHandler > MetricsHandlerPtr
Smart pointer to MetricsHandler.
Collects and publishes Hyperspace metrics.
MetricsHandler(PropertiesPtr &props)
Constructor.
Abstract base class for application dispatch handlers registered with AsyncComm.
Declarations for MetricsCollectorGanglia.
Program options handling.
std::shared_ptr< Event > EventPtr
Smart pointer to Event.
Definition: Event.h:228
void start_collecting()
Starts metrics collection.
void operation_increment()
Increments operation count.
Declarations for DispatchHandler.
Declarations for MetricsProcess.
std::shared_ptr< Properties > PropertiesPtr
Definition: Properties.h:447
MetricsProcess m_metrics_process
General process metrics tracker.
std::shared_ptr< MetricsCollectorGanglia > MetricsCollectorGangliaPtr
Smart pointer to MetricsCollectorGanglia.
void stop_collecting()
Stops metrics collection.
int32_t m_collection_interval
Metrics collection interval
Hypertable definitions
Entry point to AsyncComm service.
Definition: Comm.h:61
virtual void handle(EventPtr &event)
Collects and publishes metrics.
Comm * m_comm
Comm layer.
Declarations for Comm.
MetricsCollectorGangliaPtr m_ganglia_collector
Ganglia metrics collector.
Computes and publishes general process metrics.
bool m_started
Collection has started.
int64_t m_last_timestamp
Timestamp of last metrics collection
interval_metric< int64_t > m_operations
Master operations
virtual ~MetricsHandler()
Destructor.