ZhengweiZhu commented on code in PR #2899:
URL: https://github.com/apache/brpc/pull/2899#discussion_r1981146826


##########
src/brpc/builtin/prometheus_metrics_service.cpp:
##########
@@ -102,9 +103,14 @@ bool PrometheusMetricsDumper::dump(const std::string& name,
 
     auto metrics_name = GetMetricsName(name);
 
-    *_os << "# HELP " << metrics_name << '\n'
-         << "# TYPE " << metrics_name << " gauge" << '\n'
-         << name << " " << desc << '\n';
+    // To meet specification of prometheus metric, there should be only
+    // one TYPE field for the same metric name.
+    if (metrics_name.as_string() != _last_metric_name) {

Review Comment:
   @chenBright @wasphin  The pr is updated according to review comment and ut 
case is added.   Please take a look and merge if nothing wrong.



-- 
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: dev-unsubscr...@brpc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org
For additional commands, e-mail: dev-h...@brpc.apache.org

Reply via email to