mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-07-23 02:42:49 +02:00
Fix runtime issues with metrics
This commit is contained in:
parent
1bb3d86e10
commit
688a67136e
3 changed files with 18 additions and 14 deletions
|
@ -1,5 +1,13 @@
|
|||
#include <prometheus/simpleapi.h>
|
||||
|
||||
namespace prometheus {
|
||||
namespace simpleapi {
|
||||
std::shared_ptr<Registry> registry_ptr = std::make_shared<Registry>();
|
||||
Registry& registry = *registry_ptr;
|
||||
SaveToFile saver;
|
||||
}
|
||||
}
|
||||
|
||||
namespace ZeroTier {
|
||||
namespace Metrics {
|
||||
// General Controller Metrics
|
||||
|
|
|
@ -3,6 +3,12 @@
|
|||
|
||||
#include <prometheus/simpleapi.h>
|
||||
|
||||
namespace prometheus {
|
||||
namespace simpleapi {
|
||||
extern std::shared_ptr<Registry> registry_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
namespace ZeroTier {
|
||||
namespace Metrics {
|
||||
// General Controller Metrics
|
||||
|
|
|
@ -87,17 +87,7 @@
|
|||
#include "../ext/http-parser/http_parser.h"
|
||||
#endif
|
||||
|
||||
#include <prometheus/simpleapi.h>
|
||||
|
||||
namespace prometheus {
|
||||
namespace simpleapi {
|
||||
|
||||
std::shared_ptr<Registry> registry_ptr = std::make_shared<Registry>();
|
||||
Registry& registry = *registry_ptr;
|
||||
SaveToFile saver;
|
||||
}
|
||||
}
|
||||
|
||||
#include "../node/Metrics.hpp"
|
||||
|
||||
#if ZT_VAULT_SUPPORT
|
||||
extern "C" {
|
||||
|
@ -858,9 +848,9 @@ public:
|
|||
_ports[1] = 0;
|
||||
_ports[2] = 0;
|
||||
|
||||
::prometheus::simpleapi::saver.set_registry(::prometheus::simpleapi::registry_ptr);
|
||||
::prometheus::simpleapi::saver.set_delay(std::chrono::seconds(5));
|
||||
::prometheus::simpleapi::saver.set_out_file(_homePath + ZT_PATH_SEPARATOR + "metrics.prom");
|
||||
prometheus::simpleapi::saver.set_registry(prometheus::simpleapi::registry_ptr);
|
||||
prometheus::simpleapi::saver.set_delay(std::chrono::seconds(5));
|
||||
prometheus::simpleapi::saver.set_out_file(_homePath + ZT_PATH_SEPARATOR + "metrics.prom");
|
||||
|
||||
#if ZT_VAULT_SUPPORT
|
||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||
|
|
Loading…
Add table
Reference in a new issue