0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ServerMetrics.h
Go to the documentation of this file.
1 /* -*- c++ -*-
2  * Copyright (C) 2007-2013 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 Hypertable_Lib_RS_METRICS_ServerMetrics_h
28 #define Hypertable_Lib_RS_METRICS_ServerMetrics_h
29 
30 #include <Common/StringExt.h>
31 
32 #include <vector>
33 #include <set>
34 
35 namespace Hypertable {
36 namespace Lib {
37 namespace RS_METRICS {
38 
41 
44 
45  public:
46 
47  ServerMeasurement() { memset(this, 0, sizeof(ServerMeasurement)); }
48  ServerMeasurement(const char *measurement, size_t len);
49  void parse_measurement(const char *measurement, size_t len);
50 
51  int version;
52  int64_t timestamp;
53  double loadavg;
57  double updates_rate;
58  double scans_rate;
61  double page_in;
62  double page_out;
63  int64_t disk_total;
64  int64_t disk_avail;
65  };
66 
68  class ServerMetrics {
69 
70  public:
71 
72  ServerMetrics(const String &id) : m_id(id) { }
73  ServerMetrics(const char *id) : m_id(id) { }
74 
75  void add_measurement(const char *measurement, size_t len);
76  const std::vector<ServerMeasurement> &get_measurements() const { return m_measurements; }
77 
78  const String &get_id() const { return m_id; }
79  String &get_id() { return m_id; }
80 
81  private:
82  std::vector<ServerMeasurement> m_measurements;
83  std::set<String> m_ranges;
85  }; // ServerMetrics
86 
88 
89 } // namespace RS_METRICS
90 } // namespace Lib
91 } // namespace Hypertable
92 
93 #endif // Hypertable_Lib_RS_METRICS_ServerMetrics_h
const std::vector< ServerMeasurement > & get_measurements() const
Definition: ServerMetrics.h:76
std::string String
A String is simply a typedef to std::string.
Definition: String.h:44
std::vector< ServerMeasurement > m_measurements
Definition: ServerMetrics.h:82
Hypertable definitions
void parse_measurement(const char *measurement, size_t len)
Aggregates metrics for an individual RangeServer.
Definition: ServerMetrics.h:68
String extensions and helpers: sets, maps, append operators etc.
void add_measurement(const char *measurement, size_t len)
Single server metrics measurement.
Definition: ServerMetrics.h:43