-
Notifications
You must be signed in to change notification settings - Fork 268
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(app): Add hostname label to route metrics (#3258)
this commit introduces an additional label to HTTP and gRPC route metrics, containing the DNS host of requests. requests destined for an ip address of some kind are not recorded with a hostname metric, as a way to help minimize the impact of time series cardinality. the core of this change is in this field addition: ```diff // /linkerd/app/outbound/src/http/logical/policy/route/metrics/labels.rs -pub struct Route(pub ParentRef, pub RouteRef); +pub struct Route { + parent: ParentRef, + route: RouteRef, + hostname: Option<dns::Name>, +} ``` see this part of the change to our `MkStreamLabel` implementation, used in our metrics tracking request durtion, and counting response status codes: ```diff - fn mk_stream_labeler<B>(&self, _: &::http::Request<B>) -> Option<Self::StreamLabel> { + fn mk_stream_labeler<B>(&self, req: &::http::Request<B>) -> Option<Self::StreamLabel> { let parent = self.params.parent_ref.clone(); let route = self.params.route_ref.clone(); - Some(metrics::LabelHttpRsp::from(metrics::labels::Route::from(( - parent, route, - )))) + Some(metrics::LabelHttpRsp::from(metrics::labels::Route::new( + parent, + route, + req.uri(), + ))) } ``` we now inspect the request, and use the URI to label metrics related to this traffic by hostname. a `http_request_hostnames()` test case is added to exercise this. some todo comments are left, noting where we would ideally like to simplify or generalize the machinery related to `RetryLabelExtract`, the type that bridges the labels needed based on our `NewService<T>` target, and the request type later accepted by the instantiated `Service<T>`. Signed-off-by: katelyn martin <[email protected]>
- Loading branch information
Showing
6 changed files
with
292 additions
and
62 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.