Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(app): Outline route label extractor #3337

Open
wants to merge 2 commits into
base: kate/record-body-data
Choose a base branch
from

Conversation

cratelyn
Copy link
Collaborator

@cratelyn cratelyn commented Nov 7, 2024

this PR, based upon #3308, generalizes the ExtractParam<P, T> type used to retrieve Prometheus labels for the route-level retry middleware. this is a helpful component we'll want in order to build route-level frame counting middleware.

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.

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.

🔗 related

@cratelyn cratelyn force-pushed the kate/hoist-route-label-extractor branch from bb26e1e to 2d8d0f2 Compare November 7, 2024 06:34
@cratelyn cratelyn self-assigned this Nov 7, 2024
@cratelyn cratelyn marked this pull request as ready for review November 7, 2024 15:50
@cratelyn cratelyn requested a review from a team as a code owner November 7, 2024 15:50
cratelyn added a commit that referenced this pull request Nov 10, 2024
 ### ⛅ 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, and (b) the number of bytes included
in body frames.

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

Signed-off-by: katelyn martin <[email protected]>
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 <[email protected]>
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 <[email protected]>
@cratelyn cratelyn force-pushed the kate/hoist-route-label-extractor branch from 2d8d0f2 to a75492c Compare November 10, 2024 22:37
cratelyn added a commit that referenced this pull request Nov 10, 2024
 ### ⛅ 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, and (b) the number of bytes included
in body frames.

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

Signed-off-by: katelyn martin <[email protected]>
cratelyn added a commit that referenced this pull request Nov 10, 2024
 ### ⛅ 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, and (b) the number of bytes included
in body frames.

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.

Signed-off-by: katelyn martin <[email protected]>
cratelyn added a commit that referenced this pull request Nov 10, 2024
 ### ⛅ 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, and (b) the number of bytes included
in body frames.

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.

Signed-off-by: katelyn martin <[email protected]>
@cratelyn cratelyn removed their assignment Nov 10, 2024
@cratelyn
Copy link
Collaborator Author

this pr has been rebased onto main as of release v2.263.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants