Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Pryakhin <[email protected]>
  • Loading branch information
waldgange committed Oct 19, 2023
1 parent 6f184ce commit 87521fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
12 changes: 5 additions & 7 deletions src/plugins/plugins_prometheusstatconsumer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ PrometheusStatConsumer::PrometheusStatConsumer(
, d_isStarted(false)
, d_prometheusRegistry_p(std::make_shared<prometheus::Registry>())
{
// Populate host name from config
// Initialize stat contexts
d_systemStatContext_p = getStatContext("system");
d_brokerStatContext_p = getStatContext("broker");
d_clustersStatContext_p = getStatContext("clusters");
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down
5 changes: 2 additions & 3 deletions src/plugins/plugins_prometheusstatconsumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ class PrometheusStatConsumer : public mqbplug::StatConsumer {

typedef const DatapointDef* DatapointDefCIter;

// DATA
const mwcst::StatContext* d_systemStatContext_p;
// The system stat context

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 87521fd

Please sign in to comment.