mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Convert telemetry code to use prometheus-cpp
This commit is contained in:
parent
97a35011a7
commit
a0ae06b3cd
22 changed files with 1517 additions and 1195 deletions
|
@ -9,7 +9,6 @@
|
|||
#include "zeek/Type.h"
|
||||
#include "zeek/ZeekArgs.h"
|
||||
#include "zeek/ZeekList.h"
|
||||
#include "zeek/telemetry/Counter.h"
|
||||
|
||||
namespace zeek {
|
||||
|
||||
|
@ -17,6 +16,10 @@ namespace run_state {
|
|||
extern double network_time;
|
||||
} // namespace run_state
|
||||
|
||||
namespace telemetry {
|
||||
class IntCounter;
|
||||
}
|
||||
|
||||
class Func;
|
||||
using FuncPtr = IntrusivePtr<Func>;
|
||||
|
||||
|
@ -60,7 +63,8 @@ public:
|
|||
void SetGenerateAlways(bool arg_generate_always = true) { generate_always = arg_generate_always; }
|
||||
bool GenerateAlways() const { return generate_always; }
|
||||
|
||||
uint64_t CallCount() const { return call_count ? call_count->Value() : 0; }
|
||||
// Returns the number of times this EventHandler has been called since startup.
|
||||
uint64_t CallCount() const;
|
||||
|
||||
private:
|
||||
void NewEvent(zeek::Args* vl); // Raise new_event() meta event.
|
||||
|
@ -74,7 +78,7 @@ private:
|
|||
bool generate_always;
|
||||
|
||||
// Initialize this lazy, so we don't expose metrics for 0 values.
|
||||
std::optional<zeek::telemetry::IntCounter> call_count;
|
||||
std::shared_ptr<zeek::telemetry::IntCounter> call_count;
|
||||
|
||||
std::unordered_set<std::string> auto_publish;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue