Azure Cosmos DB
This health check verifies the ability to communicate with Azure Cosmos DB. It uses the provided CosmosClient.
Installation
Defaults
By default, the CosmosClient
instance is resolved from service provider. AzureCosmosDbHealthCheckOptions
does not provide any specific containers or database ids, the health check just calls CosmosClient.ReadAccountAsync.
Customization
You can additionally add the following parameters:
clientFactory
: A factory method to provideCosmosClient
instance.optionsFactory
: A factory method to provideAzureCosmosDbHealthCheckOptions
instance. It allows to specify the database id and/or container id(s).name
: The health check name. The default isazure_cosmosdb
.failureStatus
: TheHealthStatus
that should be reported when the health check fails. Default isHealthStatus.Unhealthy
.tags
: A list of tags that can be used to filter sets of health checks.timeout
: ASystem.TimeSpan
representing the timeout of the check.
Breaking changes
In the prior releases, CosmosDbHealthCheck
was a part of Pulse.CosmosDb
package. It had a dependency on not just Microsoft.Azure.Cosmos
, but also Azure.Data.Tables
. The packages have been split to avoid bringing unnecessary dependencies. Moreover, CosmosDbHealthCheck
was letting the users specify how CosmosClient
should be created (from raw connection string or from endpoint and managed identity credentials), at a cost of maintaining an internal, static client instances cache. Now the type does not create client instances nor maintain an internal cache and it’s the caller responsibility to provide the instance of CosmosClient
(please see #2040 for more details). Since Azure SDK recommends treating clients as singletons
Was this page helpful?