Commit ef90dd5
Add a pure-virtual getFilterName() to HTTPSourceFilter
Summary:
NOTE: this is one of two candidate designs, pushed as a draft so it can be
compared against D114801323 (same goal, non-pure virtual with a default). Not
final.
`HTTPMessageFilter` has had `getFilterName()` for a long time, and revproxy
uses it to record which filters a response passed through (the
`var.resp_filter_chain` variable, which ends up in CDN access logs and in TRC).
The coro filter hierarchy has no equivalent, so a coro filter chain cannot be
described at all. This adds the same accessor to `HTTPSourceFilter` and
implements it on every subclass.
It is deliberately pure, so a filter cannot land without a name. That is a
bigger change than it sounds: `HTTPSource` is abstract, but `HTTPSourceFilter`
is not -- it implements all three of `HTTPSource`'s pure virtuals by delegating
to `source_`, which is exactly why subclasses can override only what they want
to intercept. A pure virtual makes `HTTPSourceFilter` abstract for the first
time, so every leaf subclass in the repo has to implement the accessor,
including test fixtures. That is ~55 classes across proxygen, bigcache,
manifold, c2p, crackerjack, edgetee, tgc, otel_gateway, observability query
gateway, sandlet and oil. One site (`CacheFillRequestTest`) constructed
`HTTPSourceFilter` directly as a pass-through and now needs a named subclass to
compile at all.
Filters that have a non-coro counterpart return the same name --
`StripPerHop`, `Decompression`, `ResponseTracing`, `RequestTracing`,
`websocket-proxy` -- so a chain recorded from either handler is comparable. The
rest are named after themselves, and test fixtures take a `Test` prefix. Two
notes: the per-hop stripping filter in `HTTPCoroRevProxyHandler` was an
anonymous `TransformFilter` configured with lambdas and had no type to hang a
name on, so it becomes a named `StripPerHopSourceFilter`; and
`BodyDecompressionFilter` deliberately has no override, since inheriting
`Decompression` from `DecompressionIngressFilter` is the correct answer.
No behavior change -- nothing reads these names until D114778859 on top.
The known cost of the pure form is that generic filters can only be named by
type, so `Transform`, `Visitor` and `CompletionTransform` are uninformative in
a logged chain even though those instances are doing quite specific jobs.
Reviewed By: hanidamlaj
Differential Revision: D114801329
fbshipit-source-id: 1a9b5be2202e2b623f13d111f07a838adb3d22831 parent 5ffc71d commit ef90dd5
17 files changed
Lines changed: 76 additions & 0 deletions
File tree
- proxygen/lib/http/coro
- filters
- test
- test
- util
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| 53 | + | |
| 54 | + | |
52 | 55 | | |
53 | 56 | | |
54 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
| |||
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
53 | 61 | | |
54 | 62 | | |
55 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
| |||
86 | 89 | | |
87 | 90 | | |
88 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
89 | 95 | | |
90 | 96 | | |
91 | 97 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
158 | 158 | | |
159 | 159 | | |
160 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
161 | 164 | | |
162 | 165 | | |
163 | 166 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| |||
0 commit comments