An open API service indexing awesome lists of open source software.

https://github.com/arnab-developer/arc.httphealthcheckdashboard

HTTP health check dashboard library
https://github.com/arnab-developer/arc.httphealthcheckdashboard

csharp dotnet nuget

Last synced: about 2 months ago
JSON representation

HTTP health check dashboard library

Awesome Lists containing this project

README

          

# Http health check dashboard

This is a library for http health check dashboard. It has been hosted in
[NuGet](https://www.nuget.org/packages/Arc.HttpHealthCheckDashboard/).
Use below command to install this in your .NET application.

```
dotnet add package Arc.HttpHealthCheckDashboard
```

Create separate classes for each separate http urls to be checked. Create your class which
inherits `BaseHealthCheck` and it should work with default naming convention. The default
naming convention is `[ClassName]HealthCheck`.

```csharp
public class [ClassName]HealthCheck : BaseHealthCheck
{
public [ClassName]HealthCheck(IEnumerable urlDetails,
ICommonHealthCheck commonHealthCheck) : base(urlDetails, commonHealthCheck)
{
}
}
```

To use a different naming convention override the `GetMatch()` method. In below example it is
using a different naming convention which is `[ClassName]HC`.

```csharp
public class GmailHC : BaseHealthCheck
{
public GmailHC(IEnumerable urlDetails, ICommonHealthCheck commonHealthCheck)
: base(urlDetails, commonHealthCheck)
{
}

protected override Predicate GetMatch()
{
int indexOfHealthCheck = GetType().Name.IndexOf("HC");
string apiNameToTest = GetType().Name.Substring(0, indexOfHealthCheck);
return new Predicate(u => u.Name == apiNameToTest && u.IsEnable);
}
}
```

There is a
[dashboard app](https://github.com/Arnab-Developer/HttpHealthCheckDashboard)
which uses the library to check health of some http endpoints. This is to show
how you can use this library in your app.