chenBright commented on code in PR #3557:
URL: https://github.com/apache/brpc/pull/3557#discussion_r4061707702
##########
src/brpc/builtin/prometheus_metrics_service.cpp:
##########
@@ -228,19 +311,18 @@ void
PrometheusMetricsService::default_method(::google::protobuf::RpcController*
int DumpPrometheusMetricsToIOBuf(butil::IOBuf* output) {
butil::IOBufBuilder os;
PrometheusMetricsDumper dumper(&os, g_server_info_prefix);
- const int ndump = bvar::Variable::dump_exposed(&dumper, nullptr);
+ int ndump = bvar::Variable::dump_exposed(&dumper, nullptr);
if (ndump < 0) {
return -1;
}
os.move_to(*output);
if (bvar::FLAGS_bvar_max_dump_multi_dimension_metric_number > 0) {
PrometheusMetricsDumper dumper_md(&os, g_server_info_prefix);
- const int ndump_md = bvar::MVariableBase::dump_exposed(&dumper_md,
nullptr);
- if (ndump_md < 0) {
- return -1;
+ size_t ndump_md = bvar::MVariableBase::dump_exposed(&dumper_md,
nullptr);
+ if (ndump_md > 0) {
+ output->append(butil::IOBuf::Movable(os.buf()));
}
Review Comment:
Fixed in 12fa7fd7b52dda902fe527f7ebd9832e35ffbd7b.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]