empiredan commented on code in PR #1827: URL: https://github.com/apache/incubator-pegasus/pull/1827#discussion_r1441522448
########## src/utils/metrics.cpp: ########## @@ -449,6 +444,89 @@ metric_entity_ptr metric_registry::find_or_create_entity(const metric_entity_pro return entity; } +DSN_DECLARE_string(cluster_name); + +namespace { + +#define ENCODE_UNKNOWN_IF(expr) \ + do { \ + if (dsn_unlikely(expr)) { \ + dsn::json::json_encode(writer, "unknown"); \ + return; \ + } \ + } while (0) + +void encode_cluster(dsn::metric_json_writer &writer) +{ + writer.Key(dsn::kMetricClusterField.c_str()); + + ENCODE_UNKNOWN_IF(utils::is_empty(dsn::FLAGS_cluster_name)); + + dsn::json::json_encode(writer, dsn::FLAGS_cluster_name); Review Comment: OK. -- 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...@pegasus.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pegasus.apache.org For additional commands, e-mail: dev-h...@pegasus.apache.org