File tree 2 files changed +13
-9
lines changed
2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -34,15 +34,13 @@ namespace jam::app {
34
34
system_clock_(std::move(system_clock)),
35
35
metrics_registry_(metrics::createRegistry()) {
36
36
// Metric for exposing name and version of node
37
- constexpr auto buildInfoMetricName = " jam_build_info" ;
38
- metrics_registry_->registerGaugeFamily (
39
- buildInfoMetricName,
40
- " A metric with a constant '1' value labeled by name, version" );
41
- auto metric_build_info = metrics_registry_->registerGaugeMetric (
42
- buildInfoMetricName,
43
- {{" name" , app_config_->nodeName ()},
44
- {" version" , app_config_->nodeVersion ()}});
45
- metric_build_info->set (1 );
37
+ metrics::GaugeHelper (
38
+ " jam_build_info" ,
39
+ " A metric with a constant '1' value labeled by name, version" ,
40
+ std::map<std::string, std::string>{
41
+ {" name" , app_config_->nodeName ()},
42
+ {" version" , app_config_->nodeVersion ()}})
43
+ ->set (1 );
46
44
}
47
45
48
46
void ApplicationImpl::run () {
Original file line number Diff line number Diff line change @@ -27,6 +27,12 @@ namespace jam::metrics {
27
27
registry_->registerGaugeFamily (name, help);
28
28
metric_ = registry_->registerGaugeMetric (name);
29
29
}
30
+ GaugeHelper (const std::string &name,
31
+ const std::string &help,
32
+ const std::map<std::string, std::string> &labels) {
33
+ registry_->registerGaugeFamily (name, help);
34
+ metric_ = registry_->registerGaugeMetric (name, labels);
35
+ }
30
36
31
37
auto *operator ->() const {
32
38
return metric_;
You can’t perform that action at this time.
0 commit comments