Clio
develop
The XRP Ledger API server.
Theme:
Default
Round
Robot
Toggle main menu visibility
Loading...
Searching...
No Matches
Metrics.hpp
1
#pragma once
2
3
#include "cluster/Backend.hpp"
4
#include "cluster/ClioNode.hpp"
5
#include "util/prometheus/Bool.hpp"
6
#include "util/prometheus/Gauge.hpp"
7
#include "util/prometheus/Prometheus.hpp"
8
9
#include <memory>
10
11
namespace
cluster
{
12
20
class
Metrics
{
24
util::prometheus::GaugeInt
& nodesInClusterMetric_ =
PrometheusService::gaugeInt
(
25
"cluster_nodes_total_number"
,
26
{},
27
"Total number of nodes this node can detect in the cluster."
28
);
29
33
util::prometheus::Bool
isHealthy_ =
PrometheusService::boolMetric
(
34
"cluster_communication_is_healthy"
,
35
{},
36
"Whether cluster communication service is operating healthy (1 - healthy, 0 - we have a "
37
"problem)"
38
);
39
40
public
:
46
Metrics
();
47
59
void
60
onNewState
(
ClioNode::CUuid
uuid, std::shared_ptr<Backend::ClusterData const> clusterData);
61
};
62
63
}
// namespace cluster
PrometheusService::boolMetric
static util::prometheus::Bool boolMetric(std::string name, util::prometheus::Labels labels, std::optional< std::string > description=std::nullopt)
Get a bool based metric. It will be created if it doesn't exist.
Definition
Prometheus.cpp:201
PrometheusService::gaugeInt
static util::prometheus::GaugeInt & gaugeInt(std::string name, util::prometheus::Labels labels, std::optional< std::string > description=std::nullopt)
Get an integer based gauge metric. It will be created if it doesn't exist.
Definition
Prometheus.cpp:231
cluster::Metrics::Metrics
Metrics()
Constructs a Metrics instance and initializes metrics.
Definition
Metrics.cpp:10
cluster::Metrics::onNewState
void onNewState(ClioNode::CUuid uuid, std::shared_ptr< Backend::ClusterData const > clusterData)
Updates metrics based on new cluster state.
Definition
Metrics.cpp:18
cluster
This namespace implements cluster coordination between Clio nodes.
Definition
Backend.cpp:24
util::prometheus::Bool
AnyBool< GaugeInt > Bool
Alias for Prometheus bool metric with GaugeInt implementation.
Definition
Bool.hpp:74
util::prometheus::GaugeInt
AnyGauge< std::int64_t > GaugeInt
Alias for a gauge with a 64-bit integer value.
Definition
Gauge.hpp:127
cluster::ClioNode::CUuid
std::shared_ptr< boost::uuids::uuid const > CUuid
Shared read-only node UUID.
Definition
ClioNode.hpp:50
src
cluster
Metrics.hpp
Generated by
1.17.0