From 802e6396c148556777024e938ad6a4c3890a9079 Mon Sep 17 00:00:00 2001 From: Odonno Date: Mon, 25 Sep 2023 18:24:20 +0200 Subject: [PATCH 01/12] Add package for SurrealDB --- AspNetCore.Diagnostics.HealthChecks.sln | 14 ++ README.md | 156 +++++++++--------- build/versions.props | 1 + .../SurrealDbHealthCheckBuilderExtensions.cs | 111 +++++++++++++ .../HealthChecks.SurrealDb.csproj | 15 ++ .../SurrealDbHealthCheck.cs | 45 +++++ .../SurrealDbHealthCheckOptions.cs | 25 +++ .../DependencyInjection/RegistrationTests.cs | 89 ++++++++++ .../Functional/SurrealDbHealthCheckTests.cs | 56 +++++++ .../HealthChecks.SurrealDb.Tests.csproj | 11 ++ .../HealthChecks.SurrealDb.approved.txt | 24 +++ 11 files changed, 470 insertions(+), 77 deletions(-) create mode 100644 src/HealthChecks.SurrealDb/DependencyInjection/SurrealDbHealthCheckBuilderExtensions.cs create mode 100644 src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj create mode 100644 src/HealthChecks.SurrealDb/SurrealDbHealthCheck.cs create mode 100644 src/HealthChecks.SurrealDb/SurrealDbHealthCheckOptions.cs create mode 100644 test/HealthChecks.SurrealDb.Tests/DependencyInjection/RegistrationTests.cs create mode 100644 test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs create mode 100644 test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.Tests.csproj create mode 100644 test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.approved.txt diff --git a/AspNetCore.Diagnostics.HealthChecks.sln b/AspNetCore.Diagnostics.HealthChecks.sln index 56d827accc..9df6e73dee 100644 --- a/AspNetCore.Diagnostics.HealthChecks.sln +++ b/AspNetCore.Diagnostics.HealthChecks.sln @@ -310,6 +310,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HealthChecks.Milvus", "src\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HealthChecks.Milvus.Tests", "test\HealthChecks.Milvus.Tests\HealthChecks.Milvus.Tests.csproj", "{D49CF52C-9D21-4D98-8A15-A2B259E9C003}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HealthChecks.SurrealDb", "src\HealthChecks.SurrealDb\HealthChecks.SurrealDb.csproj", "{97DAA09F-E0FA-4D5B-A72B-896161E570DA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HealthChecks.SurrealDb.Tests", "test\HealthChecks.SurrealDb.Tests\HealthChecks.SurrealDb.Tests.csproj", "{44BB97EE-88DB-4C9B-8195-2C6D889AE391}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -868,6 +872,14 @@ Global {D49CF52C-9D21-4D98-8A15-A2B259E9C003}.Debug|Any CPU.Build.0 = Debug|Any CPU {D49CF52C-9D21-4D98-8A15-A2B259E9C003}.Release|Any CPU.ActiveCfg = Release|Any CPU {D49CF52C-9D21-4D98-8A15-A2B259E9C003}.Release|Any CPU.Build.0 = Release|Any CPU + {97DAA09F-E0FA-4D5B-A72B-896161E570DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {97DAA09F-E0FA-4D5B-A72B-896161E570DA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {97DAA09F-E0FA-4D5B-A72B-896161E570DA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {97DAA09F-E0FA-4D5B-A72B-896161E570DA}.Release|Any CPU.Build.0 = Release|Any CPU + {44BB97EE-88DB-4C9B-8195-2C6D889AE391}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {44BB97EE-88DB-4C9B-8195-2C6D889AE391}.Debug|Any CPU.Build.0 = Debug|Any CPU + {44BB97EE-88DB-4C9B-8195-2C6D889AE391}.Release|Any CPU.ActiveCfg = Release|Any CPU + {44BB97EE-88DB-4C9B-8195-2C6D889AE391}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1011,6 +1023,8 @@ Global {3B812989-2C4E-4FCE-B3A0-EF9C00A9B3A5} = {FF4414C2-8863-4ADA-8A1D-4B9F25C361FE} {17913EAF-3B12-495B-80EA-9EB975FBE6BA} = {2A3FD988-2BB8-43CF-B3A2-B70E648259D4} {D49CF52C-9D21-4D98-8A15-A2B259E9C003} = {FF4414C2-8863-4ADA-8A1D-4B9F25C361FE} + {97DAA09F-E0FA-4D5B-A72B-896161E570DA} = {2A3FD988-2BB8-43CF-B3A2-B70E648259D4} + {44BB97EE-88DB-4C9B-8195-2C6D889AE391} = {FF4414C2-8863-4ADA-8A1D-4B9F25C361FE} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {2B8C62A1-11B6-469F-874C-A02443256568} diff --git a/README.md b/README.md index 95d18c6eb3..56c4df56fd 100644 --- a/README.md +++ b/README.md @@ -55,68 +55,69 @@ This repository offers a wide collection of **ASP.NET Core** Health Check packag HealthChecks repo provides following images: -| Image | Downloads | Latest | Issues | -|------|--------|---|---| -| UI | ![ui pulls](https://img.shields.io/docker/pulls/xabarilcoding/healthchecksui.svg?label=downloads) | ![ui version](https://img.shields.io/docker/v/xabarilcoding/healthchecksui?label=docker&logo=dsd&sort=date) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/ui)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/ui) -| K8s operator | ![k8s pulls](https://img.shields.io/docker/pulls/xabarilcoding/healthchecksui-k8s-operator.svg?label=downloads) | ![k8s version](https://img.shields.io/docker/v/xabarilcoding/healthchecksui-k8s-operator?label=docker&logo=dsd&sort=date) +| Image | Downloads | Latest | Issues | +| ------------ | --------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| UI | ![ui pulls](https://img.shields.io/docker/pulls/xabarilcoding/healthchecksui.svg?label=downloads) | ![ui version](https://img.shields.io/docker/v/xabarilcoding/healthchecksui?label=docker&logo=dsd&sort=date) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/ui)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/ui) | +| K8s operator | ![k8s pulls](https://img.shields.io/docker/pulls/xabarilcoding/healthchecksui-k8s-operator.svg?label=downloads) | ![k8s version](https://img.shields.io/docker/v/xabarilcoding/healthchecksui-k8s-operator?label=docker&logo=dsd&sort=date) | ## Health Checks HealthChecks packages include health checks for: -| Package | Downloads | NuGet Latest | Issues | Notes | -| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------ | ---------------------------------------------------------------------- | -| ApplicationStatus | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.ApplicationStatus)](https://www.nuget.org/packages/AspNetCore.HealthChecks.ApplicationStatus) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.ApplicationStatus)](https://www.nuget.org/packages/AspNetCore.HealthChecks.ApplicationStatus) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/applicationstatus)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/applicationstatus) -| ArangoDB | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.ArangoDb)](https://www.nuget.org/packages/AspNetCore.HealthChecks.ArangoDb) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.ArangoDb)](https://www.nuget.org/packages/AspNetCore.HealthChecks.ArangoDb) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/arrangodb)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/arrangodb) -| Amazon S3 | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Aws.S3)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Aws.S3) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Aws.S3)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Aws.S3) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/aws)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/aws) -| Amazon Secrets Manager | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Aws.SecretsManager)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Aws.SecretsManager) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Aws.SecretsManager)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Aws.SecretsManager) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/aws)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/aws) -| Amazon SNS | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Aws.Sns)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Aws.Sns) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Aws.Sns)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Aws.Sns) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/aws)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/aws) -| Amazon SQS | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Aws.Sqs)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Aws.Sqs) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Aws.Sqs)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Aws.Sqs) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/aws)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/aws) -| Amazon Systems Manager | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Aws.SystemsManager)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Aws.SystemsManager) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Aws.SystemsManager)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Aws.SystemsManager) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/aws)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/aws) -| Azure Application Insights | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.AzureApplicationInsights)](https://www.nuget.org/packages/AspNetCore.HealthChecks.AzureApplicationInsights) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.AzureApplicationInsights)](https://www.nuget.org/packages/AspNetCore.HealthChecks.AzureApplicationInsights) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/applicationinsights)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/applicationinsights) -| Azure Tables | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Azure.Data.Tables)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.Data.Tables) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Azure.Data.Tables)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.Data.Tables) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/azure)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/azure) -| Azure IoT Hub | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Azure.IoTHub)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.IoTHub) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Azure.IoTHub)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.IoTHub) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/azure)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/azure) | -| Azure Key Vault Secrets | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Azure.KeyVault.Secrets)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.KeyVault.Secrets) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Azure.KeyVault.Secrets)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.KeyVault.Secrets) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/azure)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/azure) | -| Azure Event Hubs | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Azure.Messaging.EventHubs)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.Messaging.EventHubs) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Azure.Messaging.EventHubs)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.Messaging.EventHubs) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/azure)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/azure) | -| Azure Blob Storage | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Azure.Storage.Blobs)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.Storage.Blobs) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Azure.Storage.Blobs)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.Storage.Blobs) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/azure)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/azure) | -| Azure File Storage | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Azure.Storage.Files.Shares)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.Storage.Files.Shares) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Azure.Storage.Files.Shares)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.Storage.Files.Shares) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/azure)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/azure) | -| Azure Queue Storage | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Azure.Storage.Queues)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.Storage.Queues) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Azure.Storage.Queues)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.Storage.Queues) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/azure)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/azure) | -| Azure DigitalTwin | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.AzureDigitalTwin)](https://www.nuget.org/packages/AspNetCore.HealthChecks.AzureDigitalTwin) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.AzureDigitalTwin)](https://www.nuget.org/packages/AspNetCore.HealthChecks.AzureDigitalTwin) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/azure)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/azure) | Subscription status, models and instances | -| Azure Key Vault | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.AzureKeyVault)](https://www.nuget.org/packages/AspNetCore.HealthChecks.AzureKeyVault) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.AzureKeyVault)](https://www.nuget.org/packages/AspNetCore.HealthChecks.AzureKeyVault) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/azure)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/azure) -| Azure Search | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.AzureSearch)](https://www.nuget.org/packages/AspNetCore.HealthChecks.AzureSearch) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.AzureSearch)](https://www.nuget.org/packages/AspNetCore.HealthChecks.AzureSearch) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/azure)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/azure) -| Azure Service Bus | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.AzureServiceBus)](https://www.nuget.org/packages/AspNetCore.HealthChecks.AzureServiceBus) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.AzureServiceBus)](https://www.nuget.org/packages/AspNetCore.HealthChecks.AzureServiceBus) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/azure)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/azure) | Queue and Topics | -| Consul | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Consul)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Consul) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Consul)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Consul) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/consul)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/consul) -| CosmosDb | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.CosmosDb)](https://www.nuget.org/packages/AspNetCore.HealthChecks.CosmosDb) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.CosmosDb)](https://www.nuget.org/packages/AspNetCore.HealthChecks.CosmosDb) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/cosmosdb)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/cosmosdb) | CosmosDb and Azure Table -| Dapr | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Dapr)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Dapr) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Dapr)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Dapr) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/dapr)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/dapr) -| Azure DocumentDb | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.DocumentDb)](https://www.nuget.org/packages/AspNetCore.HealthChecks.DocumentDb) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.DocumentDb)](https://www.nuget.org/packages/AspNetCore.HealthChecks.DocumentDb) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/documentdb)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/documentdb) -| Amazon DynamoDb | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.DynamoDb)](https://www.nuget.org/packages/AspNetCore.HealthChecks.DynamoDb) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.DynamoDb)](https://www.nuget.org/packages/AspNetCore.HealthChecks.DynamoDb) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/dynamodb)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/dynamodb) -| Elasticsearch | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Elasticsearch)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Elasticsearch) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Elasticsearch)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Elasticsearch) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/elasticsearch)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/elasticsearch) -| EventStore | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.EventStore)](https://www.nuget.org/packages/AspNetCore.HealthChecks.EventStore) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.EventStore)](https://www.nuget.org/packages/AspNetCore.HealthChecks.EventStore) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/eventstore)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/eventstore) | [TCP EventStore](https://github.com/EventStore/EventStoreDB-Client-Dotnet-Legacy) -| EventStore gRPC | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.EventStore.gRPC)](https://www.nuget.org/packages/AspNetCore.HealthChecks.EventStore.gRPC) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.EventStore.gRPC)](https://www.nuget.org/packages/AspNetCore.HealthChecks.EventStore.gRPC) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/eventstore)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/eventstore) | [gRPC EventStore](https://github.com/EventStore/EventStore-Client-Dotnet) -| Google Cloud Firestore | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Gcp.CloudFirestore)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Gcp.CloudFirestore) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Gcp.CloudFirestore)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Gcp.CloudFirestore) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/cloudfirestore)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/cloudfirestore) -| Gremlin | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Gremlin)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Gremlin) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Gremlin)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Gremlin) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/gremlin)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/gremlin) -| Hangfire | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Hangfire)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Hangfire) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Hangfire)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Hangfire) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/hangfire)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/hangfire) -| IbmMQ | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.IbmMQ)](https://www.nuget.org/packages/AspNetCore.HealthChecks.IbmMQ) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.IbmMQ)](https://www.nuget.org/packages/AspNetCore.HealthChecks.IbmMQ) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/ibmmq)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/ibmmq) -| InfluxDB | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.InfluxDB)](https://www.nuget.org/packages/AspNetCore.HealthChecks.InfluxDB) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.InfluxDB)](https://www.nuget.org/packages/AspNetCore.HealthChecks.InfluxDB) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/influxdb)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/influxdb) -| Kafka | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Kafka)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Kafka) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Kafka)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Kafka) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/kafka)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/kafka) -| Kubernetes | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Kubernetes)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Kubernetes) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Kubernetes)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Kubernetes) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/kubernetes)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/kubernetes) -| MongoDB | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.MongoDb)](https://www.nuget.org/packages/AspNetCore.HealthChecks.MongoDb) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.MongoDb)](https://www.nuget.org/packages/AspNetCore.HealthChecks.MongoDb) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/mongodb)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/mongodb) -| MySql | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.MySql)](https://www.nuget.org/packages/AspNetCore.HealthChecks.MySql) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.MySql)](https://www.nuget.org/packages/AspNetCore.HealthChecks.MySql) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/mysql)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/mysql) -| Nats | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Nats)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Nats) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Nats)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Nats) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/nats)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/nats) | NATS, messaging, message-bus, pubsub | -| Network | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Network)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Network) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Network)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Network) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/network)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/network) | Ftp, SFtp, Dns, Tcp port, Smtp, Imap, Ssl | -| Postgres | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.NpgSql)](https://www.nuget.org/packages/AspNetCore.HealthChecks.NpgSql) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.NpgSql)](https://www.nuget.org/packages/AspNetCore.HealthChecks.NpgSql) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/npgsql)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/npgsql) -| Identity Server | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.OpenIdConnectServer)](https://www.nuget.org/packages/AspNetCore.HealthChecks.OpenIdConnectServer) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.OpenIdConnectServer)](https://www.nuget.org/packages/AspNetCore.HealthChecks.OpenIdConnectServer) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/openidconnect)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/openidconnect) -| Oracle | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Oracle)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Oracle) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Oracle)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Oracle) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/oracle)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/oracle) -| RabbitMQ | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.RabbitMQ)](https://www.nuget.org/packages/AspNetCore.HealthChecks.RabbitMQ) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.RabbitMQ)](https://www.nuget.org/packages/AspNetCore.HealthChecks.RabbitMQ) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/rabbitmq)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/rabbitmq) -| RavenDB | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.RavenDB)](https://www.nuget.org/packages/AspNetCore.HealthChecks.RavenDB) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.RavenDB)](https://www.nuget.org/packages/AspNetCore.HealthChecks.RavenDB) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/ravendb)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/ravendb) -| Redis | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Redis)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Redis) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Redis)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Redis) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/redis)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/redis) -| SendGrid | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.SendGrid)](https://www.nuget.org/packages/AspNetCore.HealthChecks.SendGrid) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.SendGrid)](https://www.nuget.org/packages/AspNetCore.HealthChecks.SendGrid) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/sendgrid)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/sendgrid) -| SignalR | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.SignalR)](https://www.nuget.org/packages/AspNetCore.HealthChecks.SignalR) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.SignalR)](https://www.nuget.org/packages/AspNetCore.HealthChecks.SignalR) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/signalr)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/signalr) -| Solr | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Solr)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Solr) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Solr)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Solr) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/solr)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/solr) -| Sqlite | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Sqlite)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Sqlite) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Sqlite)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Sqlite) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/sqlite)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/sqlite) -| Sql Server | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.SqlServer)](https://www.nuget.org/packages/AspNetCore.HealthChecks.SqlServer) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.SqlServer)](https://www.nuget.org/packages/AspNetCore.HealthChecks.SqlServer) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/sqlserver)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/sqlserver) -| System | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.System)](https://www.nuget.org/packages/AspNetCore.HealthChecks.System) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.System)](https://www.nuget.org/packages/AspNetCore.HealthChecks.System) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/system)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/system) | Disk Storage, Folder, File, Private Memory, Virtual Memory, Process, Windows Service | -| Uris | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Uris)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Uris) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Uris)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Uris) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/uris)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/uris) | Single uri and uri groups | +| Package | Downloads | NuGet Latest | Issues | Notes | +| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | +| ApplicationStatus | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.ApplicationStatus)](https://www.nuget.org/packages/AspNetCore.HealthChecks.ApplicationStatus) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.ApplicationStatus)](https://www.nuget.org/packages/AspNetCore.HealthChecks.ApplicationStatus) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/applicationstatus)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/applicationstatus) | +| ArangoDB | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.ArangoDb)](https://www.nuget.org/packages/AspNetCore.HealthChecks.ArangoDb) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.ArangoDb)](https://www.nuget.org/packages/AspNetCore.HealthChecks.ArangoDb) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/arrangodb)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/arrangodb) | +| Amazon S3 | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Aws.S3)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Aws.S3) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Aws.S3)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Aws.S3) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/aws)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/aws) | +| Amazon Secrets Manager | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Aws.SecretsManager)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Aws.SecretsManager) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Aws.SecretsManager)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Aws.SecretsManager) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/aws)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/aws) | +| Amazon SNS | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Aws.Sns)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Aws.Sns) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Aws.Sns)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Aws.Sns) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/aws)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/aws) | +| Amazon SQS | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Aws.Sqs)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Aws.Sqs) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Aws.Sqs)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Aws.Sqs) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/aws)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/aws) | +| Amazon Systems Manager | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Aws.SystemsManager)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Aws.SystemsManager) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Aws.SystemsManager)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Aws.SystemsManager) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/aws)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/aws) | +| Azure Application Insights | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.AzureApplicationInsights)](https://www.nuget.org/packages/AspNetCore.HealthChecks.AzureApplicationInsights) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.AzureApplicationInsights)](https://www.nuget.org/packages/AspNetCore.HealthChecks.AzureApplicationInsights) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/applicationinsights)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/applicationinsights) | +| Azure Tables | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Azure.Data.Tables)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.Data.Tables) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Azure.Data.Tables)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.Data.Tables) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/azure)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/azure) | +| Azure IoT Hub | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Azure.IoTHub)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.IoTHub) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Azure.IoTHub)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.IoTHub) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/azure)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/azure) | +| Azure Key Vault Secrets | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Azure.KeyVault.Secrets)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.KeyVault.Secrets) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Azure.KeyVault.Secrets)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.KeyVault.Secrets) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/azure)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/azure) | +| Azure Event Hubs | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Azure.Messaging.EventHubs)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.Messaging.EventHubs) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Azure.Messaging.EventHubs)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.Messaging.EventHubs) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/azure)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/azure) | +| Azure Blob Storage | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Azure.Storage.Blobs)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.Storage.Blobs) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Azure.Storage.Blobs)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.Storage.Blobs) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/azure)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/azure) | +| Azure File Storage | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Azure.Storage.Files.Shares)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.Storage.Files.Shares) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Azure.Storage.Files.Shares)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.Storage.Files.Shares) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/azure)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/azure) | +| Azure Queue Storage | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Azure.Storage.Queues)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.Storage.Queues) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Azure.Storage.Queues)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Azure.Storage.Queues) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/azure)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/azure) | +| Azure DigitalTwin | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.AzureDigitalTwin)](https://www.nuget.org/packages/AspNetCore.HealthChecks.AzureDigitalTwin) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.AzureDigitalTwin)](https://www.nuget.org/packages/AspNetCore.HealthChecks.AzureDigitalTwin) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/azure)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/azure) | Subscription status, models and instances | +| Azure Key Vault | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.AzureKeyVault)](https://www.nuget.org/packages/AspNetCore.HealthChecks.AzureKeyVault) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.AzureKeyVault)](https://www.nuget.org/packages/AspNetCore.HealthChecks.AzureKeyVault) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/azure)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/azure) | +| Azure Search | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.AzureSearch)](https://www.nuget.org/packages/AspNetCore.HealthChecks.AzureSearch) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.AzureSearch)](https://www.nuget.org/packages/AspNetCore.HealthChecks.AzureSearch) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/azure)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/azure) | +| Azure Service Bus | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.AzureServiceBus)](https://www.nuget.org/packages/AspNetCore.HealthChecks.AzureServiceBus) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.AzureServiceBus)](https://www.nuget.org/packages/AspNetCore.HealthChecks.AzureServiceBus) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/azure)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/azure) | Queue and Topics | +| Consul | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Consul)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Consul) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Consul)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Consul) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/consul)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/consul) | +| CosmosDb | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.CosmosDb)](https://www.nuget.org/packages/AspNetCore.HealthChecks.CosmosDb) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.CosmosDb)](https://www.nuget.org/packages/AspNetCore.HealthChecks.CosmosDb) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/cosmosdb)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/cosmosdb) | CosmosDb and Azure Table | +| Dapr | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Dapr)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Dapr) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Dapr)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Dapr) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/dapr)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/dapr) | +| Azure DocumentDb | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.DocumentDb)](https://www.nuget.org/packages/AspNetCore.HealthChecks.DocumentDb) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.DocumentDb)](https://www.nuget.org/packages/AspNetCore.HealthChecks.DocumentDb) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/documentdb)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/documentdb) | +| Amazon DynamoDb | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.DynamoDb)](https://www.nuget.org/packages/AspNetCore.HealthChecks.DynamoDb) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.DynamoDb)](https://www.nuget.org/packages/AspNetCore.HealthChecks.DynamoDb) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/dynamodb)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/dynamodb) | +| Elasticsearch | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Elasticsearch)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Elasticsearch) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Elasticsearch)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Elasticsearch) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/elasticsearch)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/elasticsearch) | +| EventStore | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.EventStore)](https://www.nuget.org/packages/AspNetCore.HealthChecks.EventStore) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.EventStore)](https://www.nuget.org/packages/AspNetCore.HealthChecks.EventStore) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/eventstore)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/eventstore) | [TCP EventStore](https://github.com/EventStore/EventStoreDB-Client-Dotnet-Legacy) | +| EventStore gRPC | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.EventStore.gRPC)](https://www.nuget.org/packages/AspNetCore.HealthChecks.EventStore.gRPC) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.EventStore.gRPC)](https://www.nuget.org/packages/AspNetCore.HealthChecks.EventStore.gRPC) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/eventstore)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/eventstore) | [gRPC EventStore](https://github.com/EventStore/EventStore-Client-Dotnet) | +| Google Cloud Firestore | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Gcp.CloudFirestore)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Gcp.CloudFirestore) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Gcp.CloudFirestore)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Gcp.CloudFirestore) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/cloudfirestore)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/cloudfirestore) | +| Gremlin | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Gremlin)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Gremlin) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Gremlin)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Gremlin) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/gremlin)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/gremlin) | +| Hangfire | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Hangfire)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Hangfire) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Hangfire)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Hangfire) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/hangfire)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/hangfire) | +| IbmMQ | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.IbmMQ)](https://www.nuget.org/packages/AspNetCore.HealthChecks.IbmMQ) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.IbmMQ)](https://www.nuget.org/packages/AspNetCore.HealthChecks.IbmMQ) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/ibmmq)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/ibmmq) | +| InfluxDB | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.InfluxDB)](https://www.nuget.org/packages/AspNetCore.HealthChecks.InfluxDB) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.InfluxDB)](https://www.nuget.org/packages/AspNetCore.HealthChecks.InfluxDB) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/influxdb)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/influxdb) | +| Kafka | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Kafka)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Kafka) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Kafka)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Kafka) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/kafka)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/kafka) | +| Kubernetes | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Kubernetes)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Kubernetes) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Kubernetes)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Kubernetes) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/kubernetes)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/kubernetes) | +| MongoDB | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.MongoDb)](https://www.nuget.org/packages/AspNetCore.HealthChecks.MongoDb) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.MongoDb)](https://www.nuget.org/packages/AspNetCore.HealthChecks.MongoDb) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/mongodb)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/mongodb) | +| MySql | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.MySql)](https://www.nuget.org/packages/AspNetCore.HealthChecks.MySql) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.MySql)](https://www.nuget.org/packages/AspNetCore.HealthChecks.MySql) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/mysql)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/mysql) | +| Nats | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Nats)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Nats) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Nats)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Nats) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/nats)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/nats) | NATS, messaging, message-bus, pubsub | +| Network | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Network)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Network) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Network)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Network) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/network)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/network) | Ftp, SFtp, Dns, Tcp port, Smtp, Imap, Ssl | +| Postgres | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.NpgSql)](https://www.nuget.org/packages/AspNetCore.HealthChecks.NpgSql) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.NpgSql)](https://www.nuget.org/packages/AspNetCore.HealthChecks.NpgSql) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/npgsql)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/npgsql) | +| Identity Server | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.OpenIdConnectServer)](https://www.nuget.org/packages/AspNetCore.HealthChecks.OpenIdConnectServer) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.OpenIdConnectServer)](https://www.nuget.org/packages/AspNetCore.HealthChecks.OpenIdConnectServer) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/openidconnect)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/openidconnect) | +| Oracle | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Oracle)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Oracle) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Oracle)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Oracle) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/oracle)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/oracle) | +| RabbitMQ | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.RabbitMQ)](https://www.nuget.org/packages/AspNetCore.HealthChecks.RabbitMQ) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.RabbitMQ)](https://www.nuget.org/packages/AspNetCore.HealthChecks.RabbitMQ) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/rabbitmq)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/rabbitmq) | +| RavenDB | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.RavenDB)](https://www.nuget.org/packages/AspNetCore.HealthChecks.RavenDB) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.RavenDB)](https://www.nuget.org/packages/AspNetCore.HealthChecks.RavenDB) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/ravendb)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/ravendb) | +| Redis | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Redis)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Redis) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Redis)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Redis) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/redis)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/redis) | +| SendGrid | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.SendGrid)](https://www.nuget.org/packages/AspNetCore.HealthChecks.SendGrid) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.SendGrid)](https://www.nuget.org/packages/AspNetCore.HealthChecks.SendGrid) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/sendgrid)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/sendgrid) | +| SignalR | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.SignalR)](https://www.nuget.org/packages/AspNetCore.HealthChecks.SignalR) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.SignalR)](https://www.nuget.org/packages/AspNetCore.HealthChecks.SignalR) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/signalr)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/signalr) | +| Solr | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Solr)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Solr) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Solr)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Solr) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/solr)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/solr) | +| Sqlite | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Sqlite)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Sqlite) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Sqlite)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Sqlite) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/sqlite)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/sqlite) | +| Sql Server | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.SqlServer)](https://www.nuget.org/packages/AspNetCore.HealthChecks.SqlServer) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.SqlServer)](https://www.nuget.org/packages/AspNetCore.HealthChecks.SqlServer) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/sqlserver)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/sqlserver) | +| SurrealDb | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.SurrealDb)](https://www.nuget.org/packages/AspNetCore.HealthChecks.SurrealDb) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.SurrealDb)](https://www.nuget.org/packages/AspNetCore.HealthChecks.SurrealDb) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/surrealdb)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/surrealdb) | +| System | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.System)](https://www.nuget.org/packages/AspNetCore.HealthChecks.System) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.System)](https://www.nuget.org/packages/AspNetCore.HealthChecks.System) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/system)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/system) | Disk Storage, Folder, File, Private Memory, Virtual Memory, Process, Windows Service | +| Uris | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Uris)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Uris) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Uris)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Uris) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/uris)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/uris) | Single uri and uri groups | > We support netcoreapp 2.2, 3.0 and 3.1. Please use package versions 2.2.X, 3.0.X and 3.1.X to target different versions. @@ -171,6 +172,7 @@ Install-Package AspNetCore.HealthChecks.SignalR Install-Package AspNetCore.HealthChecks.Solr Install-Package AspNetCore.HealthChecks.SqLite Install-Package AspNetCore.HealthChecks.SqlServer +Install-Package AspNetCore.HealthChecks.SurrealDb Install-Package AspNetCore.HealthChecks.System Install-Package AspNetCore.HealthChecks.Uris ``` @@ -212,13 +214,13 @@ The project **AspNetCore.HealthChecks.Publisher.ApplicationInsights**, **AspNetC **AspNetCore.HealthChecks.Publisher.CloudWatch** define a consumers to send report results to Application Insights, Datadog, Prometheus, Seq or CloudWatch. -| Package | Downloads | NuGet Latest | Issues | Notes | -| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------ | ----- | -| Application Insights | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Publisher.ApplicationInsights)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Publisher.ApplicationInsights) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Publisher.ApplicationInsights)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Publisher.ApplicationInsights) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/applicationinsights)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/applicationinsights) -| CloudWatch | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Publisher.CloudWatch)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Publisher.CloudWatch) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Publisher.CloudWatch)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Publisher.CloudWatch) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/cloudwatch)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/cloudwatch) -| Datadog | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Publisher.Datadog)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Publisher.Datadog) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Publisher.Datadog)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Publisher.Datadog) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/datadog)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/datadog) -| Prometheus Gateway | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Publisher.Prometheus)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Publisher.Prometheus) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Publisher.Prometheus)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Publisher.Prometheus) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/prometheus)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/prometheus) | **DEPRECATED** | -| Seq | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Publisher.Seq)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Publisher.Seq) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Publisher.Seq)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Publisher.Seq) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/seq)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/seq) +| Package | Downloads | NuGet Latest | Issues | Notes | +| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- | +| Application Insights | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Publisher.ApplicationInsights)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Publisher.ApplicationInsights) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Publisher.ApplicationInsights)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Publisher.ApplicationInsights) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/applicationinsights)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/applicationinsights) | +| CloudWatch | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Publisher.CloudWatch)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Publisher.CloudWatch) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Publisher.CloudWatch)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Publisher.CloudWatch) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/cloudwatch)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/cloudwatch) | +| Datadog | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Publisher.Datadog)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Publisher.Datadog) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Publisher.Datadog)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Publisher.Datadog) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/datadog)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/datadog) | +| Prometheus Gateway | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Publisher.Prometheus)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Publisher.Prometheus) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Publisher.Prometheus)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Publisher.Prometheus) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/prometheus)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/prometheus) | **DEPRECATED** | +| Seq | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.Publisher.Seq)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Publisher.Seq) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.Publisher.Seq)](https://www.nuget.org/packages/AspNetCore.HealthChecks.Publisher.Seq) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/seq)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/seq) | Include the package in your project: @@ -274,12 +276,12 @@ The project HealthChecks.UI is a minimal UI interface that stores and shows the For UI, we provide the following packages: -| Package | Downloads | NuGet Latest | Issues | Notes | -| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------ | ------| -| UI | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.UI)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.UI)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/ui)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/ui) | ASP.NET Core UI viewer of ASP.NET Core HealthChecks | +| Package | Downloads | NuGet Latest | Issues | Notes | +| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------- | +| UI | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.UI)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.UI)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/ui)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/ui) | ASP.NET Core UI viewer of ASP.NET Core HealthChecks | | UI.Client | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.UI.Client)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.Client) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.UI.Client)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.Client) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/ui)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/ui) | Mandatory abstractions to work with HealthChecks.UI | -| UI.Core | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.UI.Core)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.Core) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.UI.Core)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.Core) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/ui)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/ui) | | -| UI.Data | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.UI.Data)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.Data) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.UI.Data)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.Data) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/ui)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/ui) | Data models and database context definition | +| UI.Core | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.UI.Core)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.Core) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.UI.Core)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.Core) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/ui)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/ui) | | +| UI.Data | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.UI.Data)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.Data) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.UI.Data)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.Data) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/ui)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/ui) | Data models and database context definition | To integrate HealthChecks.UI in your project you just need to add the HealthChecks.UI services and middlewares available in the package: **AspNetCore.HealthChecks.UI** @@ -351,13 +353,13 @@ HealthChecks UI offers several storage providers, available as different nuget p The current supported databases are: -| Package | Downloads | NuGet Latest | Issues | Notes | -| ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------ | ----- | -| InMemory | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.UI.InMemory.Storage)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.InMemory.Storage) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.UI.InMemory.Storage)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.InMemory.Storage) | -| SqlServer | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.UI.SqlServer.Storage)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.SqlServer.Storage) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.UI.SqlServer.Storage)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.SqlServer.Storage) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/sqlserver)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/sqlserver) -| SQLite | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.UI.SQLite.Storage)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.SQLite.Storage) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.UI.SQLite.Storage)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.SQLite.Storage) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/sqlite)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/sqlite) -| PostgreSQL | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.UI.PostgreSQL.Storage)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.PostgreSQL.Storage) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.UI.PostgreSQL.Storage)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.PostgreSQL.Storage) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/npgsql)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/npgsql) -| MySql | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.UI.MySql.Storage)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.MySql.Storage) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.UI.MySql.Storage)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.MySql.Storage) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/mysql)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/mysql) +| Package | Downloads | NuGet Latest | Issues | Notes | +| ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- | +| InMemory | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.UI.InMemory.Storage)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.InMemory.Storage) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.UI.InMemory.Storage)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.InMemory.Storage) | +| SqlServer | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.UI.SqlServer.Storage)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.SqlServer.Storage) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.UI.SqlServer.Storage)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.SqlServer.Storage) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/sqlserver)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/sqlserver) | +| SQLite | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.UI.SQLite.Storage)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.SQLite.Storage) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.UI.SQLite.Storage)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.SQLite.Storage) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/sqlite)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/sqlite) | +| PostgreSQL | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.UI.PostgreSQL.Storage)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.PostgreSQL.Storage) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.UI.PostgreSQL.Storage)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.PostgreSQL.Storage) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/npgsql)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/npgsql) | +| MySql | [![Nuget](https://img.shields.io/nuget/dt/AspNetCore.HealthChecks.UI.MySql.Storage)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.MySql.Storage) | [![Nuget](https://img.shields.io/nuget/v/AspNetCore.HealthChecks.UI.MySql.Storage)](https://www.nuget.org/packages/AspNetCore.HealthChecks.UI.MySql.Storage) | [![view](https://img.shields.io/github/issues/Xabaril/AspNetCore.Diagnostics.HealthChecks/mysql)](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/mysql) | All the storage providers are extensions of `HealthChecksUIBuilder`: @@ -699,4 +701,4 @@ answering [questions](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthCh 2. Follow the code guidelines and conventions. 3. New features are not only code, tests and documentation are also mandatory. 4. PRs with [`Ups for grabs`](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/Ups%20for%20grabs) -and [help wanted](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/help%20wanted) tags are good candidates to contribute. + and [help wanted](https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/labels/help%20wanted) tags are good candidates to contribute. diff --git a/build/versions.props b/build/versions.props index e6d83284d6..e55e6abd9d 100644 --- a/build/versions.props +++ b/build/versions.props @@ -57,6 +57,7 @@ 8.0.1 8.1.0 8.0.2 + 8.0.1 8.0.1 8.0.1 8.0.1 diff --git a/src/HealthChecks.SurrealDb/DependencyInjection/SurrealDbHealthCheckBuilderExtensions.cs b/src/HealthChecks.SurrealDb/DependencyInjection/SurrealDbHealthCheckBuilderExtensions.cs new file mode 100644 index 0000000000..d9d1fabf66 --- /dev/null +++ b/src/HealthChecks.SurrealDb/DependencyInjection/SurrealDbHealthCheckBuilderExtensions.cs @@ -0,0 +1,111 @@ +using HealthChecks.SurrealDb; +using Microsoft.Extensions.Diagnostics.HealthChecks; +using SurrealDb.Net; + +namespace Microsoft.Extensions.DependencyInjection; + +/// +/// Extension methods to configure . +/// +public static class SurrealDbHealthCheckBuilderExtensions +{ + private const string NAME = "surrealdb"; + + /// + /// Add a health check for SurrealDB. + /// + /// The . + /// The SurrealDB connection string to be used. + /// An optional action to allow additional SQL Server specific configuration. + /// The health check name. Optional. If null the type name 'surrealdb' will be used for the name. + /// + /// The that should be reported when the health check fails. Optional. If null then + /// the default status of will be reported. + /// + /// A list of tags that can be used to filter sets of health checks. Optional. + /// An optional representing the timeout of the check. + /// The specified . + public static IHealthChecksBuilder AddSurreal( + this IHealthChecksBuilder builder, + string connectionString, + Action? configure = null, + string? name = default, + HealthStatus? failureStatus = default, + IEnumerable? tags = default, + TimeSpan? timeout = default) + { + return builder.AddSurreal(_ => connectionString, configure, name, failureStatus, tags, timeout); + } + + /// + /// Add a health check for SurrealDB. + /// + /// The . + /// A factory to build the SurrealDB connection string to use. + /// An optional action to allow additional SQL Server specific configuration. + /// The health check name. Optional. If null the type name 'surrealdb' will be used for the name. + /// + /// The that should be reported when the health check fails. Optional. If null then + /// the default status of will be reported. + /// + /// A list of tags that can be used to filter sets of health checks. Optional. + /// An optional representing the timeout of the check. + /// The specified . + public static IHealthChecksBuilder AddSurreal( + this IHealthChecksBuilder builder, + Func connectionStringFactory, + Action? configure = null, + string? name = default, + HealthStatus? failureStatus = default, + IEnumerable? tags = default, + TimeSpan? timeout = default) + { + Guard.ThrowIfNull(connectionStringFactory); + + return builder.Add(new HealthCheckRegistration( + name ?? NAME, + sp => + { + var options = new SurrealDbHealthCheckOptions + { + ConnectionString = connectionStringFactory(sp), + Configure = configure, + }; + return new SurrealDbHealthCheck(options); + }, + failureStatus, + tags, + timeout)); + } + + /// + /// Add a health check for SurrealDB. + /// + /// The . + /// Options for health check. + /// The health check name. Optional. If null the type name 'surrealdb' will be used for the name. + /// + /// The that should be reported when the health check fails. Optional. If null then + /// the default status of will be reported. + /// + /// A list of tags that can be used to filter sets of health checks. Optional. + /// An optional representing the timeout of the check. + /// The specified . + public static IHealthChecksBuilder AddSurreal( + this IHealthChecksBuilder builder, + SurrealDbHealthCheckOptions options, + string? name = default, + HealthStatus? failureStatus = default, + IEnumerable? tags = default, + TimeSpan? timeout = default) + { + Guard.ThrowIfNull(options); + + return builder.Add(new HealthCheckRegistration( + name ?? NAME, + _ => new SurrealDbHealthCheck(options), + failureStatus, + tags, + timeout)); + } +} diff --git a/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj b/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj new file mode 100644 index 0000000000..58c98c05dd --- /dev/null +++ b/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj @@ -0,0 +1,15 @@ + + + + netstandard2.1 + $(PackageTags);SurrealDb + HealthChecks.SurrealDb is the health check package for SurrealDB. + $(HealthCheckSurrealDb) + + + + + + + + diff --git a/src/HealthChecks.SurrealDb/SurrealDbHealthCheck.cs b/src/HealthChecks.SurrealDb/SurrealDbHealthCheck.cs new file mode 100644 index 0000000000..aeca83c437 --- /dev/null +++ b/src/HealthChecks.SurrealDb/SurrealDbHealthCheck.cs @@ -0,0 +1,45 @@ +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Diagnostics.HealthChecks; +using SurrealDb.Net; + +namespace HealthChecks.SurrealDb; + +/// +/// A health check for SurrealDb services. +/// +public class SurrealDbHealthCheck : IHealthCheck +{ + private readonly SurrealDbHealthCheckOptions _options; + + public SurrealDbHealthCheck(SurrealDbHealthCheckOptions options) + { + Guard.ThrowIfNull(options.ConnectionString, true); + _options = options; + } + + /// + public async Task CheckHealthAsync(HealthCheckContext context, CancellationToken cancellationToken = default) + { + try + { + var clientOptions = new SurrealDbOptionsBuilder() + .FromConnectionString(_options.ConnectionString) + .Build(); + + using var client = new SurrealDbClient(clientOptions); + + _options.Configure?.Invoke(client); + await client.Connect(cancellationToken).ConfigureAwait(false); + + bool result = await client.Health(cancellationToken).ConfigureAwait(false); + + return _options.HealthCheckResultBuilder == null + ? HealthCheckResult.Healthy() + : _options.HealthCheckResultBuilder(result); + } + catch (Exception ex) + { + return new HealthCheckResult(context.Registration.FailureStatus, exception: ex); + } + } +} diff --git a/src/HealthChecks.SurrealDb/SurrealDbHealthCheckOptions.cs b/src/HealthChecks.SurrealDb/SurrealDbHealthCheckOptions.cs new file mode 100644 index 0000000000..709af9c982 --- /dev/null +++ b/src/HealthChecks.SurrealDb/SurrealDbHealthCheckOptions.cs @@ -0,0 +1,25 @@ +using Microsoft.Extensions.Diagnostics.HealthChecks; +using SurrealDb.Net; + +namespace HealthChecks.SurrealDb; + +/// +/// Options for . +/// +public class SurrealDbHealthCheckOptions +{ + /// + /// The Sql Server connection string to be used. + /// + public string ConnectionString { get; set; } = null!; + + /// + /// An optional action executed before the connection is opened in the health check. + /// + public Action? Configure { get; set; } + + /// + /// An optional delegate to build health check result. + /// + public Func? HealthCheckResultBuilder { get; set; } +} diff --git a/test/HealthChecks.SurrealDb.Tests/DependencyInjection/RegistrationTests.cs b/test/HealthChecks.SurrealDb.Tests/DependencyInjection/RegistrationTests.cs new file mode 100644 index 0000000000..b5f812c705 --- /dev/null +++ b/test/HealthChecks.SurrealDb.Tests/DependencyInjection/RegistrationTests.cs @@ -0,0 +1,89 @@ +using SurrealDb.Net; + +namespace HealthChecks.SurrealDb.Tests.DependencyInjection; + +public class surrealdb_registration_should +{ + [Fact] + public void add_health_check_when_properly_configured() + { + var services = new ServiceCollection() + .AddHealthChecks() + .AddSurreal("connectionstring") + .Services; + + using var serviceProvider = services.BuildServiceProvider(); + var options = serviceProvider.GetRequiredService>(); + + var registration = options.Value.Registrations.First(); + var check = registration.Factory(serviceProvider); + + registration.Name.ShouldBe("surrealdb"); + check.ShouldBeOfType(); + } + + [Fact] + public void invoke_beforeOpen_when_defined() + { + var services = new ServiceCollection(); + bool invoked = false; + const string connectionstring = "Server=http://localhost:8000;Namespace=test;Database=test;Username=root;Password=root"; + void beforeOpen(ISurrealDbClient client) + { + invoked = true; + client.Uri.AbsoluteUri.ShouldBe("http://localhost:8000"); + } + services.AddHealthChecks() + .AddSurreal(connectionstring, configure: beforeOpen); + + using var serviceProvider = services.BuildServiceProvider(); + var options = serviceProvider.GetRequiredService>(); + + var registration = options.Value.Registrations.First(); + var check = registration.Factory(serviceProvider); + + Record.ExceptionAsync(() => check.CheckHealthAsync(new HealthCheckContext())).GetAwaiter().GetResult(); + invoked.ShouldBeTrue(); + } + + [Fact] + public void add_named_health_check_when_properly_configured() + { + var services = new ServiceCollection() + .AddHealthChecks() + .AddSurreal("connectionstring", name: "my-surrealdb-1") + .Services; + + using var serviceProvider = services.BuildServiceProvider(); + var options = serviceProvider.GetRequiredService>(); + + var registration = options.Value.Registrations.First(); + var check = registration.Factory(serviceProvider); + + registration.Name.ShouldBe("my-surrealdb-1"); + check.ShouldBeOfType(); + } + + [Fact] + public void add_health_check_with_connection_string_factory_when_properly_configured() + { + var services = new ServiceCollection(); + bool factoryCalled = false; + services.AddHealthChecks() + .AddSurreal(_ => + { + factoryCalled = true; + return "connectionstring"; + }); + + using var serviceProvider = services.BuildServiceProvider(); + var options = serviceProvider.GetRequiredService>(); + + var registration = options.Value.Registrations.First(); + var check = registration.Factory(serviceProvider); + + registration.Name.ShouldBe("surrealdb"); + check.ShouldBeOfType(); + factoryCalled.ShouldBeTrue(); + } +} diff --git a/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs b/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs new file mode 100644 index 0000000000..e84f776548 --- /dev/null +++ b/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs @@ -0,0 +1,56 @@ +using System.Net; + +namespace HealthChecks.SurrealDb.Tests.Functional; + +public class surrealdb_healthcheck_should +{ + [Fact] + public async Task be_healthy_if_surrealdb_is_available() + { + var connectionString = "Server=http://localhost:8000;Namespace=test;Database=test;Username=root;Password=root"; + + var webHostBuilder = new WebHostBuilder() + .ConfigureServices(services => + { + services.AddHealthChecks() + .AddSurreal(connectionString, tags: new string[] { "surrealdb" }); + }) + .Configure(app => + { + app.UseHealthChecks("/health", new HealthCheckOptions + { + Predicate = r => r.Tags.Contains("surrealdb") + }); + }); + + using var server = new TestServer(webHostBuilder); + + using var response = await server.CreateRequest("/health").GetAsync().ConfigureAwait(false); + + response.StatusCode.ShouldBe(HttpStatusCode.OK); + } + + [Fact] + public async Task be_unhealthy_if_surrealdb_is_not_available() + { + var webHostBuilder = new WebHostBuilder() + .ConfigureServices(services => + { + services.AddHealthChecks() + .AddSurreal("Server=http://200.0.0.100:1234;Namespace=test;Database=test;Username=root;Password=root", tags: new string[] { "surrealdb" }); + }) + .Configure(app => + { + app.UseHealthChecks("/health", new HealthCheckOptions + { + Predicate = r => r.Tags.Contains("surrealdb") + }); + }); + + using var server = new TestServer(webHostBuilder); + + using var response = await server.CreateRequest("/health").GetAsync().ConfigureAwait(false); + + response.StatusCode.ShouldBe(HttpStatusCode.ServiceUnavailable); + } +} diff --git a/test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.Tests.csproj b/test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.Tests.csproj new file mode 100644 index 0000000000..56fdcbe879 --- /dev/null +++ b/test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.Tests.csproj @@ -0,0 +1,11 @@ + + + + net6.0;net7.0 + + + + + + + diff --git a/test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.approved.txt b/test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.approved.txt new file mode 100644 index 0000000000..59268da4dc --- /dev/null +++ b/test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.approved.txt @@ -0,0 +1,24 @@ +namespace HealthChecks.SurrealDb +{ + public class SurrealDbHealthCheck : Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck + { + public SurrealDbHealthCheck(HealthChecks.SurrealDb.SurrealDbHealthCheckOptions options) { } + public System.Threading.Tasks.Task CheckHealthAsync(Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckContext context, System.Threading.CancellationToken cancellationToken = default) { } + } + public class SurrealDbHealthCheckOptions + { + public SurrealDbHealthCheckOptions() { } + public System.Action? Configure { get; set; } + public string ConnectionString { get; set; } + public System.Func? HealthCheckResultBuilder { get; set; } + } +} +namespace Microsoft.Extensions.DependencyInjection +{ + public static class SurrealDbHealthCheckBuilderExtensions + { + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddSurreal(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, HealthChecks.SurrealDb.SurrealDbHealthCheckOptions options, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddSurreal(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, System.Func connectionStringFactory, System.Action? configure = null, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddSurreal(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string connectionString, System.Action? configure = null, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } + } +} \ No newline at end of file From 481913597addd9c6b6ee4b14676941cf9f8f95e8 Mon Sep 17 00:00:00 2001 From: Odonno Date: Sun, 1 Oct 2023 16:57:03 +0200 Subject: [PATCH 02/12] Configure CI/CD --- .github/codecov.yml | 2 + .github/labeler.yml | 3 + .../workflows/healthchecks_surrealdb_cd.yml | 16 ++++ .../healthchecks_surrealdb_cd_preview.yml | 17 +++++ .../workflows/healthchecks_surrealdb_ci.yml | 73 +++++++++++++++++++ .../HealthChecks.SurrealDb.csproj | 4 +- .../HealthChecks.SurrealDb.Tests.csproj | 4 - 7 files changed, 113 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/healthchecks_surrealdb_cd.yml create mode 100644 .github/workflows/healthchecks_surrealdb_cd_preview.yml create mode 100644 .github/workflows/healthchecks_surrealdb_ci.yml diff --git a/.github/codecov.yml b/.github/codecov.yml index cac878e857..757d1fe835 100644 --- a/.github/codecov.yml +++ b/.github/codecov.yml @@ -103,6 +103,8 @@ flags: carryforward: true SqlServer: carryforward: true + SurrealDb: + carryforward: true System: carryforward: true UI: diff --git a/.github/labeler.yml b/.github/labeler.yml index fdc5433489..96636cbb6b 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -135,6 +135,9 @@ sqlite: sqlserver: - src/HealthChecks.SqlServer/**/* +surrealdb: + - src/HealthChecks.SurrealDb/**/* + system: - src/HealthChecks.System/**/* diff --git a/.github/workflows/healthchecks_surrealdb_cd.yml b/.github/workflows/healthchecks_surrealdb_cd.yml new file mode 100644 index 0000000000..85f5bf3fa8 --- /dev/null +++ b/.github/workflows/healthchecks_surrealdb_cd.yml @@ -0,0 +1,16 @@ +name: HealthChecks SurrealDB CD + +on: + push: + tags: + - release-surrealdb-* + - release-all-* + +jobs: + build: + uses: ./.github/workflows/reusable_cd_workflow.yml + secrets: inherit + with: + BUILD_CONFIG: Release + PROJECT_PATH: ./src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj + PACKAGE_NAME: AspNetCore.HealthChecks.SurrealDb diff --git a/.github/workflows/healthchecks_surrealdb_cd_preview.yml b/.github/workflows/healthchecks_surrealdb_cd_preview.yml new file mode 100644 index 0000000000..d38e0f111a --- /dev/null +++ b/.github/workflows/healthchecks_surrealdb_cd_preview.yml @@ -0,0 +1,17 @@ +name: HealthChecks SurrealDB Preview CD + +on: + push: + tags: + - preview-surrealdb-* + - preview-all-* + +jobs: + build: + uses: ./.github/workflows/reusable_cd_preview_workflow.yml + secrets: inherit + with: + BUILD_CONFIG: Release + VERSION_SUFFIX_PREFIX: rc1 + PROJECT_PATH: ./src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj + PACKAGE_NAME: AspNetCore.HealthChecks.SurrealDb diff --git a/.github/workflows/healthchecks_surrealdb_ci.yml b/.github/workflows/healthchecks_surrealdb_ci.yml new file mode 100644 index 0000000000..9aa6965c42 --- /dev/null +++ b/.github/workflows/healthchecks_surrealdb_ci.yml @@ -0,0 +1,73 @@ +name: HealthChecks SurrealDB CI + +on: + workflow_dispatch: + push: + branches: [master] + paths: + - src/HealthChecks.SurrealDb/** + - test/HealthChecks.SurrealDb.Tests/** + - test/_SHARED/** + - .github/workflows/healthchecks_surrealdb_ci.yml + - Directory.Build.props + - Directory.Build.targets + tags-ignore: + - release-* + - preview-* + + pull_request: + branches: [master] + paths: + - src/HealthChecks.SurrealDb/** + - test/HealthChecks.SurrealDb.Tests/** + - test/_SHARED/** + - .github/workflows/healthchecks_surrealdb_ci.yml + - Directory.Build.props + - Directory.Build.targets + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Start SurrealDB + uses: jvllmr/surrealdb-action@2.0.0 + with: + surrealdb-version: latest + surrealdb-port: 8000 + surrealdb-user: root + surrealdb-password: root + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: | + 6.0.x + 7.0.x + 8.0.x + - name: Restore + run: | + dotnet restore ./src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj && + dotnet restore ./test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.Tests.csproj + - name: Check formatting + run: | + dotnet format --no-restore --verify-no-changes --severity warn ./src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj || (echo "Run 'dotnet format' to fix issues" && exit 1) && + dotnet format --no-restore --verify-no-changes --severity warn ./test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.Tests.csproj || (echo "Run 'dotnet format' to fix issues" && exit 1) + - name: Build + run: | + dotnet build --no-restore ./src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj && + dotnet build --no-restore ./test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.Tests.csproj + - name: Test + run: > + dotnet test + ./test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.Tests.csproj + --no-restore + --no-build + --collect "XPlat Code Coverage" + --results-directory .coverage + -- + DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover + - name: Upload Coverage + uses: codecov/codecov-action@v3 + with: + flags: SurrealDb + directory: .coverage diff --git a/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj b/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj index 58c98c05dd..543db4c677 100644 --- a/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj +++ b/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.Tests.csproj b/test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.Tests.csproj index 56fdcbe879..1d0531a26b 100644 --- a/test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.Tests.csproj +++ b/test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.Tests.csproj @@ -1,9 +1,5 @@ - - net6.0;net7.0 - - From 50e252df92cfac62e50a6cedcb087144aaa8fa57 Mon Sep 17 00:00:00 2001 From: Odonno Date: Sat, 25 Nov 2023 11:21:17 +0100 Subject: [PATCH 03/12] Add ability to execute surql query --- .../SurrealDbHealthCheckBuilderExtensions.cs | 7 ++++- .../SurrealDbHealthCheck.cs | 5 ++++ .../SurrealDbHealthCheckOptions.cs | 5 ++++ .../Functional/SurrealDbHealthCheckTests.cs | 30 ++++++++++++++++++- .../HealthChecks.SurrealDb.approved.txt | 5 ++-- 5 files changed, 48 insertions(+), 4 deletions(-) diff --git a/src/HealthChecks.SurrealDb/DependencyInjection/SurrealDbHealthCheckBuilderExtensions.cs b/src/HealthChecks.SurrealDb/DependencyInjection/SurrealDbHealthCheckBuilderExtensions.cs index d9d1fabf66..6151d32faf 100644 --- a/src/HealthChecks.SurrealDb/DependencyInjection/SurrealDbHealthCheckBuilderExtensions.cs +++ b/src/HealthChecks.SurrealDb/DependencyInjection/SurrealDbHealthCheckBuilderExtensions.cs @@ -16,6 +16,7 @@ public static class SurrealDbHealthCheckBuilderExtensions /// /// The . /// The SurrealDB connection string to be used. + /// The query to be executed. /// An optional action to allow additional SQL Server specific configuration. /// The health check name. Optional. If null the type name 'surrealdb' will be used for the name. /// @@ -28,13 +29,14 @@ public static class SurrealDbHealthCheckBuilderExtensions public static IHealthChecksBuilder AddSurreal( this IHealthChecksBuilder builder, string connectionString, + string? healthQuery = null, Action? configure = null, string? name = default, HealthStatus? failureStatus = default, IEnumerable? tags = default, TimeSpan? timeout = default) { - return builder.AddSurreal(_ => connectionString, configure, name, failureStatus, tags, timeout); + return builder.AddSurreal(_ => connectionString, healthQuery, configure, name, failureStatus, tags, timeout); } /// @@ -42,6 +44,7 @@ public static IHealthChecksBuilder AddSurreal( /// /// The . /// A factory to build the SurrealDB connection string to use. + /// The query to be executed. /// An optional action to allow additional SQL Server specific configuration. /// The health check name. Optional. If null the type name 'surrealdb' will be used for the name. /// @@ -54,6 +57,7 @@ public static IHealthChecksBuilder AddSurreal( public static IHealthChecksBuilder AddSurreal( this IHealthChecksBuilder builder, Func connectionStringFactory, + string? healthQuery = null, Action? configure = null, string? name = default, HealthStatus? failureStatus = default, @@ -69,6 +73,7 @@ public static IHealthChecksBuilder AddSurreal( var options = new SurrealDbHealthCheckOptions { ConnectionString = connectionStringFactory(sp), + Query = healthQuery, Configure = configure, }; return new SurrealDbHealthCheck(options); diff --git a/src/HealthChecks.SurrealDb/SurrealDbHealthCheck.cs b/src/HealthChecks.SurrealDb/SurrealDbHealthCheck.cs index aeca83c437..33a0d5af87 100644 --- a/src/HealthChecks.SurrealDb/SurrealDbHealthCheck.cs +++ b/src/HealthChecks.SurrealDb/SurrealDbHealthCheck.cs @@ -33,6 +33,11 @@ public async Task CheckHealthAsync(HealthCheckContext context bool result = await client.Health(cancellationToken).ConfigureAwait(false); + if (!string.IsNullOrWhiteSpace(_options.Query)) + { + await client.Query(_options.Query).ConfigureAwait(false); + } + return _options.HealthCheckResultBuilder == null ? HealthCheckResult.Healthy() : _options.HealthCheckResultBuilder(result); diff --git a/src/HealthChecks.SurrealDb/SurrealDbHealthCheckOptions.cs b/src/HealthChecks.SurrealDb/SurrealDbHealthCheckOptions.cs index 709af9c982..f5a76aff1a 100644 --- a/src/HealthChecks.SurrealDb/SurrealDbHealthCheckOptions.cs +++ b/src/HealthChecks.SurrealDb/SurrealDbHealthCheckOptions.cs @@ -13,6 +13,11 @@ public class SurrealDbHealthCheckOptions /// public string ConnectionString { get; set; } = null!; + /// + /// The query to be executed. + /// + public string? Query { get; set; } + /// /// An optional action executed before the connection is opened in the health check. /// diff --git a/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs b/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs index e84f776548..3e37f1c3ef 100644 --- a/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs +++ b/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs @@ -33,11 +33,39 @@ public async Task be_healthy_if_surrealdb_is_available() [Fact] public async Task be_unhealthy_if_surrealdb_is_not_available() { + var connectionString = "Server=http://200.0.0.100:1234;Namespace=test;Database=test;Username=root;Password=root"; + + var webHostBuilder = new WebHostBuilder() + .ConfigureServices(services => + { + services.AddHealthChecks() + .AddSurreal(connectionString, tags: new string[] { "surrealdb" }); + }) + .Configure(app => + { + app.UseHealthChecks("/health", new HealthCheckOptions + { + Predicate = r => r.Tags.Contains("surrealdb") + }); + }); + + using var server = new TestServer(webHostBuilder); + + using var response = await server.CreateRequest("/health").GetAsync().ConfigureAwait(false); + + response.StatusCode.ShouldBe(HttpStatusCode.ServiceUnavailable); + } + + [Fact] + public async Task be_unhealthy_if_surql_query_throw_error() + { + var connectionString = "Server=tcp:localhost,5433;Initial Catalog=master;User Id=sa;Password=Password12!;Encrypt=false"; + var webHostBuilder = new WebHostBuilder() .ConfigureServices(services => { services.AddHealthChecks() - .AddSurreal("Server=http://200.0.0.100:1234;Namespace=test;Database=test;Username=root;Password=root", tags: new string[] { "surrealdb" }); + .AddSurreal(connectionString, healthQuery: "THROW \"Error\";", tags: new string[] { "surrealdb" }); }) .Configure(app => { diff --git a/test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.approved.txt b/test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.approved.txt index 59268da4dc..7c3a9f1dda 100644 --- a/test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.approved.txt +++ b/test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.approved.txt @@ -11,6 +11,7 @@ namespace HealthChecks.SurrealDb public System.Action? Configure { get; set; } public string ConnectionString { get; set; } public System.Func? HealthCheckResultBuilder { get; set; } + public string? Query { get; set; } } } namespace Microsoft.Extensions.DependencyInjection @@ -18,7 +19,7 @@ namespace Microsoft.Extensions.DependencyInjection public static class SurrealDbHealthCheckBuilderExtensions { public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddSurreal(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, HealthChecks.SurrealDb.SurrealDbHealthCheckOptions options, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } - public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddSurreal(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, System.Func connectionStringFactory, System.Action? configure = null, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } - public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddSurreal(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string connectionString, System.Action? configure = null, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddSurreal(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, System.Func connectionStringFactory, string? healthQuery = null, System.Action? configure = null, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddSurreal(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string connectionString, string? healthQuery = null, System.Action? configure = null, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } } } \ No newline at end of file From 362809e3daee29ed3f3ced0e5087465a97e36b50 Mon Sep 17 00:00:00 2001 From: Odonno Date: Sat, 27 Jan 2024 11:23:29 +0100 Subject: [PATCH 04/12] Update package version --- src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj | 4 ++-- .../DependencyInjection/RegistrationTests.cs | 4 ++-- .../Functional/SurrealDbHealthCheckTests.cs | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj b/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj index 543db4c677..19eae51faf 100644 --- a/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj +++ b/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/test/HealthChecks.SurrealDb.Tests/DependencyInjection/RegistrationTests.cs b/test/HealthChecks.SurrealDb.Tests/DependencyInjection/RegistrationTests.cs index b5f812c705..0c564982ea 100644 --- a/test/HealthChecks.SurrealDb.Tests/DependencyInjection/RegistrationTests.cs +++ b/test/HealthChecks.SurrealDb.Tests/DependencyInjection/RegistrationTests.cs @@ -23,7 +23,7 @@ public void add_health_check_when_properly_configured() } [Fact] - public void invoke_beforeOpen_when_defined() + public async Task invoke_beforeOpen_when_defined() { var services = new ServiceCollection(); bool invoked = false; @@ -42,7 +42,7 @@ void beforeOpen(ISurrealDbClient client) var registration = options.Value.Registrations.First(); var check = registration.Factory(serviceProvider); - Record.ExceptionAsync(() => check.CheckHealthAsync(new HealthCheckContext())).GetAwaiter().GetResult(); + await Record.ExceptionAsync(() => check.CheckHealthAsync(new HealthCheckContext())); invoked.ShouldBeTrue(); } diff --git a/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs b/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs index 3e37f1c3ef..49a1a6d1ba 100644 --- a/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs +++ b/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs @@ -25,7 +25,7 @@ public async Task be_healthy_if_surrealdb_is_available() using var server = new TestServer(webHostBuilder); - using var response = await server.CreateRequest("/health").GetAsync().ConfigureAwait(false); + using var response = await server.CreateRequest("/health").GetAsync(); response.StatusCode.ShouldBe(HttpStatusCode.OK); } @@ -51,7 +51,7 @@ public async Task be_unhealthy_if_surrealdb_is_not_available() using var server = new TestServer(webHostBuilder); - using var response = await server.CreateRequest("/health").GetAsync().ConfigureAwait(false); + using var response = await server.CreateRequest("/health").GetAsync(); response.StatusCode.ShouldBe(HttpStatusCode.ServiceUnavailable); } @@ -77,7 +77,7 @@ public async Task be_unhealthy_if_surql_query_throw_error() using var server = new TestServer(webHostBuilder); - using var response = await server.CreateRequest("/health").GetAsync().ConfigureAwait(false); + using var response = await server.CreateRequest("/health").GetAsync(); response.StatusCode.ShouldBe(HttpStatusCode.ServiceUnavailable); } From 7bad17a7f8e18d7e2ccaf07aaa2d595347eb711a Mon Sep 17 00:00:00 2001 From: Odonno Date: Sat, 27 Jan 2024 11:47:55 +0100 Subject: [PATCH 05/12] Improve output in case of surrealdb error response from query --- .../SurrealDbHealthCheck.cs | 18 +++++++++++++++++- .../Functional/SurrealDbHealthCheckTests.cs | 4 ++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/HealthChecks.SurrealDb/SurrealDbHealthCheck.cs b/src/HealthChecks.SurrealDb/SurrealDbHealthCheck.cs index 33a0d5af87..f9958fdc09 100644 --- a/src/HealthChecks.SurrealDb/SurrealDbHealthCheck.cs +++ b/src/HealthChecks.SurrealDb/SurrealDbHealthCheck.cs @@ -1,6 +1,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Diagnostics.HealthChecks; using SurrealDb.Net; +using SurrealDb.Net.Models.Response; namespace HealthChecks.SurrealDb; @@ -35,7 +36,22 @@ public async Task CheckHealthAsync(HealthCheckContext context if (!string.IsNullOrWhiteSpace(_options.Query)) { - await client.Query(_options.Query).ConfigureAwait(false); + var response = await client.Query(_options.Query).ConfigureAwait(false); + + if (response.HasErrors) + { + var error = response.Errors.First(); + string errorMessage = error switch + { + SurrealDbErrorResult errorResult => errorResult.Details, + SurrealDbProtocolErrorResult protocolErrorResult => protocolErrorResult.Details ?? protocolErrorResult.Description, + _ => "Unknown error" + }; + + return _options.HealthCheckResultBuilder == null + ? HealthCheckResult.Unhealthy(errorMessage) + : _options.HealthCheckResultBuilder(false); + } } return _options.HealthCheckResultBuilder == null diff --git a/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs b/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs index 49a1a6d1ba..37087d6705 100644 --- a/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs +++ b/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs @@ -33,7 +33,7 @@ public async Task be_healthy_if_surrealdb_is_available() [Fact] public async Task be_unhealthy_if_surrealdb_is_not_available() { - var connectionString = "Server=http://200.0.0.100:1234;Namespace=test;Database=test;Username=root;Password=root"; + var connectionString = "Server=http://localhost:1234;Namespace=test;Database=test;Username=root;Password=root"; var webHostBuilder = new WebHostBuilder() .ConfigureServices(services => @@ -59,7 +59,7 @@ public async Task be_unhealthy_if_surrealdb_is_not_available() [Fact] public async Task be_unhealthy_if_surql_query_throw_error() { - var connectionString = "Server=tcp:localhost,5433;Initial Catalog=master;User Id=sa;Password=Password12!;Encrypt=false"; + var connectionString = "Server=http://localhost:8000;Namespace=test;Database=test;Username=root;Password=root"; var webHostBuilder = new WebHostBuilder() .ConfigureServices(services => From b1e700e559a903dae744dd196439468d0e026d2c Mon Sep 17 00:00:00 2001 From: Odonno Date: Sun, 17 Mar 2024 17:03:42 +0100 Subject: [PATCH 06/12] Update SurrealDb dependency --- src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj | 2 +- src/HealthChecks.SurrealDb/SurrealDbHealthCheck.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj b/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj index 19eae51faf..eb78679514 100644 --- a/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj +++ b/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/HealthChecks.SurrealDb/SurrealDbHealthCheck.cs b/src/HealthChecks.SurrealDb/SurrealDbHealthCheck.cs index f9958fdc09..71a271eff1 100644 --- a/src/HealthChecks.SurrealDb/SurrealDbHealthCheck.cs +++ b/src/HealthChecks.SurrealDb/SurrealDbHealthCheck.cs @@ -36,7 +36,7 @@ public async Task CheckHealthAsync(HealthCheckContext context if (!string.IsNullOrWhiteSpace(_options.Query)) { - var response = await client.Query(_options.Query).ConfigureAwait(false); + var response = await client.RawQuery(_options.Query, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.HasErrors) { From d0de71204f8f72e349732603e0f0fde6ecf828b0 Mon Sep 17 00:00:00 2001 From: Odonno Date: Sun, 3 Nov 2024 11:52:26 +0100 Subject: [PATCH 07/12] Fix CI/CD --- .github/workflows/healthchecks_surrealdb_ci.yml | 12 +++++++----- .../Functional/SurrealDbHealthCheckTests.cs | 12 ++++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/healthchecks_surrealdb_ci.yml b/.github/workflows/healthchecks_surrealdb_ci.yml index 9aa6965c42..eb40366227 100644 --- a/.github/workflows/healthchecks_surrealdb_ci.yml +++ b/.github/workflows/healthchecks_surrealdb_ci.yml @@ -31,12 +31,14 @@ jobs: steps: - uses: actions/checkout@v3 - name: Start SurrealDB - uses: jvllmr/surrealdb-action@2.0.0 + uses: surrealdb/setup-surreal@v2 with: - surrealdb-version: latest - surrealdb-port: 8000 - surrealdb-user: root - surrealdb-password: root + surrealdb_version: latest + surrealdb_port: 8000 + surrealdb_username: root + surrealdb_password: root + surrealdb_auth: true + surrealdb_strict: - name: Setup .NET uses: actions/setup-dotnet@v3 with: diff --git a/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs b/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs index 37087d6705..f20276497d 100644 --- a/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs +++ b/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs @@ -7,13 +7,13 @@ public class surrealdb_healthcheck_should [Fact] public async Task be_healthy_if_surrealdb_is_available() { - var connectionString = "Server=http://localhost:8000;Namespace=test;Database=test;Username=root;Password=root"; + const string connectionString = "Server=http://localhost:8000;Namespace=test;Database=test;Username=root;Password=root"; var webHostBuilder = new WebHostBuilder() .ConfigureServices(services => { services.AddHealthChecks() - .AddSurreal(connectionString, tags: new string[] { "surrealdb" }); + .AddSurreal(connectionString, tags: ["surrealdb"]); }) .Configure(app => { @@ -33,13 +33,13 @@ public async Task be_healthy_if_surrealdb_is_available() [Fact] public async Task be_unhealthy_if_surrealdb_is_not_available() { - var connectionString = "Server=http://localhost:1234;Namespace=test;Database=test;Username=root;Password=root"; + const string connectionString = "Server=http://localhost:1234;Namespace=test;Database=test;Username=root;Password=root"; var webHostBuilder = new WebHostBuilder() .ConfigureServices(services => { services.AddHealthChecks() - .AddSurreal(connectionString, tags: new string[] { "surrealdb" }); + .AddSurreal(connectionString, tags: ["surrealdb"]); }) .Configure(app => { @@ -59,13 +59,13 @@ public async Task be_unhealthy_if_surrealdb_is_not_available() [Fact] public async Task be_unhealthy_if_surql_query_throw_error() { - var connectionString = "Server=http://localhost:8000;Namespace=test;Database=test;Username=root;Password=root"; + const string connectionString = "Server=http://localhost:8000;Namespace=test;Database=test;Username=root;Password=root"; var webHostBuilder = new WebHostBuilder() .ConfigureServices(services => { services.AddHealthChecks() - .AddSurreal(connectionString, healthQuery: "THROW \"Error\";", tags: new string[] { "surrealdb" }); + .AddSurreal(connectionString, healthQuery: "THROW \"Error\";", tags: ["surrealdb"]); }) .Configure(app => { From a407f8e15ba07daccb150e7d2d23fc44b115817f Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Thu, 12 Dec 2024 11:38:38 +0100 Subject: [PATCH 08/12] fix the build --- Directory.Packages.props | 1 + src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index af73e3b085..14504ae867 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -95,6 +95,7 @@ + diff --git a/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj b/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj index eb78679514..85988e167c 100644 --- a/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj +++ b/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj @@ -5,11 +5,11 @@ $(PackageTags);SurrealDb HealthChecks.SurrealDb is the health check package for SurrealDB. $(HealthCheckSurrealDb) + false - - + From 922fe401803913542cfe0904e90afcc2d2a8ce68 Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Thu, 12 Dec 2024 11:44:12 +0100 Subject: [PATCH 09/12] tell the CI to use 8.0 and 9.0 SDK, add net8.0 to the list of TFMS --- .github/workflows/healthchecks_surrealdb_ci.yml | 5 +++-- src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/healthchecks_surrealdb_ci.yml b/.github/workflows/healthchecks_surrealdb_ci.yml index eb40366227..d6ae7feec8 100644 --- a/.github/workflows/healthchecks_surrealdb_ci.yml +++ b/.github/workflows/healthchecks_surrealdb_ci.yml @@ -11,6 +11,7 @@ on: - .github/workflows/healthchecks_surrealdb_ci.yml - Directory.Build.props - Directory.Build.targets + - Directory.Packages.props tags-ignore: - release-* - preview-* @@ -24,6 +25,7 @@ on: - .github/workflows/healthchecks_surrealdb_ci.yml - Directory.Build.props - Directory.Build.targets + - Directory.Packages.props jobs: build: @@ -43,9 +45,8 @@ jobs: uses: actions/setup-dotnet@v3 with: dotnet-version: | - 6.0.x - 7.0.x 8.0.x + 9.0.x - name: Restore run: | dotnet restore ./src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj && diff --git a/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj b/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj index 85988e167c..54b83b1c23 100644 --- a/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj +++ b/src/HealthChecks.SurrealDb/HealthChecks.SurrealDb.csproj @@ -1,7 +1,7 @@ - netstandard2.1 + netstandard2.1;$(DefaultNetCoreApp) $(PackageTags);SurrealDb HealthChecks.SurrealDb is the health check package for SurrealDB. $(HealthCheckSurrealDb) From e6646897af31b378e7902ac8855300a814a484a3 Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Thu, 12 Dec 2024 11:48:20 +0100 Subject: [PATCH 10/12] unrelated build fix: don't try to sign ClickHouse --- src/HealthChecks.ClickHouse/HealthChecks.ClickHouse.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/HealthChecks.ClickHouse/HealthChecks.ClickHouse.csproj b/src/HealthChecks.ClickHouse/HealthChecks.ClickHouse.csproj index 124a2eb6e7..7036eb3f29 100644 --- a/src/HealthChecks.ClickHouse/HealthChecks.ClickHouse.csproj +++ b/src/HealthChecks.ClickHouse/HealthChecks.ClickHouse.csproj @@ -5,6 +5,7 @@ $(PackageTags);Beat;ClickHouse HealthChecks.ClickHouse is a health check for ClickHouse. $(HealthCheckClickHouse) + false From fc58726d559d1c25a7ceb6d022016286c7b8d564 Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Thu, 12 Dec 2024 12:08:10 +0100 Subject: [PATCH 11/12] simplify the public API surface and add a README --- .../SurrealDbHealthCheckBuilderExtensions.cs | 87 +++---------------- src/HealthChecks.SurrealDb/README.md | 15 ++++ .../SurrealDbHealthCheck.cs | 44 ++-------- .../SurrealDbHealthCheckOptions.cs | 30 ------- .../DependencyInjection/RegistrationTests.cs | 45 +++------- .../Functional/SurrealDbHealthCheckTests.cs | 40 +++------ .../HealthChecks.SurrealDb.approved.txt | 14 +-- 7 files changed, 58 insertions(+), 217 deletions(-) create mode 100644 src/HealthChecks.SurrealDb/README.md delete mode 100644 src/HealthChecks.SurrealDb/SurrealDbHealthCheckOptions.cs diff --git a/src/HealthChecks.SurrealDb/DependencyInjection/SurrealDbHealthCheckBuilderExtensions.cs b/src/HealthChecks.SurrealDb/DependencyInjection/SurrealDbHealthCheckBuilderExtensions.cs index 6151d32faf..94c5c4e3fe 100644 --- a/src/HealthChecks.SurrealDb/DependencyInjection/SurrealDbHealthCheckBuilderExtensions.cs +++ b/src/HealthChecks.SurrealDb/DependencyInjection/SurrealDbHealthCheckBuilderExtensions.cs @@ -15,37 +15,10 @@ public static class SurrealDbHealthCheckBuilderExtensions /// Add a health check for SurrealDB. /// /// The . - /// The SurrealDB connection string to be used. - /// The query to be executed. - /// An optional action to allow additional SQL Server specific configuration. - /// The health check name. Optional. If null the type name 'surrealdb' will be used for the name. - /// - /// The that should be reported when the health check fails. Optional. If null then - /// the default status of will be reported. + /// + /// An optional factory to obtain instance. + /// When not provided, is simply resolved from . /// - /// A list of tags that can be used to filter sets of health checks. Optional. - /// An optional representing the timeout of the check. - /// The specified . - public static IHealthChecksBuilder AddSurreal( - this IHealthChecksBuilder builder, - string connectionString, - string? healthQuery = null, - Action? configure = null, - string? name = default, - HealthStatus? failureStatus = default, - IEnumerable? tags = default, - TimeSpan? timeout = default) - { - return builder.AddSurreal(_ => connectionString, healthQuery, configure, name, failureStatus, tags, timeout); - } - - /// - /// Add a health check for SurrealDB. - /// - /// The . - /// A factory to build the SurrealDB connection string to use. - /// The query to be executed. - /// An optional action to allow additional SQL Server specific configuration. /// The health check name. Optional. If null the type name 'surrealdb' will be used for the name. /// /// The that should be reported when the health check fails. Optional. If null then @@ -56,61 +29,25 @@ public static IHealthChecksBuilder AddSurreal( /// The specified . public static IHealthChecksBuilder AddSurreal( this IHealthChecksBuilder builder, - Func connectionStringFactory, - string? healthQuery = null, - Action? configure = null, + Func? factory = null, string? name = default, HealthStatus? failureStatus = default, IEnumerable? tags = default, TimeSpan? timeout = default) { - Guard.ThrowIfNull(connectionStringFactory); - return builder.Add(new HealthCheckRegistration( name ?? NAME, - sp => - { - var options = new SurrealDbHealthCheckOptions - { - ConnectionString = connectionStringFactory(sp), - Query = healthQuery, - Configure = configure, - }; - return new SurrealDbHealthCheck(options); - }, + sp => Factory(sp, factory), failureStatus, tags, timeout)); - } - /// - /// Add a health check for SurrealDB. - /// - /// The . - /// Options for health check. - /// The health check name. Optional. If null the type name 'surrealdb' will be used for the name. - /// - /// The that should be reported when the health check fails. Optional. If null then - /// the default status of will be reported. - /// - /// A list of tags that can be used to filter sets of health checks. Optional. - /// An optional representing the timeout of the check. - /// The specified . - public static IHealthChecksBuilder AddSurreal( - this IHealthChecksBuilder builder, - SurrealDbHealthCheckOptions options, - string? name = default, - HealthStatus? failureStatus = default, - IEnumerable? tags = default, - TimeSpan? timeout = default) - { - Guard.ThrowIfNull(options); - - return builder.Add(new HealthCheckRegistration( - name ?? NAME, - _ => new SurrealDbHealthCheck(options), - failureStatus, - tags, - timeout)); + static SurrealDbHealthCheck Factory(IServiceProvider sp, Func? factory) + { + // The user might have registered a factory for SurrealDbClient type, but not for the abstraction (ISurrealDbClient). + // That is why we try to resolve SurrealDbClient first. + ISurrealDbClient client = factory?.Invoke(sp) ?? sp.GetService() ?? sp.GetRequiredService(); + return new(client); + } } } diff --git a/src/HealthChecks.SurrealDb/README.md b/src/HealthChecks.SurrealDb/README.md new file mode 100644 index 0000000000..9a7cc7c256 --- /dev/null +++ b/src/HealthChecks.SurrealDb/README.md @@ -0,0 +1,15 @@ +## SurrealDB Health Check + +This health check verifies the ability to communicate with [SurrealDb](https://surrealdb.com). It uses the provided [ISurrealDbClient](https://surrealdb.com/docs/sdk/dotnet). + +### Defaults + +By default, the `ISurrealDbClient` instance is resolved from service provider. + +```csharp +void Configure(IHealthChecksBuilder builder) +{ + builder.Services.AddSurreal("Server=http://localhost:8000;Namespace=test;Database=test"; + builder.AddHealthChecks().AddSurreal(); +} +``` diff --git a/src/HealthChecks.SurrealDb/SurrealDbHealthCheck.cs b/src/HealthChecks.SurrealDb/SurrealDbHealthCheck.cs index 71a271eff1..c4248d8a93 100644 --- a/src/HealthChecks.SurrealDb/SurrealDbHealthCheck.cs +++ b/src/HealthChecks.SurrealDb/SurrealDbHealthCheck.cs @@ -1,7 +1,5 @@ -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Diagnostics.HealthChecks; using SurrealDb.Net; -using SurrealDb.Net.Models.Response; namespace HealthChecks.SurrealDb; @@ -10,12 +8,11 @@ namespace HealthChecks.SurrealDb; /// public class SurrealDbHealthCheck : IHealthCheck { - private readonly SurrealDbHealthCheckOptions _options; + private readonly ISurrealDbClient _client; - public SurrealDbHealthCheck(SurrealDbHealthCheckOptions options) + public SurrealDbHealthCheck(ISurrealDbClient client) { - Guard.ThrowIfNull(options.ConnectionString, true); - _options = options; + _client = Guard.ThrowIfNull(client); } /// @@ -23,40 +20,11 @@ public async Task CheckHealthAsync(HealthCheckContext context { try { - var clientOptions = new SurrealDbOptionsBuilder() - .FromConnectionString(_options.ConnectionString) - .Build(); + await _client.Connect(cancellationToken).ConfigureAwait(false); - using var client = new SurrealDbClient(clientOptions); - - _options.Configure?.Invoke(client); - await client.Connect(cancellationToken).ConfigureAwait(false); - - bool result = await client.Health(cancellationToken).ConfigureAwait(false); - - if (!string.IsNullOrWhiteSpace(_options.Query)) - { - var response = await client.RawQuery(_options.Query, cancellationToken: cancellationToken).ConfigureAwait(false); - - if (response.HasErrors) - { - var error = response.Errors.First(); - string errorMessage = error switch - { - SurrealDbErrorResult errorResult => errorResult.Details, - SurrealDbProtocolErrorResult protocolErrorResult => protocolErrorResult.Details ?? protocolErrorResult.Description, - _ => "Unknown error" - }; - - return _options.HealthCheckResultBuilder == null - ? HealthCheckResult.Unhealthy(errorMessage) - : _options.HealthCheckResultBuilder(false); - } - } - - return _options.HealthCheckResultBuilder == null + return await _client.Health(cancellationToken).ConfigureAwait(false) ? HealthCheckResult.Healthy() - : _options.HealthCheckResultBuilder(result); + : HealthCheckResult.Unhealthy(); } catch (Exception ex) { diff --git a/src/HealthChecks.SurrealDb/SurrealDbHealthCheckOptions.cs b/src/HealthChecks.SurrealDb/SurrealDbHealthCheckOptions.cs deleted file mode 100644 index f5a76aff1a..0000000000 --- a/src/HealthChecks.SurrealDb/SurrealDbHealthCheckOptions.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Microsoft.Extensions.Diagnostics.HealthChecks; -using SurrealDb.Net; - -namespace HealthChecks.SurrealDb; - -/// -/// Options for . -/// -public class SurrealDbHealthCheckOptions -{ - /// - /// The Sql Server connection string to be used. - /// - public string ConnectionString { get; set; } = null!; - - /// - /// The query to be executed. - /// - public string? Query { get; set; } - - /// - /// An optional action executed before the connection is opened in the health check. - /// - public Action? Configure { get; set; } - - /// - /// An optional delegate to build health check result. - /// - public Func? HealthCheckResultBuilder { get; set; } -} diff --git a/test/HealthChecks.SurrealDb.Tests/DependencyInjection/RegistrationTests.cs b/test/HealthChecks.SurrealDb.Tests/DependencyInjection/RegistrationTests.cs index 0c564982ea..290072f18e 100644 --- a/test/HealthChecks.SurrealDb.Tests/DependencyInjection/RegistrationTests.cs +++ b/test/HealthChecks.SurrealDb.Tests/DependencyInjection/RegistrationTests.cs @@ -4,13 +4,16 @@ namespace HealthChecks.SurrealDb.Tests.DependencyInjection; public class surrealdb_registration_should { + private const string ConnectionString = "Server=http://localhost:8000;Namespace=test;Database=test;Username=root;Password=root"; + [Fact] public void add_health_check_when_properly_configured() { - var services = new ServiceCollection() + var services = new ServiceCollection(); + services.AddSurreal(ConnectionString); + services .AddHealthChecks() - .AddSurreal("connectionstring") - .Services; + .AddSurreal(); using var serviceProvider = services.BuildServiceProvider(); var options = serviceProvider.GetRequiredService>(); @@ -22,37 +25,14 @@ public void add_health_check_when_properly_configured() check.ShouldBeOfType(); } - [Fact] - public async Task invoke_beforeOpen_when_defined() - { - var services = new ServiceCollection(); - bool invoked = false; - const string connectionstring = "Server=http://localhost:8000;Namespace=test;Database=test;Username=root;Password=root"; - void beforeOpen(ISurrealDbClient client) - { - invoked = true; - client.Uri.AbsoluteUri.ShouldBe("http://localhost:8000"); - } - services.AddHealthChecks() - .AddSurreal(connectionstring, configure: beforeOpen); - - using var serviceProvider = services.BuildServiceProvider(); - var options = serviceProvider.GetRequiredService>(); - - var registration = options.Value.Registrations.First(); - var check = registration.Factory(serviceProvider); - - await Record.ExceptionAsync(() => check.CheckHealthAsync(new HealthCheckContext())); - invoked.ShouldBeTrue(); - } - [Fact] public void add_named_health_check_when_properly_configured() { - var services = new ServiceCollection() + var services = new ServiceCollection(); + services.AddSurreal(ConnectionString); + services .AddHealthChecks() - .AddSurreal("connectionstring", name: "my-surrealdb-1") - .Services; + .AddSurreal(name: "my-surrealdb-1"); using var serviceProvider = services.BuildServiceProvider(); var options = serviceProvider.GetRequiredService>(); @@ -68,12 +48,13 @@ public void add_named_health_check_when_properly_configured() public void add_health_check_with_connection_string_factory_when_properly_configured() { var services = new ServiceCollection(); + services.AddSurreal(ConnectionString); bool factoryCalled = false; services.AddHealthChecks() - .AddSurreal(_ => + .AddSurreal(sp => { factoryCalled = true; - return "connectionstring"; + return sp.GetRequiredService(); }); using var serviceProvider = services.BuildServiceProvider(); diff --git a/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs b/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs index f20276497d..cdf6c21a76 100644 --- a/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs +++ b/test/HealthChecks.SurrealDb.Tests/Functional/SurrealDbHealthCheckTests.cs @@ -12,8 +12,11 @@ public async Task be_healthy_if_surrealdb_is_available() var webHostBuilder = new WebHostBuilder() .ConfigureServices(services => { - services.AddHealthChecks() - .AddSurreal(connectionString, tags: ["surrealdb"]); + services + .AddSurreal(connectionString); + services + .AddHealthChecks() + .AddSurreal(tags: ["surrealdb"]); }) .Configure(app => { @@ -38,34 +41,11 @@ public async Task be_unhealthy_if_surrealdb_is_not_available() var webHostBuilder = new WebHostBuilder() .ConfigureServices(services => { - services.AddHealthChecks() - .AddSurreal(connectionString, tags: ["surrealdb"]); - }) - .Configure(app => - { - app.UseHealthChecks("/health", new HealthCheckOptions - { - Predicate = r => r.Tags.Contains("surrealdb") - }); - }); - - using var server = new TestServer(webHostBuilder); - - using var response = await server.CreateRequest("/health").GetAsync(); - - response.StatusCode.ShouldBe(HttpStatusCode.ServiceUnavailable); - } - - [Fact] - public async Task be_unhealthy_if_surql_query_throw_error() - { - const string connectionString = "Server=http://localhost:8000;Namespace=test;Database=test;Username=root;Password=root"; - - var webHostBuilder = new WebHostBuilder() - .ConfigureServices(services => - { - services.AddHealthChecks() - .AddSurreal(connectionString, healthQuery: "THROW \"Error\";", tags: ["surrealdb"]); + services + .AddSurreal(connectionString); + services + .AddHealthChecks() + .AddSurreal(tags: ["surrealdb"]); }) .Configure(app => { diff --git a/test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.approved.txt b/test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.approved.txt index 7c3a9f1dda..8fb3ecf195 100644 --- a/test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.approved.txt +++ b/test/HealthChecks.SurrealDb.Tests/HealthChecks.SurrealDb.approved.txt @@ -2,24 +2,14 @@ namespace HealthChecks.SurrealDb { public class SurrealDbHealthCheck : Microsoft.Extensions.Diagnostics.HealthChecks.IHealthCheck { - public SurrealDbHealthCheck(HealthChecks.SurrealDb.SurrealDbHealthCheckOptions options) { } + public SurrealDbHealthCheck(SurrealDb.Net.ISurrealDbClient client) { } public System.Threading.Tasks.Task CheckHealthAsync(Microsoft.Extensions.Diagnostics.HealthChecks.HealthCheckContext context, System.Threading.CancellationToken cancellationToken = default) { } } - public class SurrealDbHealthCheckOptions - { - public SurrealDbHealthCheckOptions() { } - public System.Action? Configure { get; set; } - public string ConnectionString { get; set; } - public System.Func? HealthCheckResultBuilder { get; set; } - public string? Query { get; set; } - } } namespace Microsoft.Extensions.DependencyInjection { public static class SurrealDbHealthCheckBuilderExtensions { - public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddSurreal(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, HealthChecks.SurrealDb.SurrealDbHealthCheckOptions options, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } - public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddSurreal(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, System.Func connectionStringFactory, string? healthQuery = null, System.Action? configure = null, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } - public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddSurreal(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string connectionString, string? healthQuery = null, System.Action? configure = null, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddSurreal(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, System.Func? factory = null, string? name = null, Microsoft.Extensions.Diagnostics.HealthChecks.HealthStatus? failureStatus = default, System.Collections.Generic.IEnumerable? tags = null, System.TimeSpan? timeout = default) { } } } \ No newline at end of file From 0410c74e86d83a37df07b8df8405711319b9ef87 Mon Sep 17 00:00:00 2001 From: Adam Sitnik Date: Thu, 12 Dec 2024 12:27:56 +0100 Subject: [PATCH 12/12] minor fixes after reading my changes again --- .../SurrealDbHealthCheckBuilderExtensions.cs | 2 +- src/HealthChecks.SurrealDb/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/HealthChecks.SurrealDb/DependencyInjection/SurrealDbHealthCheckBuilderExtensions.cs b/src/HealthChecks.SurrealDb/DependencyInjection/SurrealDbHealthCheckBuilderExtensions.cs index 94c5c4e3fe..12107ecb1d 100644 --- a/src/HealthChecks.SurrealDb/DependencyInjection/SurrealDbHealthCheckBuilderExtensions.cs +++ b/src/HealthChecks.SurrealDb/DependencyInjection/SurrealDbHealthCheckBuilderExtensions.cs @@ -45,7 +45,7 @@ public static IHealthChecksBuilder AddSurreal( static SurrealDbHealthCheck Factory(IServiceProvider sp, Func? factory) { // The user might have registered a factory for SurrealDbClient type, but not for the abstraction (ISurrealDbClient). - // That is why we try to resolve SurrealDbClient first. + // That is why we try to resolve ISurrealDbClient first. ISurrealDbClient client = factory?.Invoke(sp) ?? sp.GetService() ?? sp.GetRequiredService(); return new(client); } diff --git a/src/HealthChecks.SurrealDb/README.md b/src/HealthChecks.SurrealDb/README.md index 9a7cc7c256..dc747278f9 100644 --- a/src/HealthChecks.SurrealDb/README.md +++ b/src/HealthChecks.SurrealDb/README.md @@ -9,7 +9,7 @@ By default, the `ISurrealDbClient` instance is resolved from service provider. ```csharp void Configure(IHealthChecksBuilder builder) { - builder.Services.AddSurreal("Server=http://localhost:8000;Namespace=test;Database=test"; + builder.Services.AddSurreal("Server=http://localhost:8000;Namespace=test;Database=test"); builder.AddHealthChecks().AddSurreal(); } ```