common.proto 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. syntax = "proto3";
  2. package envoy.service.tap.v2alpha;
  3. import "envoy/api/v2/core/base.proto";
  4. import "envoy/api/v2/core/grpc_service.proto";
  5. import "envoy/api/v2/route/route_components.proto";
  6. import "google/protobuf/wrappers.proto";
  7. import "udpa/annotations/migrate.proto";
  8. import "udpa/annotations/status.proto";
  9. import "validate/validate.proto";
  10. option java_package = "io.envoyproxy.envoy.service.tap.v2alpha";
  11. option java_outer_classname = "CommonProto";
  12. option java_multiple_files = true;
  13. option go_package = "github.com/envoyproxy/go-control-plane/envoy/service/tap/v2alpha";
  14. option (udpa.annotations.file_migrate).move_to_package = "envoy.config.tap.v3";
  15. option (udpa.annotations.file_status).package_version_status = FROZEN;
  16. // [#protodoc-title: Common tap configuration]
  17. // Tap configuration.
  18. message TapConfig {
  19. // [#comment:TODO(mattklein123): Rate limiting]
  20. // The match configuration. If the configuration matches the data source being tapped, a tap will
  21. // occur, with the result written to the configured output.
  22. MatchPredicate match_config = 1 [(validate.rules).message = {required: true}];
  23. // The tap output configuration. If a match configuration matches a data source being tapped,
  24. // a tap will occur and the data will be written to the configured output.
  25. OutputConfig output_config = 2 [(validate.rules).message = {required: true}];
  26. // [#not-implemented-hide:] Specify if Tap matching is enabled. The % of requests\connections for
  27. // which the tap matching is enabled. When not enabled, the request\connection will not be
  28. // recorded.
  29. //
  30. // .. note::
  31. //
  32. // This field defaults to 100/:ref:`HUNDRED
  33. // <envoy_api_enum_type.FractionalPercent.DenominatorType>`.
  34. api.v2.core.RuntimeFractionalPercent tap_enabled = 3;
  35. }
  36. // Tap match configuration. This is a recursive structure which allows complex nested match
  37. // configurations to be built using various logical operators.
  38. // [#next-free-field: 9]
  39. message MatchPredicate {
  40. // A set of match configurations used for logical operations.
  41. message MatchSet {
  42. // The list of rules that make up the set.
  43. repeated MatchPredicate rules = 1 [(validate.rules).repeated = {min_items: 2}];
  44. }
  45. oneof rule {
  46. option (validate.required) = true;
  47. // A set that describes a logical OR. If any member of the set matches, the match configuration
  48. // matches.
  49. MatchSet or_match = 1;
  50. // A set that describes a logical AND. If all members of the set match, the match configuration
  51. // matches.
  52. MatchSet and_match = 2;
  53. // A negation match. The match configuration will match if the negated match condition matches.
  54. MatchPredicate not_match = 3;
  55. // The match configuration will always match.
  56. bool any_match = 4 [(validate.rules).bool = {const: true}];
  57. // HTTP request headers match configuration.
  58. HttpHeadersMatch http_request_headers_match = 5;
  59. // HTTP request trailers match configuration.
  60. HttpHeadersMatch http_request_trailers_match = 6;
  61. // HTTP response headers match configuration.
  62. HttpHeadersMatch http_response_headers_match = 7;
  63. // HTTP response trailers match configuration.
  64. HttpHeadersMatch http_response_trailers_match = 8;
  65. }
  66. }
  67. // HTTP headers match configuration.
  68. message HttpHeadersMatch {
  69. // HTTP headers to match.
  70. repeated api.v2.route.HeaderMatcher headers = 1;
  71. }
  72. // Tap output configuration.
  73. message OutputConfig {
  74. // Output sinks for tap data. Currently a single sink is allowed in the list. Once multiple
  75. // sink types are supported this constraint will be relaxed.
  76. repeated OutputSink sinks = 1 [(validate.rules).repeated = {min_items: 1 max_items: 1}];
  77. // For buffered tapping, the maximum amount of received body that will be buffered prior to
  78. // truncation. If truncation occurs, the :ref:`truncated
  79. // <envoy_api_field_data.tap.v2alpha.Body.truncated>` field will be set. If not specified, the
  80. // default is 1KiB.
  81. google.protobuf.UInt32Value max_buffered_rx_bytes = 2;
  82. // For buffered tapping, the maximum amount of transmitted body that will be buffered prior to
  83. // truncation. If truncation occurs, the :ref:`truncated
  84. // <envoy_api_field_data.tap.v2alpha.Body.truncated>` field will be set. If not specified, the
  85. // default is 1KiB.
  86. google.protobuf.UInt32Value max_buffered_tx_bytes = 3;
  87. // Indicates whether taps produce a single buffered message per tap, or multiple streamed
  88. // messages per tap in the emitted :ref:`TraceWrapper
  89. // <envoy_api_msg_data.tap.v2alpha.TraceWrapper>` messages. Note that streamed tapping does not
  90. // mean that no buffering takes place. Buffering may be required if data is processed before a
  91. // match can be determined. See the HTTP tap filter :ref:`streaming
  92. // <config_http_filters_tap_streaming>` documentation for more information.
  93. bool streaming = 4;
  94. }
  95. // Tap output sink configuration.
  96. message OutputSink {
  97. // Output format. All output is in the form of one or more :ref:`TraceWrapper
  98. // <envoy_api_msg_data.tap.v2alpha.TraceWrapper>` messages. This enumeration indicates
  99. // how those messages are written. Note that not all sinks support all output formats. See
  100. // individual sink documentation for more information.
  101. enum Format {
  102. // Each message will be written as JSON. Any :ref:`body <envoy_api_msg_data.tap.v2alpha.Body>`
  103. // data will be present in the :ref:`as_bytes
  104. // <envoy_api_field_data.tap.v2alpha.Body.as_bytes>` field. This means that body data will be
  105. // base64 encoded as per the `proto3 JSON mappings
  106. // <https://developers.google.com/protocol-buffers/docs/proto3#json>`_.
  107. JSON_BODY_AS_BYTES = 0;
  108. // Each message will be written as JSON. Any :ref:`body <envoy_api_msg_data.tap.v2alpha.Body>`
  109. // data will be present in the :ref:`as_string
  110. // <envoy_api_field_data.tap.v2alpha.Body.as_string>` field. This means that body data will be
  111. // string encoded as per the `proto3 JSON mappings
  112. // <https://developers.google.com/protocol-buffers/docs/proto3#json>`_. This format type is
  113. // useful when it is known that that body is human readable (e.g., JSON over HTTP) and the
  114. // user wishes to view it directly without being forced to base64 decode the body.
  115. JSON_BODY_AS_STRING = 1;
  116. // Binary proto format. Note that binary proto is not self-delimiting. If a sink writes
  117. // multiple binary messages without any length information the data stream will not be
  118. // useful. However, for certain sinks that are self-delimiting (e.g., one message per file)
  119. // this output format makes consumption simpler.
  120. PROTO_BINARY = 2;
  121. // Messages are written as a sequence tuples, where each tuple is the message length encoded
  122. // as a `protobuf 32-bit varint
  123. // <https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.io.coded_stream>`_
  124. // followed by the binary message. The messages can be read back using the language specific
  125. // protobuf coded stream implementation to obtain the message length and the message.
  126. PROTO_BINARY_LENGTH_DELIMITED = 3;
  127. // Text proto format.
  128. PROTO_TEXT = 4;
  129. }
  130. // Sink output format.
  131. Format format = 1 [(validate.rules).enum = {defined_only: true}];
  132. oneof output_sink_type {
  133. option (validate.required) = true;
  134. // Tap output will be streamed out the :http:post:`/tap` admin endpoint.
  135. //
  136. // .. attention::
  137. //
  138. // It is only allowed to specify the streaming admin output sink if the tap is being
  139. // configured from the :http:post:`/tap` admin endpoint. Thus, if an extension has
  140. // been configured to receive tap configuration from some other source (e.g., static
  141. // file, XDS, etc.) configuring the streaming admin output type will fail.
  142. StreamingAdminSink streaming_admin = 2;
  143. // Tap output will be written to a file per tap sink.
  144. FilePerTapSink file_per_tap = 3;
  145. // [#not-implemented-hide:]
  146. // GrpcService to stream data to. The format argument must be PROTO_BINARY.
  147. StreamingGrpcSink streaming_grpc = 4;
  148. }
  149. }
  150. // Streaming admin sink configuration.
  151. message StreamingAdminSink {
  152. }
  153. // The file per tap sink outputs a discrete file for every tapped stream.
  154. message FilePerTapSink {
  155. // Path prefix. The output file will be of the form <path_prefix>_<id>.pb, where <id> is an
  156. // identifier distinguishing the recorded trace for stream instances (the Envoy
  157. // connection ID, HTTP stream ID, etc.).
  158. string path_prefix = 1 [(validate.rules).string = {min_bytes: 1}];
  159. }
  160. // [#not-implemented-hide:] Streaming gRPC sink configuration sends the taps to an external gRPC
  161. // server.
  162. message StreamingGrpcSink {
  163. // Opaque identifier, that will be sent back to the streaming grpc server.
  164. string tap_id = 1;
  165. // The gRPC server that hosts the Tap Sink Service.
  166. api.v2.core.GrpcService grpc_service = 2 [(validate.rules).message = {required: true}];
  167. }