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


##########
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:
   How about adding a virtual function for mvabr to Dumper? I think this can 
completely solve the problem.
   
   ```c++
   bool mutil_dump(
       const std::string& mutil_name,
       const std::vector<std::string>& names,
       const std::vector<std::string>& descriptions) override;
   ```
   



-- 
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]

Reply via email to