mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38: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
|
@ -343,27 +343,15 @@ void Manager::InitPostScript() {
|
|||
|
||||
num_peers_metric =
|
||||
telemetry_mgr->GaugeInstance("zeek", "broker_peers", {}, "Current number of peers connected via broker", "",
|
||||
[]() -> prometheus::ClientMetric {
|
||||
prometheus::ClientMetric metric;
|
||||
metric.gauge.value = static_cast<double>(broker_mgr->peer_count);
|
||||
return metric;
|
||||
});
|
||||
[]() { return static_cast<double>(broker_mgr->peer_count); });
|
||||
|
||||
num_stores_metric =
|
||||
telemetry_mgr->GaugeInstance("zeek", "broker_stores", {}, "Current number of stores connected via broker", "",
|
||||
[]() -> prometheus::ClientMetric {
|
||||
prometheus::ClientMetric metric;
|
||||
metric.gauge.value = static_cast<double>(broker_mgr->data_stores.size());
|
||||
return metric;
|
||||
});
|
||||
[]() { return static_cast<double>(broker_mgr->data_stores.size()); });
|
||||
|
||||
num_pending_queries_metric =
|
||||
telemetry_mgr->GaugeInstance("zeek", "broker_pending_queries", {}, "Current number of pending broker queries",
|
||||
"", []() -> prometheus::ClientMetric {
|
||||
prometheus::ClientMetric metric;
|
||||
metric.gauge.value = static_cast<double>(broker_mgr->pending_queries.size());
|
||||
return metric;
|
||||
});
|
||||
"", []() { return static_cast<double>(broker_mgr->pending_queries.size()); });
|
||||
|
||||
num_events_incoming_metric = telemetry_mgr->CounterInstance("zeek", "broker_incoming_events", {},
|
||||
"Total number of incoming events via broker");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue