From 87521fd728fcbd579365110a281bc6a592770dd3 Mon Sep 17 00:00:00 2001 From: Anton Pryakhin Date: Thu, 19 Oct 2023 20:01:24 +0300 Subject: [PATCH] Format code Signed-off-by: Anton Pryakhin --- src/plugins/plugins_prometheusstatconsumer.cpp | 12 +++++------- src/plugins/plugins_prometheusstatconsumer.h | 5 ++--- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/plugins/plugins_prometheusstatconsumer.cpp b/src/plugins/plugins_prometheusstatconsumer.cpp index d9cde375e8..56b3e61e53 100644 --- a/src/plugins/plugins_prometheusstatconsumer.cpp +++ b/src/plugins/plugins_prometheusstatconsumer.cpp @@ -126,7 +126,7 @@ PrometheusStatConsumer::PrometheusStatConsumer( , d_isStarted(false) , d_prometheusRegistry_p(std::make_shared()) { - // Populate host name from config + // Initialize stat contexts d_systemStatContext_p = getStatContext("system"); d_brokerStatContext_p = getStatContext("broker"); d_clustersStatContext_p = getStatContext("clusters"); @@ -365,9 +365,8 @@ void PrometheusStatConsumer::captureSystemStats() datapoints.begin(); it != datapoints.end(); ++it) { - auto& gauge = prometheus::BuildGauge() - .Name(it->first) - .Register(*d_prometheusRegistry_p); + auto& gauge = prometheus::BuildGauge().Name(it->first).Register( + *d_prometheusRegistry_p); gauge.Add(labels).Set(it->second); } @@ -414,9 +413,8 @@ void PrometheusStatConsumer::captureNetworkStats() datapoints.begin(); it != datapoints.end(); ++it) { - auto& counter = prometheus::BuildCounter() - .Name(it->first) - .Register(*d_prometheusRegistry_p); + auto& counter = prometheus::BuildCounter().Name(it->first).Register( + *d_prometheusRegistry_p); counter.Add(labels).Increment(it->second); } diff --git a/src/plugins/plugins_prometheusstatconsumer.h b/src/plugins/plugins_prometheusstatconsumer.h index 662f923656..b50aa0b036 100644 --- a/src/plugins/plugins_prometheusstatconsumer.h +++ b/src/plugins/plugins_prometheusstatconsumer.h @@ -99,7 +99,6 @@ class PrometheusStatConsumer : public mqbplug::StatConsumer { typedef const DatapointDef* DatapointDefCIter; - // DATA const mwcst::StatContext* d_systemStatContext_p; // The system stat context @@ -197,8 +196,8 @@ class PrometheusStatConsumer : public mqbplug::StatConsumer { /// Set internal action counter based on Prometheus publish interval. void setActionCounter(); - /// Retrieve metric value from given 'context' by given 'def_p' and update - /// it in Prometheus Registry. + /// Update metric by given 'def_p', 'labels' and 'value' in Prometheus + /// Registry. void updateMetric(const DatapointDef* def_p, const prometheus::Labels& labels, const bsls::Types::Int64 value);