refactor(http/prom): Simplify `record_response` middleware
this branch makes a variety of small, non-breaking changes to the linkerd-http-prom crate, and the outbound proxy code related to route- and backend-level metrics.
this branch does not make particularly significant breaking changes to the StreamLabel or MkStreamLabel traits. this branch is focused on minimizing the type complexity of these traits, and consequently in dependent code.
these changes are provided in distinct, atomic commits. readers are encourages to review this branch commit-by-commit. the primary changes that are worth highlighting, mentioned in comments below are:
-
StreamLabelis now object-safe, making use ofdyn StreamLabelpossible. we now userequest::Partsandresponse::Partsparameters in our trait methods. this means that we no longer need to be generic across request/response bodies, but retain the ability to inspect e.g. status codes. -
the
StreamLabelinterface includes associated types for the labels used for metrics related to request/response duration, and counting status codes. we do not however, actually need to separately define these associated types in theMkStreamLabelcontract. these types are removed. -
ResponseMetricsandRequestMetricsare generic overL: StreamLabel. these were previously generic overDurationLabelsandStatusLabels, even though the same parentLwas used in practice. -
documentation to various interfaces is added.
nb: this isn't expected to compile right now, i'm refraining from updating app code until the linkerd-http-prom interfaces are more situated.