diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2020-04-27 08:31:37 +0200 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2020-04-29 07:48:08 +0200 |
commit | 56bababcdfce097a4e08cc3d1de8d798e7999ce7 (patch) | |
tree | aef707d6abdcd86bc1520c668f7e2ee4533a638e /src/server.h | |
parent | a36c9c3e930608386b983ea76158793fe9d622f6 (diff) | |
download | minetest-56bababcdfce097a4e08cc3d1de8d798e7999ce7.tar.gz minetest-56bababcdfce097a4e08cc3d1de8d798e7999ce7.tar.bz2 minetest-56bababcdfce097a4e08cc3d1de8d798e7999ce7.zip |
Add MetricsBackend with prometheus counter support
Diffstat (limited to 'src/server.h')
-rw-r--r-- | src/server.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/server.h b/src/server.h index b995aba28..71059dd30 100644 --- a/src/server.h +++ b/src/server.h @@ -33,6 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "util/numeric.h" #include "util/thread.h" #include "util/basic_macros.h" +#include "util/metricsbackend.h" #include "serverenvironment.h" #include "clientiface.h" #include "chatmessage.h" @@ -203,7 +204,7 @@ public: // Connection must be locked when called std::wstring getStatusString(); - inline double getUptime() const { return m_uptime.m_value; } + inline double getUptime() const { return m_uptime_counter->get(); } // read shutdown state inline bool isShutdownRequested() const { return m_shutdown_state.is_requested; } @@ -591,9 +592,6 @@ private: float m_step_dtime = 0.0f; std::mutex m_step_dtime_mutex; - // current server step lag counter - float m_lag; - // The server mainly operates in this thread ServerThread *m_thread = nullptr; @@ -602,8 +600,6 @@ private: */ // Timer for sending time of day over network float m_time_of_day_send_timer = 0.0f; - // Uptime of server in seconds - MutexedVariable<double> m_uptime; /* Client interface @@ -677,6 +673,19 @@ private: // ModChannel manager std::unique_ptr<ModChannelMgr> m_modchannel_mgr; + + // Global server metrics backend + std::unique_ptr<MetricsBackend> m_metrics_backend; + + // Server metrics + MetricCounterPtr m_uptime_counter; + MetricGaugePtr m_player_gauge; + MetricGaugePtr m_timeofday_gauge; + // current server step lag + MetricGaugePtr m_lag_gauge; + MetricCounterPtr m_aom_buffer_counter; + MetricCounterPtr m_packet_recv_counter; + MetricCounterPtr m_packet_recv_processed_counter; }; /* |