mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
Move thread manager stats to telemetry metric
This commit is contained in:
parent
a81f6ab9a6
commit
4face43462
6 changed files with 105 additions and 3 deletions
|
@ -8,6 +8,7 @@
|
|||
#include "zeek/NetVar.h"
|
||||
#include "zeek/RunState.h"
|
||||
#include "zeek/iosource/Manager.h"
|
||||
#include "zeek/telemetry/Manager.h"
|
||||
|
||||
namespace zeek::threading {
|
||||
namespace detail {
|
||||
|
@ -36,6 +37,17 @@ Manager::~Manager() {
|
|||
Terminate();
|
||||
}
|
||||
|
||||
void Manager::InitPostScript() {
|
||||
num_threads_metric =
|
||||
telemetry_mgr->GaugeInstance("zeek", "active_threads", {}, "Number of active threads", "",
|
||||
[]() -> prometheus::ClientMetric {
|
||||
prometheus::ClientMetric metric;
|
||||
metric.gauge.value =
|
||||
thread_mgr ? static_cast<double>(thread_mgr->all_threads.size()) : 0.0;
|
||||
return metric;
|
||||
});
|
||||
}
|
||||
|
||||
void Manager::Terminate() {
|
||||
DBG_LOG(DBG_THREADING, "Terminating thread manager ...");
|
||||
terminating = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue