...
1syntax = "proto3";
2
3package linkerd2.tap;
4
5import "google/protobuf/duration.proto";
6import "common/net.proto";
7import "viz.proto";
8
9option go_package = "github.com/linkerd/linkerd2/viz/tap/gen/tap";
10
11message TapRequest {
12 option deprecated = true;
13
14 oneof target {
15 string pod = 1;
16 string deployment = 2;
17 }
18 // validation of these fields happens on the server
19 float maxRps = 3;
20 uint32 toPort = 4;
21 string toIP = 5;
22 uint32 fromPort = 6;
23 string fromIP = 7;
24 string scheme = 8;
25 string method = 9;
26 string authority = 10;
27 string path = 11;
28}
29
30// A tap request over kubernetes resources.
31//
32// This is used only by the tap APIServer.
33message TapByResourceRequest {
34 // Describes the kubernetes pods that should be tapped.
35 viz.ResourceSelection target = 1;
36
37 // Selects over events to be reported.
38 Match match = 2;
39
40 // Limits the number of events to be inspected.
41 float maxRps = 3;
42
43 message Match {
44 oneof match {
45 // If empty, matches all messages.
46 Seq all = 1;
47
48 // If empty, matches no messages.
49 Seq any = 2;
50
51 // Inverts the inner match.
52 Match not = 3;
53
54 // Matches events being sent to any of the selected destinations.
55 viz.ResourceSelection destinations = 4;
56
57 // Matches HTTP requests by their metadata.
58 Http http = 5;
59 }
60
61 message Seq {
62 repeated Match matches = 1;
63 }
64
65 message Http {
66 oneof match {
67 string scheme = 1;
68 string method = 2;
69 string authority = 3;
70 string path = 4;
71 }
72 }
73 }
74
75 // Conditionally extracts components from requests and responses to include
76 // in tap events
77 Extract extract = 4;
78
79 message Extract {
80 oneof extract {
81 Http http = 1;
82 }
83
84 message Http {
85 oneof extract {
86 Headers headers = 1;
87 }
88
89 message Headers {}
90 }
91 }
92}
93
94// This is used only by the tap APIServer.
95message TapEvent {
96 linkerd2.common.net.TcpAddress source = 1;
97 EndpointMeta source_meta = 5;
98
99 linkerd2.common.net.TcpAddress destination = 2;
100 EndpointMeta destination_meta = 4;
101
102 RouteMeta route_meta = 7;
103
104 ProxyDirection proxy_direction = 6;
105 enum ProxyDirection {
106 UNKNOWN = 0;
107 INBOUND = 1;
108 OUTBOUND = 2;
109 }
110
111 oneof event {
112 Http http = 3;
113 }
114
115 message EndpointMeta {
116 map<string, string> labels = 1;
117 }
118
119 message RouteMeta {
120 map<string, string> labels = 1;
121 }
122
123 message Http {
124 oneof event {
125 RequestInit request_init = 1;
126 ResponseInit response_init = 2;
127 ResponseEnd response_end = 3;
128 }
129
130 message StreamId {
131 // A randomized base (stable across a process's runtime)
132 uint32 base = 1;
133
134 // A stream id unique within the lifetime of `base`.
135 uint64 stream = 2;
136 }
137
138 message RequestInit {
139 StreamId id = 1;
140 viz.HttpMethod method = 2;
141 viz.Scheme scheme = 3;
142 string authority = 4;
143 string path = 5;
144 viz.Headers headers = 6;
145 }
146
147 message ResponseInit {
148 StreamId id = 1;
149
150 google.protobuf.Duration since_request_init = 2;
151
152 uint32 http_status = 3;
153 viz.Headers headers = 4;
154 }
155
156 message ResponseEnd {
157 StreamId id = 1;
158
159 google.protobuf.Duration since_request_init = 2;
160 google.protobuf.Duration since_response_init = 3;
161 uint64 response_bytes = 4;
162
163 viz.Eos eos = 5;
164 viz.Headers trailers = 6;
165 }
166 }
167}
168
169service Tap {
170 rpc Tap(TapRequest) returns (stream TapEvent) { option deprecated = true; }
171 rpc TapByResource(TapByResourceRequest) returns (stream TapEvent) { option deprecated = true; }
172}
View as plain text