empiredan commented on code in PR #1304: URL: https://github.com/apache/incubator-pegasus/pull/1304#discussion_r1066581193
########## src/utils/metrics.cpp: ########## @@ -177,6 +203,109 @@ void metric_entity::take_snapshot(metric_json_writer &writer, const metric_filte writer.EndObject(); } +bool metric_entity::is_stale() const +{ + // Since this entity itself is still being accessed, its reference count should be 1 + // at least. + CHECK_GE(get_count(), 1); + + // Once this entity did not have any metric, and had only one reference kept in the + // registry, this entity would be considered useless. + return _metrics.empty() && get_count() == 1; +} + +metric_entity::collected_old_metrics_info metric_entity::collect_old_metrics() const Review Comment: `old` means a metric or entity is no longer used. Typically a metric or entity is referenced by a class. For example, the class `replica` may use a metric as the measurement of QPS for a replica. However, once the replica is removed, this metric will not be used. The framework of metrics then will find this metric and mark it `old`. After a configurable retention interval, this metric will finally be removed from the repository of metrics. -- 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