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
- Host: GitHub
- URL: https://github.com/arnab-developer/arc.httphealthcheckdashboard
- Owner: Arnab-Developer
- License: mit
- Created: 2021-06-10T13:07:52.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2022-05-13T05:41:12.000Z (about 4 years ago)
- Last Synced: 2024-04-26T19:21:09.866Z (about 2 years ago)
- Topics: csharp, dotnet, nuget
- Language: C#
- Homepage:
- Size: 46.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.