mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 03:28:19 +00:00
Add new Timer class to the telemetry API
This commit is contained in:
parent
6e6b83bd96
commit
27a39941db
2 changed files with 68 additions and 0 deletions
|
@ -4,9 +4,12 @@
|
|||
|
||||
#include "caf/telemetry/metric_registry.hpp"
|
||||
|
||||
#include <thread>
|
||||
|
||||
#include "zeek/3rdparty/doctest.h"
|
||||
|
||||
#include "zeek/telemetry/Detail.h"
|
||||
#include "zeek/telemetry/Timer.h"
|
||||
|
||||
namespace zeek::telemetry {
|
||||
|
||||
|
@ -524,6 +527,16 @@ SCENARIO("telemetry managers provide access to histogram families")
|
|||
auto second = family.GetOrAdd({{"protocol", "udp"}});
|
||||
CHECK_NE(first, second);
|
||||
}
|
||||
AND_THEN("Timers add observations to histograms")
|
||||
{
|
||||
auto hg = family.GetOrAdd({{"protocol", "tst"}});
|
||||
CHECK_EQ(hg.Sum(), 0.0);
|
||||
{
|
||||
Timer observer{hg};
|
||||
std::this_thread::sleep_for(1ms);
|
||||
}
|
||||
CHECK_NE(hg.Sum(), 0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue