mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00

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.
36 lines
812 B
C++
36 lines
812 B
C++
// See the file "COPYING" in the main distribution directory for copyright.
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "zeek/Span.h"
|
|
#include "zeek/util.h"
|
|
|
|
namespace zeek::telemetry {
|
|
|
|
/**
|
|
* Manages a collection (family) of metrics. All members of the family share
|
|
* the same prefix (namespace), name, and label dimensions.
|
|
*/
|
|
class MetricFamily {
|
|
public:
|
|
virtual ~MetricFamily() = default;
|
|
|
|
virtual zeek_int_t MetricType() const = 0;
|
|
|
|
std::vector<std::string> LabelNames() const { return label_names; }
|
|
|
|
virtual void RunCallbacks() = 0;
|
|
|
|
protected:
|
|
MetricFamily(Span<const std::string_view> labels) {
|
|
for ( const auto& lbl : labels )
|
|
label_names.emplace_back(lbl);
|
|
}
|
|
|
|
std::vector<std::string> label_names;
|
|
};
|
|
|
|
} // namespace zeek::telemetry
|