feat: Expose ledger cache full and disabled to prometheus (#1957)

Fixes #1771
This commit is contained in:
Sergey Kuznetsov
2025-03-12 14:54:21 +00:00
committed by GitHub
parent 8ac1ff7699
commit 73477fb9d4
4 changed files with 83 additions and 5 deletions

View File

@@ -158,9 +158,9 @@ struct MockPrometheusImpl : PrometheusInterface {
{
std::unique_ptr<MetricBase> metric;
auto const key = name + labelsString;
if constexpr (std::is_same_v<MetricType, GaugeInt>) {
if constexpr (std::is_same_v<MetricType, GaugeInt> or std::is_same_v<MetricType, Bool>) {
auto& impl = counterIntImpls[key];
metric = std::make_unique<MetricType>(name, labelsString, impl);
metric = std::make_unique<GaugeInt>(name, labelsString, impl);
} else if constexpr (std::is_same_v<MetricType, CounterInt>) {
auto& impl = counterUintImpls[key];
metric = std::make_unique<MetricType>(name, labelsString, impl);
@@ -235,7 +235,7 @@ struct WithMockPrometheus : virtual ::testing::Test {
if (!mockPrometheusPtr->metrics.contains(key))
mockPrometheusPtr->makeMetric<MetricType>(std::move(name), std::move(labelsString));
if constexpr (std::is_same_v<MetricType, GaugeInt>) {
if constexpr (std::is_same_v<MetricType, GaugeInt> or std::is_same_v<MetricType, Bool>) {
return mockPrometheusPtr->counterIntImpls[key];
} else if constexpr (std::is_same_v<MetricType, CounterInt>) {
return mockPrometheusPtr->counterUintImpls[key];