Repository navigation
Replies: 2 comments
|
Hello! Are there any solutions besides writing your own middleware? |
|
This is how the OpenTelemetry HttpClient instrumentation behaves, not a Refit limitation. What you can do: Refit attaches its cfg.AddHttpClientInstrumentation(o =>
{
o.EnrichWithHttpRequestMessage = (activity, request) =>
{
if (request.Options.TryGetValue(
new HttpRequestOptionsKey<RestMethodInfo>(HttpRequestMessageOptions.RestMethodInfo),
out var info))
{
activity.SetTag("http.route", info.RelativePath);
}
};
});(Adjust the property name to whatever For So: no built-in |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I use below code to get metrics with OTel:
.WithMetrics(cfg =>
{
cfg.AddAspNetCoreInstrumentation();
cfg.AddHttpClientInstrumentation();
cfg.AddRuntimeInstrumentation();
});
but in the output i did not get http_route attribute as below:
http_client_request_duration_seconds_bucket{http_request_method="GET",http_response_status_code="200",network_protocol_version="1.1",server_address="****.com",url_scheme="https",le="0.5"} 0 1706514537848
Is there any way to make http_route and http_url here?
All reactions