1 /* 2 * Copyright 2022 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef FCP_CLIENT_OPSTATS_OPSTATS_UTILS_H_ 18 #define FCP_CLIENT_OPSTATS_OPSTATS_UTILS_H_ 19 20 #include <optional> 21 #include <string> 22 23 #include "google/protobuf/timestamp.pb.h" 24 #include "fcp/base/monitoring.h" 25 #include "fcp/client/opstats/opstats_db.h" 26 27 namespace fcp { 28 namespace client { 29 namespace opstats { 30 31 // Returns an optional containing an OperationalStats of the last time the 32 // runtime successfully contributed to a task with the given task name, 33 // otherwise returns an empty optional. 34 std::optional<OperationalStats> GetLastSuccessfulContribution( 35 OpStatsSequence& data, const std::string& task_name); 36 37 // Returns an optional containing the timestamp of the last time the runtime 38 // successfully contributed to a task with the given task name, otherwise 39 // returns an empty optional. 40 std::optional<google::protobuf::Timestamp> GetLastSuccessfulContributionTime( 41 OpStatsSequence& data, const std::string& task_name); 42 43 } // namespace opstats 44 } // namespace client 45 } // namespace fcp 46 47 #endif // FCP_CLIENT_OPSTATS_OPSTATS_UTILS_H_ 48