xref: /aosp_15_r20/external/grpc-grpc-java/xds/third_party/envoy/src/main/proto/envoy/config/overload/v3/overload.proto (revision e07d83d3ffcef9ecfc9f7f475418ec639ff0e5fe)
1syntax = "proto3";
2
3package envoy.config.overload.v3;
4
5import "envoy/type/v3/percent.proto";
6
7import "google/protobuf/any.proto";
8import "google/protobuf/duration.proto";
9
10import "udpa/annotations/status.proto";
11import "udpa/annotations/versioning.proto";
12import "validate/validate.proto";
13
14option java_package = "io.envoyproxy.envoy.config.overload.v3";
15option java_outer_classname = "OverloadProto";
16option java_multiple_files = true;
17option go_package = "github.com/envoyproxy/go-control-plane/envoy/config/overload/v3;overloadv3";
18option (udpa.annotations.file_status).package_version_status = ACTIVE;
19
20// [#protodoc-title: Overload Manager]
21
22// The Overload Manager provides an extensible framework to protect Envoy instances
23// from overload of various resources (memory, cpu, file descriptors, etc).
24// It monitors a configurable set of resources and notifies registered listeners
25// when triggers related to those resources fire.
26
27message ResourceMonitor {
28  option (udpa.annotations.versioning).previous_message_type =
29      "envoy.config.overload.v2alpha.ResourceMonitor";
30
31  reserved 2;
32
33  reserved "config";
34
35  // The name of the resource monitor to instantiate. Must match a registered
36  // resource monitor type.
37  // See the :ref:`extensions listed in typed_config below <extension_category_envoy.resource_monitors>` for the default list of available resource monitor.
38  string name = 1 [(validate.rules).string = {min_len: 1}];
39
40  // Configuration for the resource monitor being instantiated.
41  // [#extension-category: envoy.resource_monitors]
42  oneof config_type {
43    google.protobuf.Any typed_config = 3;
44  }
45}
46
47message ThresholdTrigger {
48  option (udpa.annotations.versioning).previous_message_type =
49      "envoy.config.overload.v2alpha.ThresholdTrigger";
50
51  // If the resource pressure is greater than or equal to this value, the trigger
52  // will enter saturation.
53  double value = 1 [(validate.rules).double = {lte: 1.0 gte: 0.0}];
54}
55
56message ScaledTrigger {
57  // If the resource pressure is greater than this value, the trigger will be in the
58  // :ref:`scaling <arch_overview_overload_manager-triggers-state>` state with value
59  // ``(pressure - scaling_threshold) / (saturation_threshold - scaling_threshold)``.
60  double scaling_threshold = 1 [(validate.rules).double = {lte: 1.0 gte: 0.0}];
61
62  // If the resource pressure is greater than this value, the trigger will enter saturation.
63  double saturation_threshold = 2 [(validate.rules).double = {lte: 1.0 gte: 0.0}];
64}
65
66message Trigger {
67  option (udpa.annotations.versioning).previous_message_type =
68      "envoy.config.overload.v2alpha.Trigger";
69
70  // The name of the resource this is a trigger for.
71  string name = 1 [(validate.rules).string = {min_len: 1}];
72
73  oneof trigger_oneof {
74    option (validate.required) = true;
75
76    ThresholdTrigger threshold = 2;
77
78    ScaledTrigger scaled = 3;
79  }
80}
81
82// Typed configuration for the "envoy.overload_actions.reduce_timeouts" action. See
83// :ref:`the docs <config_overload_manager_reducing_timeouts>` for an example of how to configure
84// the action with different timeouts and minimum values.
85message ScaleTimersOverloadActionConfig {
86  enum TimerType {
87    // Unsupported value; users must explicitly specify the timer they want scaled.
88    UNSPECIFIED = 0;
89
90    // Adjusts the idle timer for downstream HTTP connections that takes effect when there are no active streams.
91    // This affects the value of :ref:`HttpConnectionManager.common_http_protocol_options.idle_timeout
92    // <envoy_v3_api_field_config.core.v3.HttpProtocolOptions.idle_timeout>`
93    HTTP_DOWNSTREAM_CONNECTION_IDLE = 1;
94
95    // Adjusts the idle timer for HTTP streams initiated by downstream clients.
96    // This affects the value of :ref:`RouteAction.idle_timeout <envoy_v3_api_field_config.route.v3.RouteAction.idle_timeout>` and
97    // :ref:`HttpConnectionManager.stream_idle_timeout
98    // <envoy_v3_api_field_extensions.filters.network.http_connection_manager.v3.HttpConnectionManager.stream_idle_timeout>`
99    HTTP_DOWNSTREAM_STREAM_IDLE = 2;
100
101    // Adjusts the timer for how long downstream clients have to finish transport-level negotiations
102    // before the connection is closed.
103    // This affects the value of
104    // :ref:`FilterChain.transport_socket_connect_timeout <envoy_v3_api_field_config.listener.v3.FilterChain.transport_socket_connect_timeout>`.
105    TRANSPORT_SOCKET_CONNECT = 3;
106  }
107
108  message ScaleTimer {
109    // The type of timer this minimum applies to.
110    TimerType timer = 1 [(validate.rules).enum = {defined_only: true not_in: 0}];
111
112    oneof overload_adjust {
113      option (validate.required) = true;
114
115      // Sets the minimum duration as an absolute value.
116      google.protobuf.Duration min_timeout = 2;
117
118      // Sets the minimum duration as a percentage of the maximum value.
119      type.v3.Percent min_scale = 3;
120    }
121  }
122
123  // A set of timer scaling rules to be applied.
124  repeated ScaleTimer timer_scale_factors = 1 [(validate.rules).repeated = {min_items: 1}];
125}
126
127message OverloadAction {
128  option (udpa.annotations.versioning).previous_message_type =
129      "envoy.config.overload.v2alpha.OverloadAction";
130
131  // The name of the overload action. This is just a well-known string that listeners can
132  // use for registering callbacks. Custom overload actions should be named using reverse
133  // DNS to ensure uniqueness.
134  string name = 1 [(validate.rules).string = {min_len: 1}];
135
136  // A set of triggers for this action. The state of the action is the maximum
137  // state of all triggers, which can be scalar values between 0 and 1 or
138  // saturated. Listeners are notified when the overload action changes state.
139  // An overload manager action can only have one trigger for a given resource
140  // e.g. :ref:`Trigger.name
141  // <envoy_v3_api_field_config.overload.v3.Trigger.name>` must be unique
142  // in this list.
143  repeated Trigger triggers = 2 [(validate.rules).repeated = {min_items: 1}];
144
145  // Configuration for the action being instantiated.
146  google.protobuf.Any typed_config = 3;
147}
148
149// A point within the connection or request lifecycle that provides context on
150// whether to shed load at that given stage for the current entity at the
151// point.
152message LoadShedPoint {
153  // This is just a well-known string for the LoadShedPoint.
154  // Deployment specific LoadShedPoints e.g. within a custom extension should
155  // be prefixed by the company / deployment name to avoid colliding with any
156  // open source LoadShedPoints.
157  string name = 1 [(validate.rules).string = {min_len: 1}];
158
159  // A set of triggers for this LoadShedPoint. The LoadShedPoint will use the
160  // the maximum state of all triggers, which can be scalar values between 0 and
161  // 1 or saturated. A LoadShedPoint can only have one trigger for a given
162  // resource e.g. :ref:`Trigger.name
163  // <envoy_v3_api_field_config.overload.v3.Trigger.name>` must be unique in
164  // this list.
165  repeated Trigger triggers = 2 [(validate.rules).repeated = {min_items: 1}];
166}
167
168// Configuration for which accounts the WatermarkBuffer Factories should
169// track.
170message BufferFactoryConfig {
171  // The minimum power of two at which Envoy starts tracking an account.
172  //
173  // Envoy has 8 power of two buckets starting with the provided exponent below.
174  // Concretely the 1st bucket contains accounts for streams that use
175  // [2^minimum_account_to_track_power_of_two,
176  // 2^(minimum_account_to_track_power_of_two + 1)) bytes.
177  // With the 8th bucket tracking accounts
178  // >= 128 * 2^minimum_account_to_track_power_of_two.
179  //
180  // The maximum value is 56, since we're using uint64_t for bytes counting,
181  // and that's the last value that would use the 8 buckets. In practice,
182  // we don't expect the proxy to be holding 2^56 bytes.
183  //
184  // If omitted, Envoy should not do any tracking.
185  uint32 minimum_account_to_track_power_of_two = 1 [(validate.rules).uint32 = {lte: 56 gte: 10}];
186}
187
188// [#next-free-field: 6]
189message OverloadManager {
190  option (udpa.annotations.versioning).previous_message_type =
191      "envoy.config.overload.v2alpha.OverloadManager";
192
193  // The interval for refreshing resource usage.
194  google.protobuf.Duration refresh_interval = 1;
195
196  // The set of resources to monitor.
197  repeated ResourceMonitor resource_monitors = 2 [(validate.rules).repeated = {min_items: 1}];
198
199  // The set of overload actions.
200  repeated OverloadAction actions = 3;
201
202  // The set of load shed points.
203  repeated LoadShedPoint loadshed_points = 5;
204
205  // Configuration for buffer factory.
206  BufferFactoryConfig buffer_factory_config = 4;
207}
208