mirror of
https://github.com/zeek/zeek.git
synced 2025-10-09 18:18:19 +00:00
Rework everything to access the prometheus-cpp objects more directly
This commit is contained in:
parent
ec3e68928f
commit
84aa308527
17 changed files with 469 additions and 606 deletions
30
src/telemetry/Utils.h
Normal file
30
src/telemetry/Utils.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
#pragma once
|
||||
|
||||
#include <string_view>
|
||||
|
||||
#include "zeek/Span.h"
|
||||
#include "zeek/Val.h"
|
||||
|
||||
#include "prometheus/family.h"
|
||||
#include "prometheus/labels.h"
|
||||
|
||||
namespace zeek::telemetry {
|
||||
|
||||
using LabelView = std::pair<std::string_view, std::string_view>;
|
||||
|
||||
namespace detail {
|
||||
|
||||
/**
|
||||
* Builds a set of labels for prometheus based on a set of labels from
|
||||
* Zeek. This adds an 'endpoint' label if it's missing from the set.
|
||||
*/
|
||||
prometheus::Labels BuildPrometheusLabels(Span<const LabelView> labels);
|
||||
|
||||
/**
|
||||
* Builds a full metric name for Prometheus from prefix, name, and unit values.
|
||||
*/
|
||||
std::string BuildFullPrometheusName(std::string_view prefix, std::string_view name, std::string_view unit,
|
||||
bool is_sum = false);
|
||||
|
||||
} // namespace detail
|
||||
} // namespace zeek::telemetry
|
Loading…
Add table
Add a link
Reference in a new issue