xref: /aosp_15_r20/external/grpc-grpc/src/proto/grpc/testing/xds/v3/fault.proto (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1// Copyright 2020 The gRPC Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// Local copy of Envoy xDS proto file, used for testing only.
16
17syntax = "proto3";
18
19package envoy.extensions.filters.http.fault.v3;
20
21import "src/proto/grpc/testing/xds/v3/fault_common.proto";
22import "src/proto/grpc/testing/xds/v3/route.proto";
23import "src/proto/grpc/testing/xds/v3/percent.proto";
24
25import "google/protobuf/wrappers.proto";
26
27// [#protodoc-title: Fault Injection]
28// Fault Injection :ref:`configuration overview <config_http_filters_fault_injection>`.
29// [#extension: envoy.filters.http.fault]
30
31// [#next-free-field: 6]
32message FaultAbort {
33  // Fault aborts are controlled via an HTTP header (if applicable). See the
34  // :ref:`HTTP fault filter <config_http_filters_fault_injection_http_header>` documentation for
35  // more information.
36  message HeaderAbort {
37  }
38
39  reserved 1;
40
41  oneof error_type {
42    // HTTP status code to use to abort the HTTP request.
43    uint32 http_status = 2;
44
45    // gRPC status code to use to abort the gRPC request.
46    uint32 grpc_status = 5;
47
48    // Fault aborts are controlled via an HTTP header (if applicable).
49    HeaderAbort header_abort = 4;
50  }
51
52  // The percentage of requests/operations/connections that will be aborted with the error code
53  // provided.
54  type.v3.FractionalPercent percentage = 3;
55}
56
57// [#next-free-field: 15]
58message HTTPFault {
59  // If specified, the filter will inject delays based on the values in the
60  // object.
61  common.fault.v3.FaultDelay delay = 1;
62
63  // If specified, the filter will abort requests based on the values in
64  // the object. At least *abort* or *delay* must be specified.
65  FaultAbort abort = 2;
66
67  // Specifies a set of headers that the filter should match on. The fault
68  // injection filter can be applied selectively to requests that match a set of
69  // headers specified in the fault filter config. The chances of actual fault
70  // injection further depend on the value of the :ref:`percentage
71  // <envoy_api_field_extensions.filters.http.fault.v3.FaultAbort.percentage>` field.
72  // The filter will check the request's headers against all the specified
73  // headers in the filter config. A match will happen if all the headers in the
74  // config are present in the request with the same values (or based on
75  // presence if the *value* field is not in the config).
76  repeated config.route.v3.HeaderMatcher headers = 4;
77
78  // The maximum number of faults that can be active at a single time via the configured fault
79  // filter. Note that because this setting can be overridden at the route level, it's possible
80  // for the number of active faults to be greater than this value (if injected via a different
81  // route). If not specified, defaults to unlimited. This setting can be overridden via
82  // `runtime <config_http_filters_fault_injection_runtime>` and any faults that are not injected
83  // due to overflow will be indicated via the `faults_overflow
84  // <config_http_filters_fault_injection_stats>` stat.
85  //
86  // .. attention::
87  //   Like other :ref:`circuit breakers <arch_overview_circuit_break>` in Envoy, this is a fuzzy
88  //   limit. It's possible for the number of active faults to rise slightly above the configured
89  //   amount due to the implementation details.
90  google.protobuf.UInt32Value max_active_faults = 6;
91}
92