Usage of the HttpMessageHandlerBuilder.Name property in production code #110085
-
Hello, The documentation clearly says that the services.ConfigureHttpClientDefaults(clientBuilder =>
{
clientBuilder.Services.ConfigureAll<HttpClientFactoryOptions>(options =>
{
options.HttpMessageHandlerBuilderActions.Add(handlerBuilder =>
{
// Use handlerBuilder.Name, e.g. to emit telemetry that includes name of HttpClient.
});
});
}); Thank you. Tagging @CarnaViire, because we discussed similar topic some time ago. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
All behavioral breaking changes will be always properly documented. So from that perspective, you can use it in production as well. At the moment, I don't see anything that should prevent you from using What's more, at the moment, this property is (unfortunately) the only way to access the name of a specific client within a "global" (="for all clients") configuration -- be it (This was discussed in #101719. I am long due to create a separate issue about enabling a more convenient Name access.... I will file that shortly) However, if you decide to (or even have to) use
BTW, I must ask, in the code snippet you provided, is there a reason |
Beta Was this translation helpful? Give feedback.
All behavioral breaking changes will be always properly documented.
HttpMessageHandlerBuilder.Name
is part of the public API surface, which means there could be users who rely on it. So if any breaking change, including obsoletion, happens in that area, there will be always a doc, and a workaround provided.So from that perspective, you can use it in production as well. At the moment, I don't see anything that should prevent you from using
HttpMessageHandlerBuilder.Name
property.What's more, at the moment, this property is (unfortunately) the only way to access the name of a specific client within a "global" (="for all clients") configuration -- be it
ConfigureHttpClientDefaults
orConfi…