You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(http/prom): request::NewRecordBodyData is metrics agnostic
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]>
0 commit comments