srkukarni commented on a change in pull request #2128: Schedule task to update function stats separately URL: https://github.com/apache/incubator-pulsar/pull/2128#discussion_r201828358
########## File path: pulsar-functions/proto/src/main/proto/InstanceCommunication.proto ########## @@ -72,5 +72,7 @@ message HealthCheckResult { service InstanceControl { rpc GetFunctionStatus(google.protobuf.Empty) returns (FunctionStatus) {} rpc GetAndResetMetrics(google.protobuf.Empty) returns (MetricsData) {} + rpc ResetMetrics(google.protobuf.Empty) returns (google.protobuf.Empty) {} Review comment: It goes against established compute patterns. But before that some background 1. From metrics perspecive the Functions framework is just supposed to collect metrics. This collection is very transient by definition(if the function restarts for whatever reason, it forgets everything about past metrics). This means that it is actually a bad practice to rely on any kind of accumulated metrics on functions framework. We cannot for instance get the count of all object processed forever from the framework itself. 2. This task of keeping track in a durable way of the metrics is usually what the external systems(like prometheus) do. They periodically call some api from the function framework to get the list of metrics and then keep track of those metrics. And typically as soon as they are done collecting those metrics, the compute framework resets its 'cache'. Thats what getAndReset does. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services