-
Notifications
You must be signed in to change notification settings - Fork 5.5k
access logging: introduce critical ALS endpoint #17486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
4df069e
daa2f41
a63ec67
37a1e18
8f51ae2
5ed729f
6fbaa22
4110cc7
c1d448a
69773e4
35dd187
e506fd6
d94bcee
75eb0bd
e34e5ff
d432070
824aa2a
9022520
7e95cb6
70c589a
444dd61
6c4cb60
ee43245
9d7e6d9
1a72c4e
f6ce0f2
263c015
1b9991d
8bf0872
76ee0ca
9b88364
8ada51f
a400410
a5a27a3
7cfdf0f
0793deb
599b05a
6c43c6c
44dd7ef
b7c409e
f6b9451
6f673a1
14e8ad7
8591511
1cf0c86
65e2d41
3feffd8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ syntax = "proto3"; | |
|
|
||
| package envoy.extensions.access_loggers.grpc.v3; | ||
|
|
||
| import "envoy/config/accesslog/v3/accesslog.proto"; | ||
| import "envoy/config/core/v3/base.proto"; | ||
| import "envoy/config/core/v3/config_source.proto"; | ||
| import "envoy/config/core/v3/grpc_service.proto"; | ||
|
|
@@ -55,7 +56,7 @@ message TcpGrpcAccessLogConfig { | |
| } | ||
|
|
||
| // Common configuration for gRPC access logs. | ||
| // [#next-free-field: 8] | ||
| // [#next-free-field: 11] | ||
| message CommonGrpcAccessLogConfig { | ||
| option (udpa.annotations.versioning).previous_message_type = | ||
| "envoy.config.accesslog.v2.CommonGrpcAccessLogConfig"; | ||
|
|
@@ -96,4 +97,20 @@ message CommonGrpcAccessLogConfig { | |
| // will be used in this configuration. This feature is used only when you are using | ||
| // :ref:`Envoy gRPC client <envoy_v3_api_field_config.core.v3.GrpcService.envoy_grpc>`. | ||
| config.core.v3.RetryPolicy grpc_stream_retry_policy = 7; | ||
|
|
||
| // Define the log condition for critical access logs. | ||
| // Logs that match the filter are not sent to `StreamAccessLogs`, | ||
| // but are sent to `CriticalAccessLogs`. | ||
| config.accesslog.v3.AccessLogFilter critical_buffer_log_filter = 8; | ||
|
|
||
| // The time to wait for an ACK message. If no ACK message is returned after this time, | ||
| // the message is considered undeliverable and the failed transmission is buffered again. | ||
| // The re-buffered message will be sent again at the next time a log matching *critical_buffer_log_filter* is queued. | ||
| google.protobuf.Duration message_ack_timeout = 9 | ||
| [(validate.rules).duration = {gte {nanos: 1000000}}]; | ||
|
|
||
| // Size limit (in bytes) of the buffer used to store messages during processing in a | ||
| // critical logger. A critical logger buffers messages until it receives an ACK from upstream. | ||
| // The default is 16384. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What happens when the buffer size is exceeded? Can you clarify in the comment, please? |
||
| google.protobuf.UInt32Value max_pending_buffer_size_bytes = 10; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,12 +21,40 @@ option (udpa.annotations.file_status).package_version_status = ACTIVE; | |
| service AccessLogService { | ||
| // Envoy will connect and send StreamAccessLogsMessage messages forever. It does not expect any | ||
| // response to be sent as nothing would be done in the case of failure. The server should | ||
| // disconnect if it expects Envoy to reconnect. In the future we may decide to add a different | ||
| // API for "critical" access logs in which Envoy will buffer access logs for some period of time | ||
| // until it gets an ACK so it could then retry. This API is designed for high throughput with the | ||
| // disconnect if it expects Envoy to reconnect. This API is designed for high throughput with the | ||
| // expectation that it might be lossy. | ||
| rpc StreamAccessLogs(stream StreamAccessLogsMessage) returns (StreamAccessLogsResponse) { | ||
| } | ||
|
|
||
| // This endpoint provides acknowledgment of logs marked as requiring acknowledgment. | ||
| // The requirement for an acknowledgment can be set in | ||
| // :ref:`critical_buffer_log_filter <envoy_v3_api_msg_extensions.access_loggers.grpc.v3.CommonGrpcAccessLogConfig.critical_buffer_log_filter>`. | ||
| // Log messages that match this filter will be guaranteed delivery. In order to guarantee | ||
| // the arrival, this endpoint performs the following process. | ||
| // | ||
| // 1. A response message is returned for each log. The response message includes ACK/NACK status, | ||
| // and in case of NACK, the target log is not flushed but buffered by Envoy. | ||
| // 2. Timeout for response message is set and if no message is returned within a certain time, | ||
| // it will be considered as unreachable and buffered by Envoy without flushing the target log. This timeout is set by | ||
| // :ref:`message_ack_timeout <envoy_v3_api_msg_extensions.access_loggers.grpc.v3.CommonGrpcAccessLogConfig.message_ack_timeout>`. | ||
| // | ||
| // On the ALS receiver side, ACK is expected to be returned to indicate that the log was saved properly, | ||
| // and NACK is expected to be returned when the log could not be saved due to some error. | ||
| // | ||
| // .. attention:: | ||
| // | ||
| // Buffers for guaranteed reachability can be extremely memory-intensive. Therefore, the following points | ||
| // should be considered when using this endpoint. | ||
| // | ||
| // 1. :ref:`critical_buffer_log_filter <envoy_v3_api_msg_extensions.access_loggers.grpc.v3.CommonGrpcAccessLogConfig.critical_buffer_log_filter>` | ||
| // should be set strictly. A loose filter may encourage rapid buffer overwhelm and leading to OOM. | ||
| // 2. :ref:`max_pending_buffer_size_bytes <envoy_v3_api_msg_extensions.access_loggers.grpc.v3.CommonGrpcAccessLogConfig.max_pending_buffer_size_bytes>` | ||
| // should be set appropriately to prevent OOM. | ||
| // 3. Make sure that ALS receiver is implemented properly. If it is not implemented, all messages will | ||
| // be buffered, which may cause OOM soon. | ||
|
Comment on lines
+53
to
+54
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If 2 was set it shouldn't oom right?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. We can avoid OOM by setting |
||
| rpc CriticalAccessLogs(stream CriticalAccessLogsMessage) | ||
| returns (stream CriticalAccessLogsResponse) { | ||
| } | ||
| } | ||
|
|
||
| // Empty response for the StreamAccessLogs API. Will never be sent. See below. | ||
|
|
@@ -35,6 +63,23 @@ message StreamAccessLogsResponse { | |
| "envoy.service.accesslog.v2.StreamAccessLogsResponse"; | ||
| } | ||
|
|
||
| // Response received to identify undelivered or delivered messages in CriticalAccessLogs. | ||
| message CriticalAccessLogsResponse { | ||
| enum Status { | ||
| // Indicates that the message has been received. | ||
| ACK = 0; | ||
|
|
||
| // Indicates that the message has not been received. | ||
| NACK = 1; | ||
| } | ||
|
|
||
| // This field is used to indicate the arrival status. | ||
| Status status = 1; | ||
|
|
||
| // Message ID that identifies a message. | ||
| uint64 id = 2; | ||
| } | ||
|
|
||
| // Stream message for the StreamAccessLogs API. Envoy will open a stream to the server and stream | ||
| // access logs without ever expecting a response. | ||
| message StreamAccessLogsMessage { | ||
|
|
@@ -85,3 +130,16 @@ message StreamAccessLogsMessage { | |
| TCPAccessLogEntries tcp_logs = 3; | ||
| } | ||
| } | ||
|
|
||
| // Stream message for the CriticalAccessLogs API. | ||
| // Envoy opens a stream to the server and streams the access log, | ||
| // expecting a response. Each message sent is assigned an individual ID, | ||
| // and the state of the message is tracked based on the ID. | ||
| message CriticalAccessLogsMessage { | ||
| // The body of the log message sent to CriticalAccessLogs. | ||
| StreamAccessLogsMessage message = 1; | ||
|
|
||
| // This is an ID to identify the message, and should be added to the Critical Endpoint | ||
| // response message to uniquely identify the message being ACK/NACKed. | ||
| uint64 id = 4; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.