Commit 13220e8
committed
refactor(http/prom):
this commit makes a mechanical refactor in the interest of paving ground
towards using the request body metrics middleware in the inbound proxy.
because of minor differences in how we represent protocols like gRPC in
the inbound and outbound proxies, we must account for:
(a): distinct `NewService<T>`'s accepting `Grpc<T>` and `Http<T>`
targets, respectively, each holding a single metrics `Family<L>`.
(b): a single `NewService<T>` that matches on the `Permitted<T>` enum to
select one of two metrics `Family<L>`s.
see #4119 for more background on this
`Permitted<T>` enum.
so, we should make the `NewRecordBodyData` agnostic to its metrics,
rather than holding a concrete `RequestBodyFamilies<L>`.
this commit hoists the metrics out of the middleware, and into the `X`
and `ReqX` extractors used in the `NewService<T>` and `Service<T>`
layers, respectively.
bear particular attention to this part of the diff:
```diff
- ReqX: ExtractParam<L, Request<ReqB>>,
- L: linkerd_metrics::prom::encoding::EncodeLabelSet
- + std::fmt::Debug
- + std::hash::Hash
- + Eq
- + Clone
- + Send
- + Sync
- + 'static,
+ ReqX: ExtractParam<BodyDataMetrics, Request<ReqB>>,
```
in other words, rather than using `X` and subsequently `ReqX` to extract
our labels `L`, we expect these extractors to yield a `BodyDataMetrics`:
one time series that should be incremented accordingly by the
instrumented request.
in even simpler words: `ReqX` now calls `familes.metrics(&labels)` too.
Signed-off-by: katelyn martin <[email protected]>request::NewRecordBodyData is metrics agnostic1 parent 0060a4c commit 13220e8
File tree
2 files changed
+53
-40
lines changed- linkerd
- app/outbound/src/http/logical/policy/route
- http/prom/src/body_data
2 files changed
+53
-40
lines changedLines changed: 42 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
64 | 77 | | |
65 | 78 | | |
66 | 79 | | |
67 | 80 | | |
68 | 81 | | |
69 | 82 | | |
70 | 83 | | |
71 | | - | |
72 | | - | |
73 | | - | |
| 84 | + | |
| 85 | + | |
74 | 86 | | |
75 | 87 | | |
76 | 88 | | |
77 | 89 | | |
78 | 90 | | |
79 | 91 | | |
80 | 92 | | |
81 | | - | |
| 93 | + | |
82 | 94 | | |
83 | 95 | | |
84 | 96 | | |
| |||
172 | 184 | | |
173 | 185 | | |
174 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
175 | 212 | | |
176 | 213 | | |
177 | 214 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
23 | | - | |
| 22 | + | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
27 | | - | |
28 | 26 | | |
29 | 27 | | |
30 | 28 | | |
31 | 29 | | |
32 | | - | |
| 30 | + | |
33 | 31 | | |
34 | 32 | | |
35 | | - | |
36 | 33 | | |
37 | 34 | | |
38 | 35 | | |
39 | 36 | | |
40 | 37 | | |
41 | | - | |
| 38 | + | |
42 | 39 | | |
43 | 40 | | |
44 | 41 | | |
45 | | - | |
46 | 42 | | |
47 | 43 | | |
48 | 44 | | |
49 | 45 | | |
50 | 46 | | |
51 | | - | |
| 47 | + | |
52 | 48 | | |
53 | 49 | | |
54 | 50 | | |
55 | | - | |
56 | 51 | | |
57 | | - | |
| 52 | + | |
58 | 53 | | |
59 | 54 | | |
60 | 55 | | |
61 | 56 | | |
62 | 57 | | |
63 | | - | |
64 | 58 | | |
65 | 59 | | |
66 | 60 | | |
67 | 61 | | |
68 | 62 | | |
69 | | - | |
70 | 63 | | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
| 64 | + | |
76 | 65 | | |
77 | 66 | | |
78 | 67 | | |
79 | 68 | | |
80 | 69 | | |
81 | | - | |
| 70 | + | |
82 | 71 | | |
83 | 72 | | |
84 | 73 | | |
85 | 74 | | |
86 | 75 | | |
87 | 76 | | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
| 77 | + | |
97 | 78 | | |
98 | 79 | | |
99 | 80 | | |
| |||
108 | 89 | | |
109 | 90 | | |
110 | 91 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
| 92 | + | |
116 | 93 | | |
117 | 94 | | |
118 | | - | |
119 | | - | |
| 95 | + | |
120 | 96 | | |
121 | 97 | | |
122 | 98 | | |
| |||
0 commit comments