SWC-DB  v0.5.12 C++ documentations
SWC-DB© (Super Wide Column Database) - High Performance Scalable Database (https://github.com/kashirin-alex/swc-db)
MetricsReporting.h
Go to the documentation of this file.
1 /*
2  * SWC-DB© Copyright since 2019 Alex Kashirin <kashirin.alex@gmail.com>
3  * License details at <https://github.com/kashirin-alex/swc-db/#license>
4  */
5 
6 
7 #ifndef swcdb_common_queries_update_MetricsReporting_h
8 #define swcdb_common_queries_update_MetricsReporting_h
9 
10 
12 #include "swcdb/fs/Interface.h"
14 
15 
16 namespace SWC { namespace Common {
17 
19 namespace Query {
20 
22 namespace Update {
23 
25 namespace Metric {
26 
27 using namespace client::Query::Update::Handlers::Metric;
28 
29 
30 
31 namespace { // local namespace
32 
34 static size_t encoded_length(
36  bool with_count) noexcept {
37  size_t sz = 0;
38  if(value.count && value.total) {
39  uint64_t avg = value.avg();
40  if(avg != value.min)
41  sz += 2 + Serialization::encoded_length_vi64(value.min);
42  if(avg != value.max)
43  sz += 2 + Serialization::encoded_length_vi64(value.max);
44  if(with_count)
47  }
48  return sz;
49 }
50 
52 static void add_value(
54  uint8_t field_start, bool with_count,
55  DB::Cell::Serial::Value::FieldsWriter& wfields) noexcept {
56  if(value.count && value.total) {
57  uint64_t avg = value.avg();
58  if(avg != value.min)
59  wfields.add(field_start, int64_t(value.min));
60  if(avg != value.max)
61  wfields.add(field_start + 1, int64_t(value.max));
62  if(with_count)
63  wfields.add(field_start + 2, int64_t(value.count));
64  wfields.add(field_start + 2 + with_count, int64_t(avg));
65  }
66 }
67 
68 }
69 
70 
71 template<typename CommandsT>
72 class Item_Net : public Base {
73  /* Cell-Serialization:
74  key: [levels, "net", "{address}", is_secure()?"SECURE":"PLAIN"]
75  value: {FIELD_ID}:I:{value}, ...
76  */
77  static constexpr const uint8_t FIELD_CONN_OPEN = 0;
78  static constexpr const uint8_t FIELD_CONN_ACC = 1;
79  static constexpr const uint8_t FIELD_CONN_EST = 2;
80 
81  static constexpr const uint8_t FIELD_BYTES_SENT_MIN = 3;
82  static constexpr const uint8_t FIELD_BYTES_SENT_MAX = 4;
83  static constexpr const uint8_t FIELD_BYTES_SENT_TRX = 5;
84  static constexpr const uint8_t FIELD_BYTES_SENT_AVG = 6;
85 
86  static constexpr const uint8_t FIELD_BYTES_RECV_MIN = 7;
87  static constexpr const uint8_t FIELD_BYTES_RECV_MAX = 8;
88  static constexpr const uint8_t FIELD_BYTES_RECV_TRX = 9;
89  static constexpr const uint8_t FIELD_BYTES_RECV_AVG = 10;
90 
91  static constexpr const uint8_t FIELD_EV_COMMAND_START = 100; // {100 + CMD}
92 
93  public:
94  typedef std::unique_ptr<Item_Net> Ptr;
95 
96  struct Addr {
97  const asio::ip::address addr;
104 
106  Addr(const Comm::EndPoint& endpoint) noexcept
107  : addr(endpoint.address()),
108  conn_open(0), conn_accept(0), conn_est(0),
109  bytes_sent(), bytes_recv() {
110  }
111  };
112 
113  Item_Net(const Comm::EndPoints& endpoints, bool using_secure) {
114  for(uint8_t secure = 0; secure <= using_secure; ++secure) {
115  m_addresses[secure].reserve(endpoints.size());
116  for(auto& endpoint : endpoints)
117  m_addresses[secure].emplace_back(new Addr(endpoint));
118  }
119  }
120 
121  virtual ~Item_Net() noexcept { }
122 
124  Addr* get(const asio::ip::address& for_addr, bool secure) const noexcept {
125  for(auto& addr : m_addresses[secure]) {
126  if(addr->addr.is_unspecified() || addr->addr == for_addr)
127  return addr.get();
128  }
129  return nullptr;
130  }
131 
133  void accepted(const Comm::EndPoint& endpoint, bool secure) noexcept {
134  if(Addr* addr = get(endpoint.address(), secure))
135  addr->conn_accept.fetch_add(1);
136  }
137 
139  void connected() noexcept {
140  Addr* addr = m_addresses[0].front().get();
141  addr->conn_open.fetch_add(1);
142  addr->conn_est.fetch_add(1);
143  }
144 
146  void disconnected() noexcept {
147  Addr* addr = m_addresses[0].front().get();
148  addr->conn_open.fetch_sub(1);
149  }
150 
152  void connected(const Comm::ConnHandlerPtr& conn) noexcept {
153  if(Addr* addr = get(conn->endpoint_local.address(), conn->is_secure())) {
154  addr->conn_open.fetch_add(1);
155  addr->conn_est.fetch_add(1);
156  }
157  }
158 
160  void disconnected(const Comm::ConnHandlerPtr& conn) noexcept {
161  if(Addr* addr = get(conn->endpoint_local.address(), conn->is_secure()))
162  addr->conn_open.fetch_sub(1);
163  }
164 
166  void command(const Comm::ConnHandlerPtr& conn, uint8_t cmd) noexcept {
167  if(Addr* addr = get(conn->endpoint_local.address(), conn->is_secure()))
168  addr->commands[cmd].fetch_add(1);
169  }
170 
172  void error(const Comm::ConnHandlerPtr& conn) noexcept {
173  if(Addr* addr = get(conn->endpoint_local.address(), conn->is_secure()))
174  addr->commands[CommandsT::MAX - 1].fetch_add(1);
175  }
176 
178  void sent(const Comm::ConnHandlerPtr& conn, size_t bytes) noexcept {
179  if(Addr* addr = get(conn->endpoint_local.address(), conn->is_secure()))
180  addr->bytes_sent.add(bytes);
181  }
182 
184  void received(const Comm::ConnHandlerPtr& conn, size_t bytes) noexcept {
185  if(Addr* addr = get(conn->endpoint_local.address(), conn->is_secure()))
186  addr->bytes_recv.add(bytes);
187  }
188 
190  const DB::Cell::KeyVec& parent_key) override {
191  bool secure = false;
192  _do_layer:
193  for(auto& addr : m_addresses[secure]) {
194 
195  DB::Cells::Cell cell;
196  cell.flag = DB::Cells::INSERT;
197  cell.set_time_order_desc(true);
198  cell.key.add(parent_key);
199  cell.key.add("net");
200  cell.key.add(addr->addr.to_string());
201  cell.key.add(secure ? "SECURE" : "PLAIN");
202 
203 
207  Core::Vector<int64_t> aggregations;
208  Core::Vector<int64_t> relations;
209  ids.reserve(11 + CommandsT::MAX);
210  names.reserve(ids.size());
211  labels.reserve(ids.size());
212  aggregations.reserve(ids.size());
213 
214  ids.push_back(FIELD_BYTES_SENT_MIN);
215  names.push_back("sent_min");
216  labels.push_back("Send Bytes Minimum");
217  aggregations.push_back(Aggregation::MIN);
218  relations.push_back(1);
219 
220  ids.push_back(FIELD_BYTES_SENT_MAX);
221  names.push_back("sent_max");
222  labels.push_back("Send Bytes Maximum");
223  aggregations.push_back(Aggregation::MAX);
224  relations.push_back(1);
225 
226  ids.push_back(FIELD_BYTES_SENT_TRX);
227  names.push_back("send_trx");
228  labels.push_back("Send Transactions");
229  aggregations.push_back(Aggregation::SUM);
230  relations.push_back(1);
231 
232  ids.push_back(FIELD_BYTES_SENT_AVG);
233  names.push_back("sent_avg");
234  labels.push_back("Send Bytes Average");
235  aggregations.push_back(Aggregation::AVG_PROP);
236  relations.push_back(1);
237 
238 
239  ids.push_back(FIELD_BYTES_RECV_MIN);
240  names.push_back("recv_min");
241  labels.push_back("Receive Bytes Minimum");
242  aggregations.push_back(Aggregation::MIN);
243  relations.push_back(2);
244 
245  ids.push_back(FIELD_BYTES_RECV_MAX);
246  names.push_back("recv_max");
247  labels.push_back("Receive Bytes Maximum");
248  aggregations.push_back(Aggregation::MAX);
249  relations.push_back(2);
250 
251  ids.push_back(FIELD_BYTES_RECV_TRX);
252  names.push_back("recv_trx");
253  labels.push_back("Receive Transactions");
254  aggregations.push_back(Aggregation::SUM);
255  relations.push_back(2);
256 
257  ids.push_back(FIELD_BYTES_RECV_AVG);
258  names.push_back("recv_avg");
259  labels.push_back("Receive Bytes Average");
260  aggregations.push_back(Aggregation::AVG_PROP);
261  relations.push_back(2);
262 
263  ids.push_back(FIELD_CONN_OPEN);
264  names.push_back("open");
265  labels.push_back("Open Connections");
266  aggregations.push_back(Aggregation::MAX);
267 
268  ids.push_back(FIELD_CONN_ACC);
269  names.push_back("accept");
270  labels.push_back("Accepted Connections");
271 
272  ids.push_back(FIELD_CONN_EST);
273  names.push_back("established");
274  labels.push_back("Connections Established");
275 
276  for(uint8_t i=0; i < CommandsT::MAX; ++i) {
277  std::string cmd(CommandsT::to_string(i));
278  ids.push_back(i + FIELD_EV_COMMAND_START);
279  names.push_back(cmd);
280  labels.push_back(cmd + " Requests");
281  }
282  size_t sz = 15 + 2 * ids.size() + relations.size();
283  for(size_t i=0; i < names.size(); ++i) {
284  sz += names[i].size();
285  sz += labels[i].size();
286  }
287  {
289  wfields.ensure(sz);
290  wfields.add(ids);
291  wfields.add(names);
292  wfields.add(labels);
293  wfields.add(aggregations);
294  wfields.add(relations);
295  cell.set_value(DB::Types::Encoder::ZSTD, wfields.base, wfields.fill());
296  }
297  colp->add(cell);
298  }
299 
300  if(!secure) {
301  secure = true;
302  if(!m_addresses[secure].empty())
303  goto _do_layer;
304  }
305  }
306 
307  virtual void report(uint64_t for_ns,
309  const DB::Cell::KeyVec& parent_key) override {
310  int64_t conn_open = 0;
311  int64_t conn_accept = 0;
312  int64_t conn_est = 0;
315 
316  bool secure = false;
317  _do_layer:
318  for(auto& addr : m_addresses[secure]) {
319  DB::Cell::KeyVec key;
320  key.reserve(parent_key.size() + 3);
321  key.copy(parent_key);
322  key.add("net");
323  key.add(addr->addr.to_string());
324  key.add(secure ? "SECURE" : "PLAIN");
325 
326  DB::Cells::Cell cell;
327  cell.flag = DB::Cells::INSERT;
328  cell.set_time_order_desc(true);
329  cell.set_timestamp(for_ns);
330  cell.key.add(key);
331 
332  conn_open = addr->conn_open.load();
333  size_t sz = 2 + Serialization::encoded_length_vi64(conn_open);
334  if((conn_accept = addr->conn_accept.exchange(0)))
335  sz += 2 + Serialization::encoded_length_vi64(conn_accept);
336  if((conn_est = addr->conn_est.exchange(0)))
337  sz += 2 + Serialization::encoded_length_vi64(conn_est);
338 
339  addr->bytes_sent.gather(bytes_sent);
340  sz += encoded_length(bytes_sent, true);
341  addr->bytes_recv.gather(bytes_recv);
342  sz += encoded_length(bytes_recv, true);
343 
344  int64_t counts[CommandsT::MAX];
345  for(uint8_t i=0; i < CommandsT::MAX; ++i) {
346  if((counts[i] = addr->commands[i].exchange(0)))
347  sz += 2 + Serialization::encoded_length_vi64(counts[i]);
348  }
349 
351  wfields.ensure(sz);
352 
353  add_value(bytes_sent, FIELD_BYTES_SENT_MIN, true, wfields);
354  add_value(bytes_recv, FIELD_BYTES_RECV_MIN, true, wfields);
355 
356  wfields.add(FIELD_CONN_OPEN, conn_open);
357  if(conn_accept)
358  wfields.add(FIELD_CONN_ACC, conn_accept);
359  if(conn_est)
360  wfields.add(FIELD_CONN_EST, conn_est);
361  for(uint8_t i=0; i < CommandsT::MAX; ++i) {
362  if(counts[i])
363  wfields.add(i + FIELD_EV_COMMAND_START, counts[i]);
364  }
365  cell.set_value(wfields.base, wfields.fill(), false);
366  colp->add(cell);
367  }
368 
369  if(!secure) {
370  secure = true;
371  if(!m_addresses[secure].empty())
372  goto _do_layer;
373  }
374  }
375 
376  virtual void reset() override {
377  bool secure = false;
378  _do_layer:
379  for(auto& addr : m_addresses[secure]) {
380  addr->conn_open.store(0);
381  addr->conn_accept.store(0);
382  addr->conn_est.store(0);
383  addr->bytes_sent.reset();
384  addr->bytes_recv.reset();
385  for(auto& c : addr->commands) {
386  c.store(0);
387  }
388  }
389  if(!secure) {
390  secure = true;
391  if(!m_addresses[secure].empty())
392  goto _do_layer;
393  }
394  }
395 
396 
397  protected:
399 };
400 
401 
402 
403 class Item_Mem : public Base {
404  /* Cell-Serialization:
405  key: [levels, "mem"]
406  value: {FIELD_ID}:I:{value}, ...
407  */
408  static constexpr const uint8_t FIELD_RSS_FREE_MIN = 0;
409  static constexpr const uint8_t FIELD_RSS_FREE_MAX = 1;
410  static constexpr const uint8_t FIELD_RSS_FREE_AVG = 2;
411 
412  static constexpr const uint8_t FIELD_RSS_USED_MIN = 3;
413  static constexpr const uint8_t FIELD_RSS_USED_MAX = 4;
414  static constexpr const uint8_t FIELD_RSS_USED_AVG = 5;
415 
416  static constexpr const uint8_t FIELD_RSS_USED_REG_MIN = 6;
417  static constexpr const uint8_t FIELD_RSS_USED_REG_MAX = 7;
418  static constexpr const uint8_t FIELD_RSS_USED_REG_AVG = 8;
419 
420  public:
421  typedef std::unique_ptr<Item_Mem> Ptr;
422 
426 
427  Item_Mem() noexcept: rss_free(), rss_used(), rss_used_reg() { }
428 
429  virtual ~Item_Mem() noexcept { }
430 
432  const DB::Cell::KeyVec& parent_key) override {
433  DB::Cell::KeyVec key;
434  key.reserve(parent_key.size() + 1);
435  key.copy(parent_key);
436  key.add("mem");
437 
438  DB::Cells::Cell cell;
439  cell.flag = DB::Cells::INSERT;
440  cell.set_time_order_desc(true);
441  cell.key.add(key);
442 
444  wfields.add(Core::Vector<int64_t>({
445  FIELD_RSS_FREE_MIN,
446  FIELD_RSS_FREE_MAX,
447  FIELD_RSS_FREE_AVG,
448  FIELD_RSS_USED_MIN,
449  FIELD_RSS_USED_MAX,
450  FIELD_RSS_USED_AVG,
451  FIELD_RSS_USED_REG_MIN,
452  FIELD_RSS_USED_REG_MAX,
453  FIELD_RSS_USED_REG_AVG,
454  }));
456  "rss_free_min",
457  "rss_free_max",
458  "rss_free_avg",
459  "rss_used_min",
460  "rss_used_max",
461  "rss_used_avg",
462  "rss_reg_min",
463  "rss_reg_max",
464  "rss_reg_avg"
465  }));
467  "RSS Free Minimal",
468  "RSS Free Maximal",
469  "RSS Free Average",
470  "RSS Used Minimal",
471  "RSS Used Maximal",
472  "RSS Used Average",
473  "RSS Registred Minimal",
474  "RSS Registred Maximal",
475  "RSS Registred Average"
476  }));
477  wfields.add(Core::Vector<int64_t>({
487  }));
488  cell.set_value(DB::Types::Encoder::ZSTD ,wfields.base, wfields.fill());
489  colp->add(cell);
490  }
491 
492  virtual void report(uint64_t for_ns, client::Query::Update::Handlers::Base::Column* colp,
493  const DB::Cell::KeyVec& parent_key) override {
495  rss_free.gather(_rss_free);
496 
498  rss_used.gather(_rss_used);
499 
501  rss_used_reg.gather(_rss_used_reg);
502 
503  size_t sz = encoded_length(_rss_free, false);
504  sz += encoded_length(_rss_used, false);
505  sz += encoded_length(_rss_used_reg, false);
506  if(!sz)
507  return;
508 
509  DB::Cell::KeyVec key;
510  key.reserve(parent_key.size() + 1);
511  key.copy(parent_key);
512  key.add("mem");
513 
514  DB::Cells::Cell cell;
515  cell.flag = DB::Cells::INSERT;
516  cell.set_time_order_desc(true);
517  cell.set_timestamp(for_ns);
518  cell.key.add(key);
519 
520 
522  wfields.ensure(sz);
523  add_value(_rss_free, FIELD_RSS_FREE_MIN, false, wfields);
524  add_value(_rss_used, FIELD_RSS_USED_MIN, false, wfields);
525  add_value(_rss_used_reg, FIELD_RSS_USED_REG_MIN, false, wfields);
526 
527  cell.set_value(wfields.base, wfields.fill(), false);
528  colp->add(cell);
529  }
530 
531  virtual void reset() override {
532  rss_free.reset();
533  rss_used.reset();
534  rss_used_reg.reset();
535  }
536 
537 };
538 
539 
540 
541 class Item_CPU : public Base {
542  /* Cell-Serialization:
543  key: [levels, "cpu"]
544  value: {FIELD_ID}:I:{value}, ...
545  */
546  static constexpr const uint8_t FIELD_CPU_U_PERC_MIN = 0;
547  static constexpr const uint8_t FIELD_CPU_U_PERC_MAX = 1;
548  static constexpr const uint8_t FIELD_CPU_U_PERC_AVG = 2;
549 
550  static constexpr const uint8_t FIELD_CPU_S_PERC_MIN = 3;
551  static constexpr const uint8_t FIELD_CPU_S_PERC_MAX = 4;
552  static constexpr const uint8_t FIELD_CPU_S_PERC_AVG = 5;
553 
554  static constexpr const uint8_t FIELD_NTHREADS_MIN = 6;
555  static constexpr const uint8_t FIELD_NTHREADS_MAX = 7;
556  static constexpr const uint8_t FIELD_NTHREADS_AVG = 8;
557 
558  public:
559  typedef std::unique_ptr<Item_CPU> Ptr;
560 
564 
565  Item_CPU() noexcept : percent_user(), percent_sys(), nthreads() { }
566 
567  virtual ~Item_CPU() noexcept { }
568 
570  const DB::Cell::KeyVec& parent_key) override {
571  DB::Cell::KeyVec key;
572  key.reserve(parent_key.size() + 1);
573  key.copy(parent_key);
574  key.add("cpu");
575 
576  DB::Cells::Cell cell;
577  cell.flag = DB::Cells::INSERT;
578  cell.set_time_order_desc(true);
579  cell.key.add(key);
580 
582  wfields.add(Core::Vector<int64_t>({
583  FIELD_CPU_U_PERC_MIN,
584  FIELD_CPU_U_PERC_MAX,
585  FIELD_CPU_U_PERC_AVG,
586  FIELD_CPU_S_PERC_MIN,
587  FIELD_CPU_S_PERC_MAX,
588  FIELD_CPU_S_PERC_AVG,
589  FIELD_NTHREADS_MIN,
590  FIELD_NTHREADS_MAX,
591  FIELD_NTHREADS_AVG,
592  }));
594  "u_min",
595  "u_max",
596  "u_avg",
597  "s_min",
598  "s_max",
599  "s_avg",
600  "t_min",
601  "t_max",
602  "t_avg"
603  }));
605  "User %m Minimal",
606  "User %m Maximal",
607  "User %m Average",
608  "Sys %m Minimal",
609  "Sys %m Maximal",
610  "Sys %m Average",
611  "Threads Minimal",
612  "Threads Maximal",
613  "Threads Average"
614  }));
615  wfields.add(Core::Vector<int64_t>({
625  }));
626  cell.set_value(DB::Types::Encoder::ZSTD, wfields.base, wfields.fill());
627  colp->add(cell);
628  }
629 
630  virtual void report(uint64_t for_ns,
632  const DB::Cell::KeyVec& parent_key) override {
633 
635  percent_user.gather(_percent_user);
636 
638  percent_sys.gather(_percent_sys);
639 
641  nthreads.gather(_nthreads);
642 
643  size_t sz = encoded_length(_percent_user, false);
644  sz += encoded_length(_percent_sys, false);
645  sz += encoded_length(_nthreads, false);
646  if(!sz)
647  return;
648 
649  DB::Cell::KeyVec key;
650  key.reserve(parent_key.size() + 1);
651  key.copy(parent_key);
652  key.add("cpu");
653 
654  DB::Cells::Cell cell;
655  cell.flag = DB::Cells::INSERT;
656  cell.set_time_order_desc(true);
657  cell.set_timestamp(for_ns);
658  cell.key.add(key);
659 
661  wfields.ensure(sz);
662  add_value(_percent_user, FIELD_CPU_U_PERC_MIN, false, wfields);
663  add_value(_percent_sys, FIELD_CPU_S_PERC_MIN, false, wfields);
664  add_value(_nthreads, FIELD_NTHREADS_MIN, false, wfields);
665 
666  cell.set_value(wfields.base, wfields.fill(), false);
667  colp->add(cell);
668  }
669 
670  virtual void reset() override {
671  percent_user.reset();
672  percent_sys.reset();
673  nthreads.reset();
674  }
675 
676 };
677 
678 
679 
680 class Item_FS : public Base {
681  /* Cell-Serialization:
682  key: [levels, "fs", {type}]
683  value: (FIELD_{type} + FS_{cmd}):I:{value}, ...
684  */
685  static constexpr const uint8_t FIELD_FDS = 0;
686  static constexpr const uint8_t FIELD_MIN = 1;
687  static constexpr const uint8_t FIELD_MAX = 2;
688  static constexpr const uint8_t FIELD_COUNT = 3;
689  static constexpr const uint8_t FIELD_AVG = 4;
690  static constexpr const uint8_t FIELD_ERROR = 5;
691 
692  public:
693 
694  typedef std::unique_ptr<Item_FS> Ptr;
696 
697  Item_FS(const FS::FileSystem::Ptr& a_fs) noexcept : fs(a_fs) { }
698 
699  virtual ~Item_FS() noexcept { }
700 
702  const DB::Cell::KeyVec& parent_key) override {
703  DB::Cell::KeyVec key;
704  key.reserve(parent_key.size() + 2);
705  key.copy(parent_key);
706  key.add("fs");
707  key.add(FS::to_string(fs->get_type()));
708 
709  DB::Cells::Cell cell;
710  cell.flag = DB::Cells::INSERT;
711  cell.set_time_order_desc(true);
712  cell.key.add(key);
713 
714  Core::Vector<int64_t> relations;
718  Core::Vector<int64_t> aggregations;
720  names.reserve(ids.size());
721  labels.reserve(ids.size());
722  aggregations.reserve(2 + FS::Statistics::Command::MAX * 4);
723  relations.reserve(1 + FS::Statistics::Command::MAX * 2);
724 
725  int64_t relation=0;
726  for(uint8_t i, c=0; c < FS::Statistics::Command::MAX; ++c) {
728  i = c * 5;
729  ids.push_back(FIELD_COUNT + i);
730  ids.push_back(FIELD_AVG + i);
731  names.push_back(cmd + "_count");
732  names.push_back(cmd + "_avg");
733  labels.push_back(cmd + " Requests Count");
734  labels.push_back(cmd + " Latency ns Average");
735  aggregations.push_back(Aggregation::SUM);
736  aggregations.push_back(Aggregation::AVG_PROP);
737  relations.push_back(++relation);
738  relations.push_back(relation);
739  }
740  ids.push_back(FIELD_FDS);
741  names.push_back("open");
742  labels.push_back("Open File Descriptors");
743  aggregations.push_back(Aggregation::MAX);
744 
745  for(uint8_t i, c=0; c < FS::Statistics::Command::MAX; ++c) {
747  i = c * 5;
748  ids.push_back(FIELD_MIN + i);
749  ids.push_back(FIELD_MAX + i);
750  names.push_back(cmd + "_min");
751  names.push_back(cmd + "_max");
752  labels.push_back(cmd + " Latency ns Minimum");
753  labels.push_back(cmd + " Latency ns Maximum");
754  aggregations.push_back(Aggregation::MIN);
755  aggregations.push_back(Aggregation::MAX);
756  }
757  for(uint8_t i, c=0; c < FS::Statistics::Command::MAX; ++c) {
759  i = c * 5;
760  ids.push_back(FIELD_ERROR + i);
761  names.push_back(cmd + "_error");
762  labels.push_back(cmd + " Errors Count");
763  }
764 
765  size_t sz = 15 + 3 * ids.size();
766  for(uint8_t i=0; i < names.size(); ++i) {
767  sz += names[i].size();
768  sz += labels[i].size();
769  }
771  wfields.ensure(sz);
772  wfields.add(ids);
773  wfields.add(names);
774  wfields.add(labels);
775  wfields.add(aggregations);
776  wfields.add(relations);
777  cell.set_value(DB::Types::Encoder::ZSTD, wfields.base, wfields.fill());
778  colp->add(cell);
779  }
780 
781  virtual void report(uint64_t for_ns,
783  const DB::Cell::KeyVec& parent_key) override {
784  std::unique_ptr<FS::Statistics> statsp(new FS::Statistics(true));
785  FS::Statistics& stats(*statsp.get());
786  fs->statistics.gather(stats);
787  uint64_t open_fds = fs->statistics.fds_count.load();
788 
789  size_t sz = open_fds
790  ? (2 + Serialization::encoded_length_vi64(open_fds))
791  : 0;
792  for(uint8_t cmd=0; cmd < FS::Statistics::Command::MAX; ++cmd) {
793  auto& m = stats.metrics[cmd];
794  if(m.m_count) {
795  uint64_t avg = m.m_total/m.m_count;
796  if(avg != m.m_min)
797  sz += 2 + Serialization::encoded_length_vi64(m.m_min);
798  if(avg != m.m_max)
799  sz += 2 + Serialization::encoded_length_vi64(m.m_max);
800  sz += 2 + Serialization::encoded_length_vi64(avg);
801  if(m.m_error)
802  sz += 2 + Serialization::encoded_length_vi64(m.m_error);
803  sz += 2 + Serialization::encoded_length_vi64(m.m_count);
804  }
805  }
806  if(!sz)
807  return;
808 
809  DB::Cells::Cell cell;
810  cell.flag = DB::Cells::INSERT;
811  cell.set_time_order_desc(true);
812  cell.set_timestamp(for_ns);
813  cell.key.add(parent_key);
814  cell.key.add("fs");
815  cell.key.add(FS::to_string(fs->get_type()));
816 
818  wfields.ensure(sz);
819 
820  if(open_fds)
821  wfields.add(FIELD_FDS, int64_t(open_fds));
822 
823  for(uint8_t i, cmd=0; cmd < FS::Statistics::Command::MAX; ++cmd) {
824  auto& m = stats.metrics[cmd];
825  if(m.m_count) {
826  i = cmd * 5;
827  uint64_t avg = m.m_total/m.m_count;
828  if(avg != m.m_min)
829  wfields.add(FIELD_MIN + i, int64_t(m.m_min));
830  if(avg != m.m_max)
831  wfields.add(FIELD_MAX + i, int64_t(m.m_max));
832  wfields.add(FIELD_COUNT + i, int64_t(m.m_count));
833  wfields.add(FIELD_AVG + i, int64_t(avg));
834  if(m.m_error)
835  wfields.add(FIELD_ERROR + i, int64_t(m.m_error));
836  }
837  }
838 
839  cell.set_value(wfields.base, wfields.fill(), false);
840  colp->add(cell);
841  }
842 
843  virtual void reset() override {
844  fs->statistics.reset();
845  }
846 
847 };
848 
849 
850 
852  public:
853 
854  typedef std::shared_ptr<Reporting> Ptr;
855 
857  const Comm::IoContextPtr& a_io,
860  : client::Query::Update::Handlers::Metric::Reporting(
861  a_clients, a_io, a_cfg_intval, a_executor),
862  system(this), cpu(nullptr), mem(nullptr) {
863  }
864 
865  virtual Level* configure(const char* group_name, const char* inst_name,
866  const char* host, const Comm::EndPoints& endpoints) {
867  auto level = host ? get_level(host) : nullptr;
868  if(group_name)
869  level = level ? level->get_level(group_name) : get_level(group_name);
870  if(inst_name)
871  level = level ? level->get_level(inst_name) : get_level(inst_name);
872  if(!endpoints.empty()) {
873  std::string port(std::to_string(endpoints.front().port()));
874  level = level ? level->get_level(port.c_str()) : get_level(port.c_str());
875  }
876  SWC_ASSERT(level);
877 
878  level->metrics.emplace_back(cpu = system.cpu);
879  level->metrics.emplace_back(mem = system.mem);
880  return level;
881  }
882 
883  Reporting(const Reporting&) = delete;
884  Reporting(Reporting&&) = delete;
885  Reporting& operator=(const Reporting&) = delete;
887 
888  virtual ~Reporting() noexcept { }
889 
890 
891  struct System final : SWC::System::Notifier {
895 
896  System(Reporting* a_reporting)
897  : reporting(a_reporting),
898  cpu(new Item_CPU()),
899  mem(new Item_Mem()) {
900  }
901 
902  System(const System&) = delete;
903  System(System&&) = delete;
904  System& operator=(const System&) = delete;
905  System& operator=(System&&) = delete;
906 
907  void rss_used_reg(size_t bytes) noexcept override {
908  mem->rss_used_reg.add(bytes / 1048576);
909  }
910 
911  void rss_free(size_t bytes) noexcept override {
912  mem->rss_free.add(bytes / 1048576);
913  }
914 
915  void rss_used(size_t bytes) noexcept override {
916  mem->rss_used.add(bytes / 1048576);
917  }
918 
919  void cpu_user(size_t perc_milli) noexcept override {
920  cpu->percent_user.add(perc_milli);
921  }
922 
923  void cpu_sys(size_t perc_milli) noexcept override {
924  cpu->percent_sys.add(perc_milli);
925  }
926 
927  void cpu_threads(size_t threads) noexcept override {
928  cpu->nthreads.add(threads);
929  }
930 
931  uint64_t get_cpu_ms_interval() const noexcept override {
932  return reporting->cfg_intval->get() * 1000;
933  }
934 
935  } system;
936 
939 
940 };
941 
942 
943 
944 }}}}} // namespace SWC::Common::Query::Update::Metric
945 
946 
947 #endif // swcdb_common_queries_update_MetricsReporting_h
SWC::Common::Query::Update::Metric::Item_Mem::rss_used_reg
Common::Stats::MinMaxAvgCount_Safe< uint64_t > rss_used_reg
Definition: MetricsReporting.h:425
SWC::Common::Query::Update::Metric::Reporting::System::rss_free
void rss_free(size_t bytes) noexcept override
Definition: MetricsReporting.h:911
SWC::Core::Vector::front
constexpr SWC_CAN_INLINE reference front() noexcept
Definition: Vector.h:243
SWC::Common::Query::Update::Metric::Reporting::Reporting
Reporting(const SWC::client::Clients::Ptr &a_clients, const Comm::IoContextPtr &a_io, Config::Property::Value_int32_g::Ptr a_cfg_intval, client::Clients::Flag a_executor=client::Clients::DEFAULT)
Definition: MetricsReporting.h:856
SWC::DB::Cells::Cell::set_value
SWC_CAN_INLINE void set_value(uint8_t *v, uint32_t len, bool owner)
Definition: Cell.h:223
SWC::Common::Query::Update::Metric::Item_Mem::Item_Mem
Item_Mem() noexcept
Definition: MetricsReporting.h:427
SWC::Common::Query::Update::Metric::Item_Net::Addr::conn_open
Core::Atomic< uint64_t > conn_open
Definition: MetricsReporting.h:98
SWC::FS::FileSystem::Ptr
std::shared_ptr< FileSystem > Ptr
Definition: FileSystem.h:104
SWC::Common::Query::Update::Metric::Reporting::operator=
Reporting & operator=(const Reporting &)=delete
SWC::client::Query::Update::Handlers::Metric::Reporting
Definition: Metrics.h:233
SWC::Common::Query::Update::Metric::Item_Mem::definitions
virtual void definitions(client::Query::Update::Handlers::Base::Column *colp, const DB::Cell::KeyVec &parent_key) override
Definition: MetricsReporting.h:431
SWC::Common::Stats::MinMaxAvgCount::count
ValueT count
Definition: Stat.h:19
SWC::Common::Stats::MinMaxAvgCount::total
ValueT total
Definition: Stat.h:20
SWC::Common::Query::Update::Metric::Item_FS::reset
virtual void reset() override
Definition: MetricsReporting.h:843
SWC::Common::Query::Update::Metric::Item_Net::Addr
Definition: MetricsReporting.h:96
SWC::Common::Query::Update::Metric::Reporting::Ptr
std::shared_ptr< Reporting > Ptr
Definition: MetricsReporting.h:854
SWC::client::Clients::DEFAULT
@ DEFAULT
Definition: Clients.h:61
SWC::Core::Atomic< uint64_t >
SWC::DB::Cell::KeyVec
Definition: CellKeyVec.h:21
SWC::Common::Query::Update::Metric::Reporting::mem
Item_Mem * mem
Definition: MetricsReporting.h:938
SWC::FS::Statistics::Metric::m_total
uint64_t m_total
Definition: Statistics.h:108
SWC::FS::Statistics::to_string
static const char *SWC_CONST_FUNC to_string(Command cmd) noexcept
Definition: Statistics.cc:64
SWC::System::Notifier
Definition: Resources.h:22
SWC::Common::Query::Update::Metric::Item_Net::disconnected
SWC_CAN_INLINE void disconnected(const Comm::ConnHandlerPtr &conn) noexcept
Definition: MetricsReporting.h:160
SWC::Comm::EndPoint
asio::ip::tcp::endpoint EndPoint
Definition: Resolver.h:19
SWC::Common::Query::Update::Metric::Item_Net::received
SWC_CAN_INLINE void received(const Comm::ConnHandlerPtr &conn, size_t bytes) noexcept
Definition: MetricsReporting.h:184
SWC::Common::Query::Update::Metric::Item_FS
Definition: MetricsReporting.h:680
SWC::Common::Query::Update::Metric::Item_Mem::rss_free
Common::Stats::MinMaxAvgCount_Safe< uint64_t > rss_free
Definition: MetricsReporting.h:423
SWC::Common::Query::Update::Metric::Reporting::configure
virtual Level * configure(const char *group_name, const char *inst_name, const char *host, const Comm::EndPoints &endpoints)
Definition: MetricsReporting.h:865
SWC::client::Clients::Ptr
ClientsPtr Ptr
Definition: Clients.h:58
SWC::Comm::IoContextPtr
std::shared_ptr< IoContext > IoContextPtr
Definition: IoContext.h:16
SWC::Common::Stats::MinMaxAvgCount::avg
SWC_CAN_INLINE ValueT avg() const noexcept
Definition: Stat.h:40
SWC::Core::BufferDyn::ensure
SWC_CAN_INLINE void ensure(size_t len)
Definition: Buffer.h:212
SWC::client::Query::Update::Handlers::Metric::MIN
@ MIN
Definition: Metrics.h:28
SWC::Common::Query::Update::Metric::Item_Net::definitions
virtual void definitions(client::Query::Update::Handlers::Base::Column *colp, const DB::Cell::KeyVec &parent_key) override
Definition: MetricsReporting.h:189
SWC::Common::Query::Update::Metric::Item_Net::sent
SWC_CAN_INLINE void sent(const Comm::ConnHandlerPtr &conn, size_t bytes) noexcept
Definition: MetricsReporting.h:178
SWC::DB::Cells::Cell
Definition: Cell.h:92
SWC::Common::Query::Update::Metric::Item_Net::Addr::conn_est
Core::Atomic< uint64_t > conn_est
Definition: MetricsReporting.h:100
SWC::Common::Query::Update::Metric::Item_Net::get
SWC_CAN_INLINE Addr * get(const asio::ip::address &for_addr, bool secure) const noexcept
Definition: MetricsReporting.h:124
SWC::client::Query::Update::Handlers::Metric::MAX
@ MAX
Definition: Metrics.h:29
SWC::Config::Property::Value_int32_g::get
SWC_CAN_INLINE int32_t get() const noexcept
Definition: Property.h:610
SWC::Common::Query::Update::Metric::Item_CPU::reset
virtual void reset() override
Definition: MetricsReporting.h:670
SWC::DB::Cells::Cell::key
DB::Cell::Key key
Definition: Cell.h:357
SWC::Common::Query::Update::Metric::Reporting::System::reporting
Reporting * reporting
Definition: MetricsReporting.h:892
SWC::DB::Cell::Serial::Value::FieldsWriter::add
SWC_CAN_INLINE void add(Field *field)
Definition: CellValueSerialFields.h:42
SWC::Common::Query::Update::Metric::Item_Mem::Ptr
std::unique_ptr< Item_Mem > Ptr
Definition: MetricsReporting.h:421
SWC::Common::Query::Update::Metric::Item_Net::Addr::bytes_recv
Common::Stats::MinMaxAvgCount_Safe< uint64_t > bytes_recv
Definition: MetricsReporting.h:102
SWC::Common::Stats::MinMaxAvgCount_Safe< uint64_t >
SWC::Common::Stats::MinMaxAvgCount< uint64_t >
SWC::client::Query::Update::Handlers::Metric::Reporting::cfg_intval
Config::Property::Value_int32_g::Ptr cfg_intval
Definition: Metrics.h:239
SWC::DB::Cell::Key::add
SWC_CAN_INLINE void add(const std::string_view &fraction)
Definition: CellKey.h:86
SWC::Common::Query::Update::Metric::Reporting::System::System
System(System &&)=delete
SWC::client::Query::Update::Handlers::Metric::AVG
@ AVG
Definition: Metrics.h:30
SWC::Common::Query::Update::Metric::Item_Net::command
SWC_CAN_INLINE void command(const Comm::ConnHandlerPtr &conn, uint8_t cmd) noexcept
Definition: MetricsReporting.h:166
SWC::Common::Query::Update::Metric::Item_Net::Addr::addr
const asio::ip::address addr
Definition: MetricsReporting.h:97
SWC::FS::Statistics::Command
Command
Definition: Statistics.h:21
SWC::Core::Vector::empty
constexpr SWC_CAN_INLINE bool empty() const noexcept
Definition: Vector.h:168
SWC_CAN_INLINE
#define SWC_CAN_INLINE
Definition: Compat.h:102
SWC::Common::Query::Update::Metric::Item_Mem
Definition: MetricsReporting.h:403
SWC::Common::Query::Update::Metric::Reporting::System::cpu_user
void cpu_user(size_t perc_milli) noexcept override
Definition: MetricsReporting.h:919
SWC::Core::Buffer::base
value_type * base
Definition: Buffer.h:131
SWC::FS::Statistics::metrics
Metric metrics[Command::MAX]
Definition: Statistics.h:128
Metrics.h
SWC
The SWC-DB C++ namespace 'SWC'.
Definition: main.cc:12
SWC::Common::Query::Update::Metric::Item_Net::~Item_Net
virtual ~Item_Net() noexcept
Definition: MetricsReporting.h:121
SWC::DB::Cell::KeyVec::size
constexpr SWC_CAN_INLINE size_type size() const noexcept
Definition: Vector.h:189
SWC::Common::Query::Update::Metric::Item_Net::Addr::bytes_sent
Common::Stats::MinMaxAvgCount_Safe< uint64_t > bytes_sent
Definition: MetricsReporting.h:101
SWC::Common::Query::Update::Metric::Reporting::~Reporting
virtual ~Reporting() noexcept
Definition: MetricsReporting.h:888
SWC::Common::Query::Update::Metric::Item_CPU::percent_user
Common::Stats::MinMaxAvgCount_Safe< uint64_t > percent_user
Definition: MetricsReporting.h:561
SWC::Common::Query::Update::Metric::Item_CPU::Ptr
std::unique_ptr< Item_CPU > Ptr
Definition: MetricsReporting.h:559
SWC::Common::Query::Update::Metric::Item_FS::definitions
virtual void definitions(client::Query::Update::Handlers::Base::Column *colp, const DB::Cell::KeyVec &parent_key) override
Definition: MetricsReporting.h:701
SWC::client::Clients::Flag
Flag
Definition: Clients.h:60
SWC::Common::Query::Update::Metric::Item_CPU::report
virtual void report(uint64_t for_ns, client::Query::Update::Handlers::Base::Column *colp, const DB::Cell::KeyVec &parent_key) override
Definition: MetricsReporting.h:630
SWC::Common::Query::Update::Metric::Item_CPU::~Item_CPU
virtual ~Item_CPU() noexcept
Definition: MetricsReporting.h:567
SWC::client::Query::Update::Handlers::Metric::SUM
@ SUM
Definition: Metrics.h:27
SWC::client::Query::Update::Handlers::Base::Column
Definition: Base.h:30
SWC::Common::Query::Update::Metric::Reporting::cpu
Item_CPU * cpu
Definition: MetricsReporting.h:937
SWC::Common::Query::Update::Metric::Item_Net::Item_Net
Item_Net(const Comm::EndPoints &endpoints, bool using_secure)
Definition: MetricsReporting.h:113
SWC::DB::Cells::INSERT
@ INSERT
Definition: Cell.h:62
SWC::Common::Query::Update::Metric::Item_Mem::rss_used
Common::Stats::MinMaxAvgCount_Safe< uint64_t > rss_used
Definition: MetricsReporting.h:424
SWC::Common::Query::Update::Metric::Item_Net::accepted
SWC_CAN_INLINE void accepted(const Comm::EndPoint &endpoint, bool secure) noexcept
Definition: MetricsReporting.h:133
SWC::DB::Cells::Cell::set_time_order_desc
constexpr SWC_CAN_INLINE void set_time_order_desc(bool desc) noexcept
Definition: Cell.h:169
SWC::Common::Query::Update::Metric::Reporting::System::get_cpu_ms_interval
uint64_t get_cpu_ms_interval() const noexcept override
Definition: MetricsReporting.h:931
SWC::Serialization::encoded_length_vi64
constexpr SWC_CAN_INLINE uint8_t encoded_length_vi64(uint64_t val) noexcept
Definition: Serialization.h:272
SWC::client::Query::Update::Handlers::Metric::AVG_PROP
@ AVG_PROP
Definition: Metrics.h:31
SWC::Common::Query::Update::Metric::Item_FS::Ptr
std::unique_ptr< Item_FS > Ptr
Definition: MetricsReporting.h:694
encoded_length
uint8_t encoded_length() noexcept
SWC::Common::Query::Update::Metric::Reporting::System::System
System(const System &)=delete
SWC::Common::Query::Update::Metric::Item_Net::report
virtual void report(uint64_t for_ns, client::Query::Update::Handlers::Base::Column *colp, const DB::Cell::KeyVec &parent_key) override
Definition: MetricsReporting.h:307
SWC::Comm::ConnHandlerPtr
std::shared_ptr< ConnHandler > ConnHandlerPtr
Definition: AppContext.h:17
SWC::DB::Cell::Serial::Value::FieldsWriter
Definition: CellValueSerialFields.h:34
SWC::Common::Query::Update::Metric::Reporting::Reporting
Reporting(Reporting &&)=delete
SWC::Common::Query::Update::Metric::Reporting::System::operator=
System & operator=(System &&)=delete
SWC::Common::Query::Update::Metric::Reporting::System::System
System(Reporting *a_reporting)
Definition: MetricsReporting.h:896
SWC::Common::Query::Update::Metric::Item_FS::Item_FS
Item_FS(const FS::FileSystem::Ptr &a_fs) noexcept
Definition: MetricsReporting.h:697
SWC::Core::Vector< EndPoint >
SWC::Common::Stats::MinMaxAvgCount_Safe::gather
SWC_CAN_INLINE void gather(MinMaxAvgCount< ValueT > &to) noexcept
Definition: Stat.h:108
SWC::Common::Query::Update::Metric::Item_Mem::report
virtual void report(uint64_t for_ns, client::Query::Update::Handlers::Base::Column *colp, const DB::Cell::KeyVec &parent_key) override
Definition: MetricsReporting.h:492
SWC::Common::Query::Update::Metric::Item_CPU
Definition: MetricsReporting.h:541
SWC::Common::Stats::MinMaxAvgCount::min
ValueT min
Definition: Stat.h:21
SWC::Core::BufferDyn::fill
constexpr SWC_CAN_INLINE size_t fill() const noexcept
Definition: Buffer.h:192
SWC::Common::Query::Update::Metric::Item_Mem::reset
virtual void reset() override
Definition: MetricsReporting.h:531
SWC::Common::Query::Update::Metric::Reporting::System::mem
Item_Mem * mem
Definition: MetricsReporting.h:894
SWC::Common::Query::Update::Metric::Reporting::System::cpu
Item_CPU * cpu
Definition: MetricsReporting.h:893
SWC::Common::Query::Update::Metric::Item_Net::Addr::conn_accept
Core::Atomic< uint64_t > conn_accept
Definition: MetricsReporting.h:99
SWC::Common::Query::Update::Metric::Reporting::System::rss_used_reg
void rss_used_reg(size_t bytes) noexcept override
Definition: MetricsReporting.h:907
SWC::Common::Query::Update::Metric::Reporting::System::cpu_sys
void cpu_sys(size_t perc_milli) noexcept override
Definition: MetricsReporting.h:923
SWC::Common::Query::Update::Metric::Item_Net::connected
SWC_CAN_INLINE void connected(const Comm::ConnHandlerPtr &conn) noexcept
Definition: MetricsReporting.h:152
SWC::Common::Query::Update::Metric::Item_CPU::Item_CPU
Item_CPU() noexcept
Definition: MetricsReporting.h:565
SWC::Common::Query::Update::Metric::Reporting::System::operator=
System & operator=(const System &)=delete
SWC::DB::Cell::KeyVec::copy
void copy(const KeyVec &other)
Definition: CellKeyVec.h:181
SWC::Common::Stats::MinMaxAvgCount::max
ValueT max
Definition: Stat.h:22
SWC::Common::Query::Update::Metric::Item_CPU::percent_sys
Common::Stats::MinMaxAvgCount_Safe< uint64_t > percent_sys
Definition: MetricsReporting.h:562
SWC::Common::Query::Update::Metric::Reporting::Reporting
Reporting(const Reporting &)=delete
SWC::FS::Statistics
Definition: Statistics.h:18
SWC::Common::Query::Update::Metric::Item_Net::Ptr
std::unique_ptr< Item_Net > Ptr
Definition: MetricsReporting.h:94
SWC::Common::Query::Update::Metric::Reporting
Definition: MetricsReporting.h:851
SWC::Common::Query::Update::Metric::Reporting::System::rss_used
void rss_used(size_t bytes) noexcept override
Definition: MetricsReporting.h:915
SWC::Common::Query::Update::Metric::Item_Mem::~Item_Mem
virtual ~Item_Mem() noexcept
Definition: MetricsReporting.h:429
SWC::Common::Query::Update::Metric::Item_FS::report
virtual void report(uint64_t for_ns, client::Query::Update::Handlers::Base::Column *colp, const DB::Cell::KeyVec &parent_key) override
Definition: MetricsReporting.h:781
SWC::Common::Query::Update::Metric::Reporting::operator=
Reporting & operator=(Reporting &&)=delete
SWC::Common::Query::Update::Metric::Item_CPU::nthreads
Common::Stats::MinMaxAvgCount_Safe< uint64_t > nthreads
Definition: MetricsReporting.h:563
SWC::Common::Query::Update::Metric::Item_FS::~Item_FS
virtual ~Item_FS() noexcept
Definition: MetricsReporting.h:699
SWC::Common::Query::Update::Metric::Item_Net::connected
SWC_CAN_INLINE void connected() noexcept
Definition: MetricsReporting.h:139
SWC::Core::Vector::push_back
SWC_CAN_INLINE void push_back(ArgsT &&... args)
Definition: Vector.h:331
SWC::DB::Cell::KeyVec::add
SWC_CAN_INLINE void add(const Fraction &fraction)
Definition: CellKeyVec.h:62
SWC_ASSERT
#define SWC_ASSERT(_e_)
Definition: Exception.h:165
SWC::client::Query::Update::Handlers::Base::Column::add
virtual size_t add(const DynamicBuffer &cells, const DB::Cell::Key &upto_key, const DB::Cell::Key &from_key, uint32_t skip, bool malformed)=0
SWC::client::Query::Update::Handlers::Metric::Level
Definition: Metrics.h:80
SWC::Common::Query::Update::Metric::Item_Net
Definition: MetricsReporting.h:72
SWC::Core::to_string
SWC_CAN_INLINE std::string to_string(const BitFieldInt< T, SZ > &v)
Definition: BitFieldInt.h:263
SWC::Common::Query::Update::Metric::Item_Net::error
SWC_CAN_INLINE void error(const Comm::ConnHandlerPtr &conn) noexcept
Definition: MetricsReporting.h:172
SWC::Common::Stats::MinMaxAvgCount_Safe::reset
SWC_CAN_INLINE void reset() noexcept
Definition: Stat.h:114
SWC::Core::Vector::size
constexpr SWC_CAN_INLINE size_type size() const noexcept
Definition: Vector.h:189
SWC::client::Query::Update::Handlers::Metric::Base
Definition: Metrics.h:46
Interface.h
Resources.h
SWC::Common::Query::Update::Metric::Reporting::System
Definition: MetricsReporting.h:891
SWC::Common::Query::Update::Metric::Item_Net::reset
virtual void reset() override
Definition: MetricsReporting.h:376
SWC::Common::Query::Update::Metric::Item_Net::disconnected
SWC_CAN_INLINE void disconnected() noexcept
Definition: MetricsReporting.h:146
SWC::Common::Query::Update::Metric::Item_FS::fs
FS::FileSystem::Ptr fs
Definition: MetricsReporting.h:695
SWC::Common::Query::Update::Metric::Reporting::System::cpu_threads
void cpu_threads(size_t threads) noexcept override
Definition: MetricsReporting.h:927
SWC::Common::Query::Update::Metric::Item_CPU::definitions
virtual void definitions(client::Query::Update::Handlers::Base::Column *colp, const DB::Cell::KeyVec &parent_key) override
Definition: MetricsReporting.h:569
SWC::Config::Property::Value_int32_g
Definition: Property.h:586
SWC::Core::Vector::reserve
SWC_CAN_INLINE void reserve(size_type cap)
Definition: Vector.h:288
SWC::DB::Cells::Cell::flag
uint8_t flag
Definition: Cell.h:359
SWC::FS::to_string
const char *SWC_CONST_FUNC to_string(Type typ) noexcept
Definition: FileSystem.cc:47
SWC::Common::Query::Update::Metric::Item_Net::Addr::Addr
SWC_CAN_INLINE Addr(const Comm::EndPoint &endpoint) noexcept
Definition: MetricsReporting.h:106
SWC::Common::Stats::MinMaxAvgCount_Safe::add
SWC_CAN_INLINE void add(ValueT v) noexcept
Definition: Stat.h:72
SWC::DB::Cells::Cell::set_timestamp
constexpr SWC_CAN_INLINE void set_timestamp(int64_t ts) noexcept
Definition: Cell.h:182