mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 22:58:20 +00:00
telemetry: Move callbacks to Zeek
Now that we run callbacks on the main loop, we can move callback support for Counter and Gauge instances directly into Zeek and don't need to patch prometheus-cpp anymore.
This commit is contained in:
parent
c7fcdc4050
commit
48dd89ef33
15 changed files with 143 additions and 186 deletions
|
@ -435,13 +435,9 @@ Manager::~Manager() { delete pending; }
|
|||
void Manager::InitPostScript() {
|
||||
trigger_count = telemetry_mgr->CounterInstance("zeek", "triggers", {}, "Total number of triggers scheduled");
|
||||
trigger_pending =
|
||||
telemetry_mgr->GaugeInstance("zeek", "pending_triggers", {}, "Pending number of triggers", "",
|
||||
[]() -> prometheus::ClientMetric {
|
||||
prometheus::ClientMetric metric;
|
||||
metric.gauge.value =
|
||||
trigger_mgr ? static_cast<double>(trigger_mgr->pending->size()) : 0.0;
|
||||
return metric;
|
||||
});
|
||||
telemetry_mgr->GaugeInstance("zeek", "pending_triggers", {}, "Pending number of triggers", "", []() {
|
||||
return trigger_mgr ? static_cast<double>(trigger_mgr->pending->size()) : 0.0;
|
||||
});
|
||||
|
||||
iosource_mgr->Register(this, true);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue