Skip to content

Commit

Permalink
Address comment.
Browse files Browse the repository at this point in the history
  • Loading branch information
chowchow316 committed Apr 7, 2017
1 parent bf59cdd commit 16d4091
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions contrib/endpoints/src/api_manager/context/request_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ RequestContext::RequestContext(std::shared_ptr<ServiceContext> service_context,
: service_context_(service_context),
request_(std::move(request)),
is_first_report_(true),
last_request_bytes(0),
last_response_bytes(0) {
last_request_bytes_(0),
last_response_bytes_(0) {
start_time_ = std::chrono::system_clock::now();
last_report_time_ = std::chrono::steady_clock::now();
operation_id_ = GenerateUUID();
Expand Down Expand Up @@ -270,19 +270,19 @@ void RequestContext::FillReportRequestInfo(

if (!info->is_final_report) {
// Make sure we send delta metrics for intermediate reports.
info->request_bytes = request_->GetGrpcRequestBytes() - last_request_bytes;
info->request_bytes = request_->GetGrpcRequestBytes() - last_request_bytes_;
info->response_bytes =
request_->GetGrpcResponseBytes() - last_response_bytes;
last_request_bytes += info->request_bytes;
last_response_bytes += info->response_bytes;
request_->GetGrpcResponseBytes() - last_response_bytes_;
last_request_bytes_ += info->request_bytes;
last_response_bytes_ += info->response_bytes;
} else {
info->request_size = response->GetRequestSize();
info->response_size = response->GetResponseSize();
info->request_bytes = info->request_size - last_request_bytes;
info->request_bytes = info->request_size - last_request_bytes_;
if (info->request_bytes < 0) {
info->request_bytes = 0;
}
info->response_bytes = info->response_size - last_response_bytes;
info->response_bytes = info->response_size - last_response_bytes_;
if (info->response_bytes < 0) {
info->response_bytes = 0;
}
Expand Down
4 changes: 2 additions & 2 deletions contrib/endpoints/src/api_manager/context/request_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ class RequestContext {
std::chrono::steady_clock::time_point last_report_time_;

// The accumulated data sent till last intermediate report
int64_t last_request_bytes;
int64_t last_response_bytes;
int64_t last_request_bytes_;
int64_t last_response_bytes_;
};

} // namespace context
Expand Down

0 comments on commit 16d4091

Please sign in to comment.