wasphin commented on code in PR #2899: URL: https://github.com/apache/brpc/pull/2899#discussion_r1966808669
########## 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: Simply ignoring metrics that are duplicates of the previous ones does not completely solve the problem. If the metrics themselves are repetitive, perhaps we should try to identify and address the root cause; if it's just a matter of duplicate names, consider fixing the metrics name. -- 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