userver
C++ Async Framework
Loading...
Searching...
No Matches
component.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/ugrpc/client/middlewares/log/component.hpp
4
/// @brief @copybrief ugrpc::client::middlewares::log::Component
5
6
#
include
<
userver
/
ugrpc
/
client
/
middlewares
/
base
.
hpp
>
7
#
include
<
userver
/
utils
/
box
.
hpp
>
8
9
USERVER_NAMESPACE_BEGIN
10
11
/// Client logging middleware
12
namespace
ugrpc::
client
::middlewares::
log
{
13
14
struct
Settings;
15
16
// clang-format off
17
18
/// @ingroup userver_components
19
///
20
/// @brief Component for gRPC client logging
21
///
22
/// @warning Logs are currently written with log level `debug` by default, which typically means that they are not
23
/// written in production. See details below.
24
///
25
/// ## Static options:
26
/// Name | Description | Default value
27
/// ---- | ----------- | -------------
28
/// log-level | log level to use for `Span`, status code and the facts of sending requests receiving responses arriving | debug
29
/// msg-log-level | log level to use for request and response messages themselves | debug
30
/// msg-size-log-limit | max message size to log, the rest will be truncated | 512
31
/// trim-secrets | trim the secrets from logs as marked by the protobuf option | true (*)
32
///
33
/// @warning * Trimming secrets causes a segmentation fault for messages that contain
34
/// optional fields in protobuf versions prior to 3.13. You should set trim-secrets to false
35
/// if this is the case for you. See https://github.com/protocolbuffers/protobuf/issues/7801
36
///
37
/// ## Static configuration example:
38
///
39
/// @snippet grpc/functional_tests/basic_chaos/static_config.yaml Sample grpc client logging middleware component config
40
///
41
/// In this example, we enable logs for gRPC clients in production.
42
43
// clang-format on
44
45
class
Component
final
:
public
MiddlewareComponentBase
{
46
public
:
47
/// @ingroup userver_component_names
48
/// @brief The default name of ugrpc::client::middlewares::log::Component
49
static
constexpr
std
::
string_view
kName
=
"grpc-client-logging"
;
50
51
Component(
const
components
::ComponentConfig& config,
const
components
::ComponentContext& context);
52
53
~Component()
override
;
54
55
std::shared_ptr<
const
MiddlewareFactoryBase
>
GetMiddlewareFactory
()
override
;
56
57
static
yaml_config
::Schema GetStaticConfigSchema();
58
59
private
:
60
const
utils
::
Box
<Settings> settings_;
61
};
62
63
}
// namespace ugrpc::client::middlewares::log
64
65
USERVER_NAMESPACE_END
userver
ugrpc
client
middlewares
log
component.hpp
Generated on Wed Dec 4 2024 18:44:31 for userver by
Doxygen
1.10.0