mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 11:38:20 +00:00
EventHandler: Use telemetry framework for EventHandler.call_count
Put the IntCounter into a std::optional rather than initializing it at EventHandler construction time as that will currently expose a time series per event handler through the Prometheus API.
This commit is contained in:
parent
a40025b82d
commit
56a8b99965
4 changed files with 42 additions and 3 deletions
|
@ -0,0 +1,21 @@
|
|||
# @TEST-DOC: Query for zeek event-handler-invocations metrics counting number of times handlers were called.
|
||||
|
||||
# Note compilable to C++ due to globals being initialized to a record that
|
||||
# has an opaque type as a field.
|
||||
# @TEST-REQUIRES: test "${ZEEK_USE_CPP}" != "1"
|
||||
# @TEST-EXEC: zcat <$TRACES/echo-connections.pcap.gz | zeek -b -Cr - %INPUT > out
|
||||
# @TEST-EXEC: btest-diff out
|
||||
# @TEST-EXEC-FAIL: test -f reporter.log
|
||||
|
||||
@load base/frameworks/telemetry
|
||||
|
||||
|
||||
event zeek_done() &priority=-100
|
||||
{
|
||||
local ms = Telemetry::collect_metrics("zeek", "event-handler-invocations");
|
||||
for ( _, m in ms )
|
||||
{
|
||||
if ( /zeek_.*|connection_.*/ in cat(m$labels))
|
||||
print m$opts$prefix, m$opts$name, m$labels, m$count_value;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue