mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-22 06:14:02 -07: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>
|
#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 ZeroTier {
|
||||||
namespace Metrics {
|
namespace Metrics {
|
||||||
// General Controller Metrics
|
// General Controller Metrics
|
||||||
|
|
|
@ -3,6 +3,12 @@
|
||||||
|
|
||||||
#include <prometheus/simpleapi.h>
|
#include <prometheus/simpleapi.h>
|
||||||
|
|
||||||
|
namespace prometheus {
|
||||||
|
namespace simpleapi {
|
||||||
|
extern std::shared_ptr<Registry> registry_ptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace ZeroTier {
|
namespace ZeroTier {
|
||||||
namespace Metrics {
|
namespace Metrics {
|
||||||
// General Controller Metrics
|
// General Controller Metrics
|
||||||
|
|
|
@ -87,17 +87,7 @@
|
||||||
#include "../ext/http-parser/http_parser.h"
|
#include "../ext/http-parser/http_parser.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <prometheus/simpleapi.h>
|
#include "../node/Metrics.hpp"
|
||||||
|
|
||||||
namespace prometheus {
|
|
||||||
namespace simpleapi {
|
|
||||||
|
|
||||||
std::shared_ptr<Registry> registry_ptr = std::make_shared<Registry>();
|
|
||||||
Registry& registry = *registry_ptr;
|
|
||||||
SaveToFile saver;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#if ZT_VAULT_SUPPORT
|
#if ZT_VAULT_SUPPORT
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -858,9 +848,9 @@ public:
|
||||||
_ports[1] = 0;
|
_ports[1] = 0;
|
||||||
_ports[2] = 0;
|
_ports[2] = 0;
|
||||||
|
|
||||||
::prometheus::simpleapi::saver.set_registry(::prometheus::simpleapi::registry_ptr);
|
prometheus::simpleapi::saver.set_registry(prometheus::simpleapi::registry_ptr);
|
||||||
::prometheus::simpleapi::saver.set_delay(std::chrono::seconds(5));
|
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_out_file(_homePath + ZT_PATH_SEPARATOR + "metrics.prom");
|
||||||
|
|
||||||
#if ZT_VAULT_SUPPORT
|
#if ZT_VAULT_SUPPORT
|
||||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue