Commit 67088e5
authored
Simplify tap server (#582)
## Description
Remove the Tap daemon that is responsible for handling service registrations and
tap subscriptions.
There is now a registry that contains all active taps.
The tap service has access to this registry and it uses it to retrieve an
updated set of active taps for every request. This set is used to determine
whether the request should be tapped.
New taps are added when the gRPC server receives an observe request. If the
request is valid, the server adds the tap to the registry.
Inactive taps are cleared by a background task. This background task is much
simpler than the one before; it loops on an interval and checks whether each tap
still has an actively used response stream, and if it has not reached its limit.
### Changes
The primary change is the addition of the `Registry` in
`linkerd/proxy/tap/src/registry.rs`.
The tap service holds on to a `Registry` and uses the `taps_recv` field to get
an updated list of taps for each request. The tap service is not responsible for
adding or removing any taps from the registry.
The gRPC service also holds on to a `Registry` and uses the `inner` field to
register new taps with the registry. The field is locked giving access to an
`Inner`. With this, the gRPC server can add new taps to the registry and then
send updates with the `taps_send` sender.
Neither the tap service or the gRPC is responsible for clearing out inactive
taps. To solve this, we spawn a background task with the `async fn clean` method
which loops on an interval and checks that each tap still has an actively used
response stream.
### Traits
The `tap::iface` module now only contains the `Tap`, `TapPayload`, and
`TapResponse` traits. These are helpful for traits that are implemented in
`tap::grpc`.
The `Subscribe` and `Register` traits have been removed. Services no longer
*register* with the tap server. Taps still do subscribe (now called `register`)
with the registry, but it was only implemented by one object and did not
simplify the implementation in terms of understanding or save on duplicated
code.
Signed-off-by: Kevin Leimkuhler <[email protected]>1 parent 022ecfc commit 67088e5
File tree
9 files changed
+149
-363
lines changed- linkerd
- app/src
- proxy/tap/src
- grpc
9 files changed
+149
-363
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
547 | 547 | | |
548 | 548 | | |
549 | 549 | | |
550 | | - | |
| 550 | + | |
551 | 551 | | |
552 | 552 | | |
553 | 553 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
| |||
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
343 | 343 | | |
344 | 344 | | |
345 | 345 | | |
346 | | - | |
347 | | - | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
348 | 355 | | |
349 | 356 | | |
350 | 357 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | 46 | | |
48 | | - | |
| 47 | + | |
49 | 48 | | |
50 | 49 | | |
51 | | - | |
| 50 | + | |
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
55 | | - | |
| 54 | + | |
56 | 55 | | |
57 | 56 | | |
58 | 57 | | |
59 | 58 | | |
60 | 59 | | |
| 60 | + | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | | - | |
65 | 64 | | |
66 | 65 | | |
67 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | | - | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | | - | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
| 23 | + | |
25 | 24 | | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
98 | | - | |
| 97 | + | |
| 98 | + | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
| 109 | + | |
114 | 110 | | |
115 | 111 | | |
116 | 112 | | |
| |||
178 | 174 | | |
179 | 175 | | |
180 | 176 | | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
| 177 | + | |
| 178 | + | |
185 | 179 | | |
186 | 180 | | |
187 | 181 | | |
| |||
0 commit comments