Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Missing Dependency logging on retry. #30

Open
HenrikSommer-Energinet opened this issue Feb 3, 2022 · 1 comment
Open

Missing Dependency logging on retry. #30

HenrikSommer-Energinet opened this issue Feb 3, 2022 · 1 comment

Comments

@HenrikSommer-Energinet
Copy link

Polly retry is not logging telemetry dependency on retry.

I have create a azure function that is using polly retry:

public override void Configure(IFunctionsHostBuilder builder)
{
    var asyncRetryPolicy = HttpPolicyExtensions
        .HandleTransientHttpError()
        .Or<TimeoutRejectedException>()
        .RetryAsync(1);

    builder.Services.AddHttpClient<LocalClient>(client => client.Timeout = TimeSpan.FromSeconds(15))
        .AddPolicyHandler(asyncRetryPolicy);
}

public class LocalClient
{
    private readonly HttpClient _client;

    public LocalClient(HttpClient client)
    {
        _client = client;
    }

    public async Task<string> GetAsync()
    {
        var httpRequestMessage = new HttpRequestMessage(HttpMethod.Get, "http://localhost:7074/api/monitor/test");

        HttpResponseMessage result = await _client.SendAsync(httpRequestMessage);

        return result.StatusCode.ToString();
    }
}

the enpoint http://localhost:7074/api/monitor/test is setup so it allways return status code 500

When LocalClient.GetAsync is called 2 request is made to http://localhost:7074/api/monitor/test as expected, but when i look in application insights, only the first request is logged as an dependency.

image

@HenrikSommer-Energinet
Copy link
Author

Are there any one looking at this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant