-
Notifications
You must be signed in to change notification settings - Fork 284
refactor(http/prom): request::NewRecordBodyData is metrics agnostic
#4174
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
Merged
cratelyn
merged 1 commit into
main
from
kate/prepare-request-body-metrics-for-inbound-proxy
Sep 24, 2025
Merged
refactor(http/prom): request::NewRecordBodyData is metrics agnostic
#4174
cratelyn
merged 1 commit into
main
from
kate/prepare-request-body-metrics-for-inbound-proxy
Sep 24, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d03e89c to
13220e8
Compare
Member
Author
|
i have rebased this atop main as of 0060a4c. |
cratelyn
added a commit
that referenced
this pull request
Sep 22, 2025
this commit introduces an additional layer of telemetry to the inbound proxy's http router. either http and grpc metrics are used, depending upon the policy that authorized a given request. this is based upon #4174, which refactored the request body telemetry middleware to be metrics agnostic. see: * #4165 * #4166 * #4174 * #4127 Signed-off-by: katelyn martin <[email protected]>
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]>
13220e8 to
8a313b9
Compare
Member
Author
|
this branch has been rebased atop main, now that #4181 has landed. |
cratelyn
added a commit
that referenced
this pull request
Sep 24, 2025
this commit introduces an additional layer of telemetry to the inbound proxy's http router. either http and grpc metrics are used, depending upon the policy that authorized a given request. this is based upon #4174, which refactored the request body telemetry middleware to be metrics agnostic. see: * #4165 * #4166 * #4174 * #4127 Signed-off-by: katelyn martin <[email protected]>
cratelyn
added a commit
that referenced
this pull request
Sep 24, 2025
this commit introduces an additional layer of telemetry to the inbound proxy's http router. either http and grpc metrics are used, depending upon the policy that authorized a given request. this is based upon #4174, which refactored the request body telemetry middleware to be metrics agnostic. see: * #4165 * #4166 * #4174 * #4127 * #4186 Signed-off-by: katelyn martin <[email protected]>
cratelyn
added a commit
that referenced
this pull request
Sep 24, 2025
this commit introduces an additional layer of telemetry to the inbound proxy's http router. either http and grpc metrics are used, depending upon the policy that authorized a given request. this is based upon #4174, which refactored the request body telemetry middleware to be metrics agnostic. see: * #4188 * #4187 * #4186 * #4174 * #4165 * #4166 * #4127 Signed-off-by: katelyn martin <[email protected]>
cratelyn
added a commit
that referenced
this pull request
Sep 24, 2025
this commit introduces an additional layer of telemetry to the inbound proxy's http router. either http and grpc metrics are used, depending upon the policy that authorized a given request. this is based upon #4174, which refactored the request body telemetry middleware to be metrics agnostic. see: * #4188 * #4187 * #4186 * #4174 * #4165 * #4166 * #4127 Signed-off-by: katelyn martin <[email protected]>
olix0r
approved these changes
Sep 24, 2025
cratelyn
added a commit
that referenced
this pull request
Sep 24, 2025
this commit introduces an additional layer of telemetry to the inbound proxy's http router. either http and grpc metrics are used, depending upon the policy that authorized a given request. this is based upon #4174, which refactored the request body telemetry middleware to be metrics agnostic. see: * #4188 * #4187 * #4186 * #4174 * #4165 * #4166 * #4127 Signed-off-by: katelyn martin <[email protected]>
cratelyn
added a commit
that referenced
this pull request
Sep 24, 2025
this commit introduces an additional layer of telemetry to the inbound proxy's http router. either http and grpc metrics are used, depending upon the policy that authorized a given request. this is based upon #4174, which refactored the request body telemetry middleware to be metrics agnostic. see: * #4188 * #4187 * #4186 * #4174 * #4165 * #4166 * #4127 Signed-off-by: katelyn martin <[email protected]>
cratelyn
added a commit
that referenced
this pull request
Sep 26, 2025
this commit introduces an additional layer of telemetry to the inbound proxy's http router. either http and grpc metrics are used, depending upon the policy that authorized a given request. this is based upon #4174, which refactored the request body telemetry middleware to be metrics agnostic. see: * #4189 * #4188 * #4187 * #4186 * #4174 * #4165 * #4166 * #4127 Signed-off-by: katelyn martin <[email protected]>
cratelyn
added a commit
that referenced
this pull request
Sep 26, 2025
in #4174, we refactored this middleware so that it is now agnostic to the particular metrics structure used by the extractor, meaning that the constructor no longer accepts a `RequestBodyFamilies<L>` parameter. in the wake of this change, our request body frame size metrics middleware has a constructor with a type signature like `X -> impl Layer`. elsewhere throughout the project, constructors that accept an extractor and return a `svc::Layer` are typically called `layer_via()`. this commit renames `NewRecordBodyData::new()` to `NewRecordBodyData::layer_via()`. Signed-off-by: katelyn martin <[email protected]>
cratelyn
added a commit
that referenced
this pull request
Sep 30, 2025
in #4174, we refactored this middleware so that it is now agnostic to the particular metrics structure used by the extractor, meaning that the constructor no longer accepts a `RequestBodyFamilies<L>` parameter. in the wake of this change, our request body frame size metrics middleware has a constructor with a type signature like `X -> impl Layer`. elsewhere throughout the project, constructors that accept an extractor and return a `svc::Layer` are typically called `layer_via()`. this commit renames `NewRecordBodyData::new()` to `NewRecordBodyData::layer_via()`. Signed-off-by: katelyn martin <[email protected]>
cratelyn
added a commit
that referenced
this pull request
Sep 30, 2025
in #4174, we refactored this middleware so that it is now agnostic to the particular metrics structure used by the extractor, meaning that the constructor no longer accepts a `RequestBodyFamilies<L>` parameter. in the wake of this change, our request body frame size metrics middleware has a constructor with a type signature like `X -> impl Layer`. elsewhere throughout the project, constructors that accept an extractor and return a `svc::Layer` are typically called `layer_via()`. this commit renames `NewRecordBodyData::new()` to `NewRecordBodyData::layer_via()`. Signed-off-by: katelyn martin <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 acceptingGrpc<T>andHttp<T>targets, respectively, each holding a single metricsFamily<L>.(b): a single
NewService<T>that matches on thePermitted<T>enum to select one of two metricsFamily<L>s.see #4119 for more background on this
Permitted<T>enum.so, we should make the
NewRecordBodyDataagnostic to its metrics, rather than holding a concreteRequestBodyFamilies<L>.this commit hoists the metrics out of the middleware, and into the
XandReqXextractors used in theNewService<T>andService<T>layers, respectively.bear particular attention to this part of the diff:
in other words, rather than using
Xand subsequentlyReqXto extract our labelsL, we expect these extractors to yield aBodyDataMetrics: one time series that should be incremented accordingly by the instrumented request.in even simpler words:
ReqXnow callsfamiles.metrics(&labels)too.