Skip to content

Commit

Permalink
Only bump the overload count if includeInRecentRequests is true
Browse files Browse the repository at this point in the history
Summary: To be consistent with the behavior we have for incrementing/decrementing request counts, we should add `includeInRecentRequests` check to exclude those unwanted thrift methods.

Reviewed By: joshkirstein

Differential Revision: D45362412

fbshipit-source-id: f544e7f293dbe29f83f1a50545d09711701d1871
  • Loading branch information
Tao Chen (RPC) authored and facebook-github-bot committed Apr 28, 2023
1 parent 0d92a2e commit 06c2980
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions thrift/lib/cpp2/transport/core/ThriftRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ class ThriftRequestCore : public ResponseChannelRequest {
return kind_ == RpcKind::SINGLE_REQUEST_NO_RESPONSE;
}

bool includeInRecentRequests() const {
return stateMachine_.includeInRecentRequests();
}

protocol::PROTOCOL_TYPES getProtoId() const {
return static_cast<protocol::PROTOCOL_TYPES>(header_.getProtocolId());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,9 @@ void ThriftRocketServerHandler::handleRequestOverloadedServer(
folly::make_exception_wrapper<TApplicationException>(
TApplicationException::LOADSHEDDING, errorMessage),
errorCode);
requestsRegistry_->getRequestCounter().incrementOverloadCount();
if (request->includeInRecentRequests()) {
requestsRegistry_->getRequestCounter().incrementOverloadCount();
}
}

void ThriftRocketServerHandler::handleAppError(
Expand Down

0 comments on commit 06c2980

Please sign in to comment.