Metrics.hpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (c)2013-2023 ZeroTier, Inc.
  3. *
  4. * Use of this software is governed by the Business Source License included
  5. * in the LICENSE.TXT file in the project's root directory.
  6. *
  7. * Change Date: 2025-01-01
  8. *
  9. * On the date above, in accordance with the Business Source License, use
  10. * of this software will be governed by version 2.0 of the Apache License.
  11. */
  12. #ifndef METRICS_H_
  13. #define METRICS_H_
  14. #include <prometheus/simpleapi.h>
  15. namespace prometheus {
  16. namespace simpleapi {
  17. extern std::shared_ptr<Registry> registry_ptr;
  18. }
  19. }
  20. namespace ZeroTier {
  21. namespace Metrics {
  22. // Data Sent/Received Metrics
  23. extern prometheus::simpleapi::counter_metric_t udp_send;
  24. extern prometheus::simpleapi::counter_metric_t udp_recv;
  25. extern prometheus::simpleapi::counter_metric_t tcp_send;
  26. extern prometheus::simpleapi::counter_metric_t tcp_recv;
  27. // General Controller Metrics
  28. extern prometheus::simpleapi::gauge_metric_t network_count;
  29. extern prometheus::simpleapi::gauge_metric_t member_count;
  30. extern prometheus::simpleapi::counter_metric_t network_changes;
  31. extern prometheus::simpleapi::counter_metric_t member_changes;
  32. extern prometheus::simpleapi::counter_metric_t member_auths;
  33. extern prometheus::simpleapi::counter_metric_t member_deauths;
  34. #ifdef ZT_CONTROLLER_USE_LIBPQ
  35. // Central Controller Metrics
  36. extern prometheus::simpleapi::counter_metric_t pgsql_mem_notification;
  37. extern prometheus::simpleapi::counter_metric_t pgsql_net_notification;
  38. extern prometheus::simpleapi::counter_metric_t redis_mem_notification;
  39. extern prometheus::simpleapi::counter_metric_t redis_net_notification;
  40. // Central DB Pool Metrics
  41. extern prometheus::simpleapi::counter_metric_t conn_counter;
  42. extern prometheus::simpleapi::counter_metric_t max_pool_size;
  43. extern prometheus::simpleapi::counter_metric_t min_pool_size;
  44. extern prometheus::simpleapi::gauge_metric_t pool_avail;
  45. extern prometheus::simpleapi::gauge_metric_t pool_in_use;
  46. extern prometheus::simpleapi::counter_metric_t pool_errors;
  47. #endif
  48. } // namespace Metrics
  49. }// namespace ZeroTier
  50. #endif // METRICS_H_