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 Hyperspace_MetricsHandler_h
28 #define Hyperspace_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 Hyperspace {
42 
43  using namespace Hypertable;
44 
47 
52  public:
53 
64 
67  virtual ~MetricsHandler();
68 
70  void start_collecting();
71 
73  void stop_collecting();
74 
81  virtual void handle(EventPtr &event);
82 
86  m_requests.current++;
87  }
88 
89  private:
90 
93 
96 
99 
102 
105 
107  interval_metric<int64_t> m_requests {};
108  };
109 
111  typedef std::shared_ptr<MetricsHandler> MetricsHandlerPtr;
112 
114 }
115 
116 #endif // Hyperspace_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.
interval_metric< int64_t > m_requests
Hyperspace requests
int64_t m_last_timestamp
Timestamp of last metrics collection
Hyperspace definitions
Declarations for DispatchHandler.
Declarations for MetricsProcess.
std::shared_ptr< Properties > PropertiesPtr
Definition: Properties.h:447
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
virtual ~MetricsHandler()
Destructor.
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.
Computes and publishes general process metrics.
void request_increment()
Increments request count.
MetricsCollectorGangliaPtr m_ganglia_collector
Ganglia metrics collector.
MetricsProcess m_metrics_process
General process metrics tracker.