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

Ability to set and extract request metadata for outgoing http requests #84728

Open
dpk83 opened this issue Apr 12, 2023 · 4 comments
Open

Ability to set and extract request metadata for outgoing http requests #84728

dpk83 opened this issue Apr 12, 2023 · 4 comments
Labels
area-System.Net.Http partner-impact This issue impacts a partner who needs to be kept updated
Milestone

Comments

@dpk83
Copy link

dpk83 commented Apr 12, 2023

Ask:
An ability to extract some useful route/request metadata about the request inside HttpMessageHandlers/DelegatingHandlers.

Currently in AspNetCore the routing component provide applications the ability to get route metadata for incoming HTTP requests. This let application and library developers to utilize this information in custom middlewares. A similar capability however lacks in the HttpClient framework as there is no way for a handler in pipeline to determine the route of the request.

Scenario
Currently we write telemetry libraries for consumption by 100s of services in our org. These telemetry libraries automatically captures and emit telemetry about incoming and outgoing http requests. When capturing metrics to monitor service health and gain useful insights the captured metrics need to be able to narrow down the problems by the requests (if certain requests are impacted or all requests are impacted) or by the target service to which the requests are made, so one can see which of the target service is unhealthy.

For the incoming requests the telemetry middlewares can extract the route information from route metadata provided by endpoint routing, however for outgoing requests delegating handlers don't have access to any such information. They only have access to the full URL which can't be used when capturing metrics becuase URLs might have parameters which leads to every URL being different at which point it just becomes not useful.

Currently everywhere services have to write their custom logics or library developers provide hooks for services to provide such information. Because at that point service developers have no way to get this information easily they need to resort to using regular expressions to match the URL with some set of list of routes. This regular expression matching becomes extremely inefficient. So, the ask is for dotnet runtime to include some efficient mechanism to extract the route information and possibility some additional metadata like a friendly name of the target service where the http client is making request to.

What we have
As part of telemetry libraries we have created our own solution to let services configure and register metadata with us when they configure our telemetry libraries. Our libraries then performs the matching of requests against routes (in a more efficient manner without involving regexes) to extract the metadata so it can be included in the telemetry.

We would like to see an efficient solution from dotnet runtime itself which can provide metadata about outgoing requests to these delegating handlers.

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Apr 12, 2023
@ghost
Copy link

ghost commented Apr 12, 2023

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Issue Details

Ask:
An ability to extract some useful route/request metadata about the request inside HttpMessageHandlers/DelegatingHandlers.

Currently in AspNetCore the routing component provide applications the ability to get route metadata for incoming HTTP requests. This let application and library developers to utilize this information in custom middlewares. A similar capability however lacks in the HttpClient framework as there is no way for a handler in pipeline to determine the route of the request.

Scenario
Currently we write telemetry libraries for consumption by 100s of services in our org. These telemetry libraries automatically captures and emit telemetry about incoming and outgoing http requests. When capturing metrics to monitor service health and gain useful insights the captured metrics need to be able to narrow down the problems by the requests (if certain requests are impacted or all requests are impacted) or by the target service to which the requests are made, so one can see which of the target service is unhealthy.

For the incoming requests the telemetry middlewares can extract the route information from route metadata provided by endpoint routing, however for outgoing requests delegating handlers don't have access to any such information. They only have access to the full URL which can't be used when capturing metrics becuase URLs might have parameters which leads to every URL being different at which point it just becomes not useful.

Currently everywhere services have to write their custom logics or library developers provide hooks for services to provide such information. Because at that point service developers have no way to get this information easily they need to resort to using regular expressions to match the URL with some set of list of routes. This regular expression matching becomes extremely inefficient. So, the ask is for dotnet runtime to include some efficient mechanism to extract the route information and possibility some additional metadata like a friendly name of the target service where the http client is making request to.

What we have
As part of telemetry libraries we have created our own solution to let services configure and register metadata with us when they configure our telemetry libraries. Our libraries then performs the matching of requests against routes (in a more efficient manner without involving regexes) to extract the metadata so it can be included in the telemetry.

We would like to see an efficient solution from dotnet runtime itself which can provide metadata about outgoing requests to these delegating handlers.

Author: dpk83
Assignees: -
Labels:

area-System.Net.Http

Milestone: -

@dpk83
Copy link
Author

dpk83 commented Apr 12, 2023

@tarekgh @JamesNK

@tarekgh tarekgh added this to the 8.0.0 milestone Apr 12, 2023
@ghost ghost removed the untriaged New issue has not been triaged by the area owner label Apr 12, 2023
@tarekgh tarekgh added untriaged New issue has not been triaged by the area owner partner-impact This issue impacts a partner who needs to be kept updated labels Apr 12, 2023
@ManickaP ManickaP removed the untriaged New issue has not been triaged by the area owner label Apr 13, 2023
@tarekgh tarekgh modified the milestones: 8.0.0, Future Apr 23, 2023
@tarekgh
Copy link
Member

tarekgh commented Apr 23, 2023

@dpk83 per last discussion with @noahfalk, moving this issue to future milestone to consider it after .NET 8.0.

@MihaZupan MihaZupan removed their assignment Apr 23, 2023
@antonfirsov
Copy link
Member

antonfirsov commented Aug 29, 2023

@dpk83 is this issue talking about enrichment? If so, can we considered it to be done as part of #86281 and related work in higher levels of the stack?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Net.Http partner-impact This issue impacts a partner who needs to be kept updated
Projects
None yet
Development

No branches or pull requests

5 participants