1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-27 17:28:41 +00:00

Add more Prometheus metrics (#12274)

This commit is contained in:
sfan5 2022-05-09 21:20:58 +02:00 committed by GitHub
parent c2898f53bc
commit f5a8593b11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 225 additions and 120 deletions

View file

@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "settings.h"
#include "server/activeobjectmgr.h"
#include "util/numeric.h"
#include "util/metricsbackend.h"
#include <set>
#include <random>
@ -167,19 +168,21 @@ public:
std::set<v3s16> &blocks_removed,
std::set<v3s16> &blocks_added);
bool contains(v3s16 p){
bool contains(v3s16 p) const {
return (m_list.find(p) != m_list.end());
}
void clear(){
auto size() const {
return m_list.size();
}
void clear() {
m_list.clear();
}
std::set<v3s16> m_list;
std::set<v3s16> m_abm_list;
std::set<v3s16> m_forceloaded_list;
private:
};
/*
@ -198,7 +201,7 @@ class ServerEnvironment : public Environment
{
public:
ServerEnvironment(ServerMap *map, ServerScripting *scriptIface,
Server *server, const std::string &path_world);
Server *server, const std::string &path_world, MetricsBackend *mb);
~ServerEnvironment();
Map & getMap();
@ -487,5 +490,10 @@ private:
std::unordered_map<u32, float> m_particle_spawners;
std::unordered_map<u32, u16> m_particle_spawner_attachments;
// Environment metrics
MetricCounterPtr m_step_time_counter;
MetricGaugePtr m_active_block_gauge;
MetricGaugePtr m_active_object_gauge;
ServerActiveObject* createSAO(ActiveObjectType type, v3f pos, const std::string &data);
};