This library is the writer for the PortiaNet.HealthCheck.Reporter and saves all reported logs to the configured MongoDB Database.
You can install this tool from Nuget using Package Manager Console:
PM> Install-Package PortiaNet.HealthCheck.Writer.MongoDB
After adding the HealthCheck middleware to the application pipeline, you need to add this library to DI and configure it as you prefer.
using PortiaNet.HealthCheck.Writer;
var builder = WebApplication.CreateBuilder(args);
...
builder.Services.AddMongoDBWriter(options =>
{
options.DatabaseName = "HealthCheck"; // Default Database Name
options.ConnectionString = "mongodb://localhost:27017"; // Connection String to the MongoDB instance
options.MuteOnError = false; // To suppress/not suppress the internal errors like DB Connection or privilege exceptions
options.CollectionName = "RequestTracks"; // Default Collection Name
options.NodeName = "Main Node"; // When having different instances of one service, this parameter will help you to distinguish between their logs in the database
});
...