-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat grpc: add channels for each high load grpc method
add a static config option for creating separate grpc channels for high load grpc methods commit_hash:dd1783477390776f5a8282f95e8997cf60169e54
- Loading branch information
1 parent
f4b4551
commit d4e39cb
Showing
29 changed files
with
250 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
grpc/include/userver/ugrpc/client/client_factory_settings.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#pragma once | ||
|
||
/// @file userver/ugrpc/client/client_factory_settings.hpp | ||
/// @brief @copybrief ugrpc::client::ClientFactorySettings | ||
|
||
#include <memory> | ||
#include <string> | ||
#include <unordered_map> | ||
|
||
#include <grpcpp/security/credentials.h> | ||
#include <grpcpp/support/channel_arguments.h> | ||
|
||
#include <userver/logging/level.hpp> | ||
|
||
USERVER_NAMESPACE_BEGIN | ||
|
||
namespace ugrpc::client { | ||
|
||
// full rpc name -> count of channels | ||
using DedicatedMethodsConfig = std::unordered_map<std::string, std::size_t>; | ||
|
||
/// Settings relating to the ClientFactory | ||
struct ClientFactorySettings final { | ||
/// gRPC channel credentials, none by default | ||
std::shared_ptr<grpc::ChannelCredentials> credentials{grpc::InsecureChannelCredentials()}; | ||
|
||
/// gRPC channel credentials by client_name. If not set, default `credentials` | ||
/// is used instead. | ||
std::unordered_map<std::string, std::shared_ptr<grpc::ChannelCredentials>> client_credentials{}; | ||
|
||
/// Optional grpc-core channel args | ||
/// @see https://grpc.github.io/grpc/core/group__grpc__arg__keys.html | ||
grpc::ChannelArguments channel_args{}; | ||
|
||
/// The logging level override for the internal grpcpp library. Must be either | ||
/// `kDebug`, `kInfo` or `kError`. | ||
logging::Level native_log_level{logging::Level::kError}; | ||
|
||
/// Number of underlying channels that will be created for every client | ||
/// in this factory. | ||
std::size_t channel_count{1}; | ||
}; | ||
|
||
} // namespace ugrpc::client | ||
|
||
USERVER_NAMESPACE_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.