7#include <grpcpp/support/status.h>
11namespace ugrpc::impl {
13class MethodStatistics;
15class RpcStatisticsScope
final {
17 explicit RpcStatisticsScope(MethodStatistics& statistics);
19 ~RpcStatisticsScope();
21 void OnExplicitFinish(grpc::StatusCode code);
23 void OnCancelledByDeadlinePropagation();
25 void OnDeadlinePropagated();
29 void OnNetworkError();
36 enum class FinishKind {
48 kDeadlinePropagation = 3,
56 std::atomic<
bool> is_cancelled_{
false};
57 MethodStatistics& statistics_;
58 std::optional<std::chrono::steady_clock::time_point> start_time_;
59 FinishKind finish_kind_{FinishKind::kAutomatic};
60 grpc::StatusCode finish_code_{};