Skip to content

PortiaNet/HealthCheck.Writer.MongoDB

Repository files navigation

Nuget

This library is the writer for the PortiaNet.HealthCheck.Reporter and saves all reported logs to the configured MongoDB Database.

Installation

You can install this tool from Nuget using Package Manager Console:

PM> Install-Package PortiaNet.HealthCheck.Writer.MongoDB

How do I get started?

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 
});
...

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages