...
1syntax = "proto3";
2
3package io.linkerd.proxy.tap;
4
5option go_package = "github.com/linkerd/linkerd2-proxy-api/go/tap";
6
7import "google/protobuf/duration.proto";
8
9import "http_types.proto";
10import "net.proto";
11
12// A service exposed by proxy instances to setup
13service Tap {
14 rpc Observe(ObserveRequest) returns (stream TapEvent) {}
15}
16
17message ObserveRequest {
18 // Limits the number of event keys that will be returned by this tap.
19 uint32 limit = 1;
20
21 // Encodes request-matching logic.
22 Match match = 2;
23
24 message Match {
25 message Seq { repeated Match matches = 1; }
26
27 oneof match {
28 Seq all = 1;
29 Seq any = 2;
30 Match not = 3;
31
32 Tcp source = 4;
33 Tcp destination = 5;
34 Http http = 6;
35
36 Label destination_label = 7;
37 Label route_label = 8;
38 }
39
40 message Label {
41 string key = 1;
42 string value = 2;
43 }
44
45 message Tcp {
46 oneof match {
47 Netmask netmask = 1;
48
49 PortRange ports = 3;
50 }
51
52 message Netmask {
53 net.IPAddress ip = 1;
54
55 uint32 mask = 2;
56 }
57
58 // If either a minimum or maximum is not specified, the range is
59 // considered to be over a discrete value.
60 message PortRange {
61 // Minimum matching port value (inclusive), if specified.
62 uint32 min = 1;
63
64 // Maximum matching port value (inclusive), if specified.
65 uint32 max = 2;
66 }
67 }
68
69 message Http {
70 oneof match {
71 http_types.Scheme scheme = 1;
72 http_types.HttpMethod method = 3;
73 StringMatch authority = 2;
74 StringMatch path = 4;
75 // TODO Header header = 4;
76 }
77
78 message StringMatch {
79 oneof match {
80 string exact = 1;
81 string prefix = 2;
82 }
83 }
84 }
85 }
86
87 // Conditionally extracts components from requests and responses to include
88 // in tap events
89 Extract extract = 3;
90
91 message Extract {
92 oneof extract { Http http = 1; }
93
94 message Http {
95 oneof extract { Headers headers = 1; }
96
97 message Headers {}
98 }
99 }
100}
101
102message Eos {
103 oneof end {
104 uint32 grpc_status_code = 1;
105 uint32 reset_error_code = 2;
106 }
107}
108
109message TapEvent {
110 net.TcpAddress source = 1;
111 EndpointMeta source_meta = 5;
112
113 RouteMeta route_meta = 7;
114
115 net.TcpAddress destination = 2;
116 EndpointMeta destination_meta = 4;
117
118 ProxyDirection proxy_direction = 6;
119 enum ProxyDirection {
120 UNKNOWN = 0;
121 INBOUND = 1;
122 OUTBOUND = 2;
123 }
124
125 oneof event { Http http = 3; }
126
127 message EndpointMeta { map<string, string> labels = 1; }
128
129 message RouteMeta { map<string, string> labels = 1; }
130
131 message Http {
132 oneof event {
133 RequestInit request_init = 1;
134 ResponseInit response_init = 2;
135 ResponseEnd response_end = 3;
136 }
137
138 message StreamId {
139 // A randomized base (stable across a process's runtime)
140 uint32 base = 1;
141
142 // A stream id unique within the lifetime of `base`.
143 uint64 stream = 2;
144 }
145
146 message RequestInit {
147 StreamId id = 1;
148 http_types.HttpMethod method = 2;
149 http_types.Scheme scheme = 3;
150 string authority = 4;
151 string path = 5;
152 http_types.Headers headers = 6;
153 }
154
155 message ResponseInit {
156 StreamId id = 1;
157
158 google.protobuf.Duration since_request_init = 2;
159
160 uint32 http_status = 3;
161 http_types.Headers headers = 4;
162 }
163
164 message ResponseEnd {
165 StreamId id = 1;
166
167 google.protobuf.Duration since_request_init = 2;
168 google.protobuf.Duration since_response_init = 3;
169 uint64 response_bytes = 4;
170
171 Eos eos = 5;
172 http_types.Headers trailers = 6;
173 }
174 }
175}
View as plain text