Disable metrics by default

This commit is contained in:
Chris Spiegel 2025-11-06 05:18:26 -08:00
parent 48311896f8
commit 1d9f06d4ac
3 changed files with 10 additions and 7 deletions

View file

@ -1,6 +1,10 @@
ZeroTier Release Notes
======
## WORK-IN-PROGRESS
* Metrics collection is now disabled by default. It can be enabled via the `enableMetrics` setting in `local.conf`.
## 2025-08-21 -- Version 1.16.0
* License Changes

View file

@ -988,7 +988,6 @@ class OneServiceImpl : public OneService {
_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");
@ -2932,13 +2931,13 @@ class OneServiceImpl : public OneService {
}
}
bool disableMetrics = OSUtils::jsonBool(settings["disableMetrics"], false);
if (disableMetrics) {
std::shared_ptr<prometheus::Registry> registry;
prometheus::simpleapi::saver.set_registry(registry);
bool enableMetrics = OSUtils::jsonBool(settings["enableMetrics"], false);
if (enableMetrics) {
prometheus::simpleapi::saver.set_registry(prometheus::simpleapi::registry_ptr);
}
else {
prometheus::simpleapi::saver.set_registry(prometheus::simpleapi::registry_ptr);
std::shared_ptr<prometheus::Registry> registry;
prometheus::simpleapi::saver.set_registry(registry);
}
}

View file

@ -42,7 +42,7 @@ Settings available in `local.conf` (this is not valid JSON, and JSON does not al
"bind": [ "ip",... ], /* If present and non-null, bind to these IPs instead of to each interface (wildcard IP allowed) */
"allowTcpFallbackRelay": true|false, /* Allow or disallow establishment of TCP relay connections (true by default) */
"multipathMode": 0|1|2, /* multipath mode: none (0), random (1), proportional (2) */
"disableMetrics": true|false /* If true, disable the collection of metrics in metrics.prom. */
"enableMetrics": true|false /* If true, enable the collection of metrics in metrics.prom. */
}
}
```