mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 12: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
|
@ -31,6 +31,10 @@ class Registry;
|
|||
|
||||
namespace zeek::telemetry {
|
||||
|
||||
namespace detail {
|
||||
using CollectCallbackPtr = std::function<double()>;
|
||||
}
|
||||
|
||||
class ZeekCollectable;
|
||||
|
||||
/**
|
||||
|
@ -98,12 +102,12 @@ public:
|
|||
*/
|
||||
CounterPtr CounterInstance(std::string_view prefix, std::string_view name, Span<const LabelView> labels,
|
||||
std::string_view helptext, std::string_view unit = "",
|
||||
prometheus::CollectCallbackPtr callback = nullptr);
|
||||
detail::CollectCallbackPtr callback = nullptr);
|
||||
|
||||
/// @copydoc counterInstance
|
||||
CounterPtr CounterInstance(std::string_view prefix, std::string_view name, std::initializer_list<LabelView> labels,
|
||||
std::string_view helptext, std::string_view unit = "",
|
||||
prometheus::CollectCallbackPtr callback = nullptr);
|
||||
detail::CollectCallbackPtr callback = nullptr);
|
||||
|
||||
/**
|
||||
* @return A gauge metric family. Creates the family lazily if necessary.
|
||||
|
@ -134,12 +138,12 @@ public:
|
|||
*/
|
||||
GaugePtr GaugeInstance(std::string_view prefix, std::string_view name, Span<const LabelView> labels,
|
||||
std::string_view helptext, std::string_view unit = "",
|
||||
prometheus::CollectCallbackPtr callback = nullptr);
|
||||
detail::CollectCallbackPtr callback = nullptr);
|
||||
|
||||
/// @copydoc GaugeInstance
|
||||
GaugePtr GaugeInstance(std::string_view prefix, std::string_view name, std::initializer_list<LabelView> labels,
|
||||
std::string_view helptext, std::string_view unit = "",
|
||||
prometheus::CollectCallbackPtr callback = nullptr);
|
||||
detail::CollectCallbackPtr callback = nullptr);
|
||||
|
||||
// Forces the compiler to use the type `Span<const T>` instead of trying to
|
||||
// match parameters to a `span`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue