Xabaril / AspNetCore.Diagnostics.HealthChecks

Enterprise HealthChecks for ASP.NET Core Diagnostics Package
Apache License 2.0
4.12k stars 800 forks source link

Unexpected timeout exception #2233

Open MaxiPigna opened 5 months ago

MaxiPigna commented 5 months ago

Given this source code

builder.Services.AddHealthChecks()
    .AddAzureCosmosDB(optionsFactory: static (sp) =>
    {
        CosmosDbOptions cosmosConfig = sp.GetRequiredService<IOptions<CosmosDbOptions>>().Value;
        return new AzureCosmosDbHealthCheckOptions
        {
            DatabaseId = cosmosConfig.DatabaseName,
            ContainerIds = [Constants.ConversationContainerName]
        };
    }, tags: ["Database"], timeout: TimeSpan.FromSeconds(2))

It works most of the time, but sometimes I find exception like this in the log, why?

image

I think it's weird I get a timeout exception, while Cosmos replied 200 OK in the expected time.

Environment:

dankarmyy commented 1 month ago

Did you ever find out what the cause of this was? I'm experiencing similar exceptions

MaxiPigna commented 1 month ago

Nope 😢