Contains HealthChecks for JanusGraph, based on the nuget package `JanusGraph.Net`.
$ dotnet add package NetEvolve.HealthChecks.JanusGraphThis package provides a health check for JanusGraph databases, based on the JanusGraph.Net package. The main purpose is to check if the database is available and if the database is online.
:bulb: This package is available for .NET 8.0 and later.
To use this package, you need to add the package to your project. You can do this by using the NuGet package manager or by using the dotnet CLI.
dotnet add package NetEvolve.HealthChecks.JanusGraph
The health check is a liveness check. It checks if the JanusGraph Server is available and if the database is online.
If the query needs longer than the configured timeout, the health check will return Degraded.
If the query fails, for whatever reason, the health check will return Unhealthy.
After adding the package, you need to import the namespace and add the health check to the health check builder.
using NetEvolve.HealthChecks.JanusGraph;
Therefore, you can use two different approaches. In both approaches you have to provide a name for the health check.
name: The name of the health check. The name is used to identify the configuration object. It is required and must be unique within the application.options: The configuration options for the health check. If you don't provide any options, the health check will use the configuration based approach.tags: The tags for the health check. The tags janusgraph and graph are always used as default and combined with the user input. You can provide additional tags to group or filter the health checks.The first one is to use the configuration based approach. This approach is recommended if you have multiple JanusGraph instances to check.
var builder = services.AddHealthChecks();
builder.AddJanusGraph("<name>");The configuration looks like this:
{
..., // other configuration
"HealthChecks": {
"JanusGraph": {
"<name>": {
"Timeout": "<timeout>" // optional, default is 100 milliseconds
}
}
}
}The second approach is to use the builder based approach. This approach is recommended if you only have one JanusGraph instance to check or dynamic programmatic values.
var builder = services.AddHealthChecks();
builder.AddJanusGraph("<name>", options =>
{
options.Timeout = "<timeout>"; // optional, default is 100 milliseconds
});var builder = services.AddHealthChecks();
builder.AddJanusGraph("<name>", options => ..., "JanusGraph", "database");This project is licensed under the MIT License - see the LICENSE file for details.