this `Server` type is not used by any tests.
this commit removes it, to help facilitate the upgrade to the hyper 1.0
major release. see <https://github.com/linkerd/linkerd2/issues/8733>.
Signed-off-by: katelyn martin <kate@buoyant.io>
CI runs frequently timeout waiting for pod readiness. There is a hardcoded 1m
timeout.
This change makes this timeout configurable, specifying a 2m timeout in the CI
configuration.
* chore(app/admin): add `http-body` dependency
before we address deprecated hyper interfaces related to `http_bodies`,
we'll want to add this dependency so that we can call `Body::collect()`.
Signed-off-by: katelyn martin <kate@buoyant.io>
* refactor(app): update deprecated hyper body calls
hyper 0.14.x provided a collection of interfaces related to collecting
and aggregating request and response bodies, which were deprecated and
removed in the 1.x major release.
this commit updates calls to `hyper::body::to_bytes(..)` and
`hyper::body::aggregate(..)`. for now, `http_body::Body` is used, but we
can use `http_body_util::BodyExt` once we've bumped our hyper dependency
to the 1.x major release.
for more information, see:
* https://github.com/linkerd/linkerd2/issues/8733
* https://github.com/hyperium/hyper/issues/2840
* https://github.com/hyperium/hyper/pull/3020
Signed-off-by: katelyn martin <kate@buoyant.io>
---------
Signed-off-by: katelyn martin <kate@buoyant.io>
this is a prepatory chore, laying more ground to facilitate upgrading
our hyper dependency to the 1.0 major release. this commit adds the
`deprecated` cargo feature to each of the hyper dependencies in the
cargo workspace.
to prevent this from introducing a large number of compiler warnings to
the build, the `#[allow(deprecated)]` attribute is added to relevant
expressions.
these uses of deprecated interfaces will be updated in subsequent
commits. broadly, these fall into a few common cases:
* `hyper::client::conn::SendRequest` now has protocol specific `h1` and
`h2` variants.
* `hyper::server::conn::Builder` now has protocol specific `h1` and
`h2` variants.
* `hyper::server::conn::Http` is deprecated.
* functions like `hyper::body::aggregate(..)` and
`hyper::body::to_bytes(..)` are deprecated.
see https://github.com/linkerd/linkerd2/issues/8733 for more information
on the hyper 1.0 upgrade process.
Signed-off-by: katelyn martin <kate@buoyant.io>
* refactor(proxy/http): move types to `linkerd-http-classify` (#3382)
in this case we already had a crate defining the classify traits, but
the http body and other assorted middleware were defined in
`linkerd-proxy-http`.
this commit moves those types to the `linkerd-http-classify` crate,
which astute readers may notice, is a concrete step towards simplifying
the `linkerd-proxy-http` crate's upgrade process.
one small detail worth calling out: we implement `http_body::Body`
directly, to avoid taking on a `hyper` dependency. otherwise, nothing
has changed in the `channel`, `gate`, and `insert` middleware.
Signed-off-by: katelyn martin <kate@buoyant.io>
* refactor(proxy/http): create `linkerd-http-retain` crate (#3382)
this moves the `Retain` middleware from `linkerd-proxy-http` into a new
`linkerd-http-retain` crate.
as previously, reëxports are added to make this a backwards compatible
change.
this moves another http body middleware out of the proxy's core http
crate. great news.
Signed-off-by: katelyn martin <kate@buoyant.io>
* refactor(proxy/http): create `linkerd-http-stream-timeouts` crate (#3382)
this commit outlines the stream timeout middleware, pulling it out of
`linkerd-proxy-http` and into a standalone crate.
again, reëxports are added to make this a backwards compatible change.
Signed-off-by: katelyn martin <kate@buoyant.io>
* refactor(proxy/http): create `linkerd-http-override-authority` crate (#3382)
NB: based on #3379 and #3380.
this pull the `override_authority` submodule out of
`linkerd-http-proxy` and into a standalone crate.
Signed-off-by: katelyn martin <kate@buoyant.io>
* refactor(proxy/http): move `is_bad_request()` into `upgrade` (#3382)
this is only used in once place, so as a brief chore before we move the
upgrade submodule out into its own crate, we pull `is_bad_request()`
next to its call site.
Signed-off-by: katelyn martin <kate@buoyant.io>
* refactor(proxy/http): create `linkerd-http-upgrade` crate (#3382)
this moves the inter-related `upgrade` and `glue` submodules out of the
`linkerd-proxy-http` library and into a new standalone crate.
Signed-off-by: katelyn martin <kate@buoyant.io>
---------
Signed-off-by: katelyn martin <kate@buoyant.io>
The initial implementation of opaq filters uses `push_filter` so that
errors originate from `Service::poll_ready` rather than `Service::call`.
This causes the transport metrics middleware to not count failed
connections.
By changing the filter contract so that filters are applied in `Service::call`,
we ensure that middlewares see response failures rather than readiness
failures.
Signed-off-by: Zahari Dichev <zaharidichev@gmail.com>
Co-authored-by: Oliver Gould <ver@buoyant.io>
* refactor(proxy/http): create `linkerd-http-insert` crate
this pulls out the `insert` module from `linkerd-proxy-http`.
a reëxport is added so that this does not affect the public api of the
http crate.
NB: based on #3379.
Signed-off-by: katelyn martin <kate@buoyant.io>
* docs(http/insert): doc comments
this commit adds documentation to `linkerd-http-insert`.
Signed-off-by: katelyn martin <kate@buoyant.io>
---------
Signed-off-by: katelyn martin <kate@buoyant.io>
* feat(proxy/http): create `linkerd-http-version` crate
this outlines the http version type into its own crate.
reëxports are added to make this a backwards compatible change, i.e. no
changes to the public api of `linkerd-proxy-http` are performed here.
Signed-off-by: katelyn martin <kate@buoyant.io>
* docs(http/version): doc comments
this adds some brief documentation comments to the crate.
Signed-off-by: katelyn martin <kate@buoyant.io>
---------
Signed-off-by: katelyn martin <kate@buoyant.io>
### ⛅ overview
this introduces a new tower middleware for Prometheus metrics, used for
instrumenting HTTP and gRPC request bodies, and observing (a) the
number of frames yielded by a body, (b) the number of bytes included
in body frames, and (c) a distribution of the size of frames yielded.
this builds upon the backend-level metrics added in #3308. this
additionally uses the route label extractor, hoisted out of the retry
middleware's Prometheus telemetry in #3337.
### 📝 changes
* a `linkerd_http_prom::body_data::request::NewRecordBodyData::NewRecordBodyData`
middleware is added, which complements the equivalent
`linkerd_http_prom::body_data::response` middleware.
* this is added to policy routes' metrics layer.
see prometheus/client_rust#241 and prometheus/client_rust#242, which
track upstream proposals to add accessors to `Histogram` that will allow
us to make test assertions that metrics are working properly. for now,
these are feature gated as also done in #3308.
Signed-off-by: katelyn martin <kate@buoyant.io>
* refactor(app): Hoist label extractor out of retry middleware
this commit promotes the `RetryLabelExtract` type out of the route retry
middleware, and into the metrics submodule.
in preparation for generalizing this component, we rename it to
`RouteLabelExtract`.
Signed-off-by: katelyn martin <kate@buoyant.io>
* refactor(app): Outline route label extraction
this addresses the `TODO` comment, moving the `RouteLabelExtract` type
out of the policy route layer function.
this defines a method on `MatchedRoute` which may be called to retrieve
a `RouteLabelExtract`. that type holds references to the
contruction-time information about the route, and can be used to later
inspect an outbound request at call-time, returning a `labels::Route`
set of labels.
this is a helpful piece of reusable glue that is broadly useful in
instrumenting our route-level middleware.
Signed-off-by: katelyn martin <kate@buoyant.io>
---------
Signed-off-by: katelyn martin <kate@buoyant.io>
* feat(app): Backend response frame count metrics
this introduces a new tower middleware for Prometheus metrics, used for
instrumenting HTTP and gRPC response bodies, and observing (a) the
number of frames yielded by a body, and (b) the number of bytes included
in body frames, and (c) the distribution of frame sizes.
this middleware allows operators to reason about how large or small the
packets being served in a backend's response bodies are.
a route-level middleware that instruments request bodies will be added
in a follow-on PR.
### 📝 changes
an overview of changes made here:
* the `linkerd-http-prom` has a new `body_data` submodule. it exposes
`request` and `response` halves, to be explicit about which body is
being instrumented on a `tower::Service`.
* the `linkerd-http-prom` crate now has a collection of new
dependencies: `bytes` is added as a dependency in order to inspect the
data chunk when the inner body yields a new frame. `futures-util` and
`http-body` are added as dev-dependencies for the accompanying test
coverage.
* body metrics are affixed to the `RouteBackendMetrics<L>` structure,
and registered at startup.
Signed-off-by: katelyn martin <kate@buoyant.io>
* review: Inline attribute to service passthrough
Signed-off-by: katelyn martin <kate@buoyant.io>
* review: Inline attribute to body passthrough
continuing this theme of inlining, we inline the passthrough methods on
`Body` as well.
Signed-off-by: katelyn martin <kate@buoyant.io>
* review: Box `<RecordBodyData as Service>::Future` values
Signed-off-by: katelyn martin <kate@buoyant.io>
* review: rename `get()` to `metrics()`
Signed-off-by: katelyn martin <kate@buoyant.io>
* review: simplify `RecordBodyData<S>` response
Signed-off-by: katelyn martin <kate@buoyant.io>
* Update ResponseBody metrics to use a histogram
Signed-off-by: Oliver Gould <ver@buoyant.io>
* refactor(tests): feature gate frame size histogram assertions
see:
* https://github.com/prometheus/client_rust/pull/242
* https://github.com/prometheus/client_rust/pull/241
for now, refactor this test so that it gates all use of the (proposed)
`sum()` and `count()` accessors behind a temporary feature gate.
Signed-off-by: katelyn martin <kate@buoyant.io>
---------
Signed-off-by: katelyn martin <kate@buoyant.io>
Signed-off-by: Oliver Gould <ver@buoyant.io>
Co-authored-by: Oliver Gould <ver@buoyant.io>
* refactor(app): add `pending()` helper for mock body
in timeout tests, we construct mock bodies that are backed by a
`Pending<T>` future that will never yield any data.
this introduces a small `pending()` helper to the `MockBody` type used
in test code in the outbound proxy.
Signed-off-by: katelyn martin <kate@buoyant.io>
* refactor(app): add `error()` helper for mock body
in metrics tests, we construct mock bodies that will yield an error
when polled, to examine how telemetry measures certain edge cases.
this introduces a small `error()` helper to the `MockBody` type used
in test code in the outbound proxy.
Signed-off-by: katelyn martin <kate@buoyant.io>
* refactor(app): add `grpc_status()` helper for mock body
in metrics tests, we construct mock bodies that will yield an gRPC
status code in its trailers section
when polled, to examine how telemetry measures gRPC responses.
this refactors the `trailers()` function to more narrowly focus on the
test coverage needed, to help reduce boilerplate in test code.
Signed-off-by: katelyn martin <kate@buoyant.io>
---------
Signed-off-by: katelyn martin <kate@buoyant.io>