Pdsr.HealthChecks.Npgsql
2.2.3
See the version list below for details.
dotnet add package Pdsr.HealthChecks.Npgsql --version 2.2.3
NuGet\Install-Package Pdsr.HealthChecks.Npgsql -Version 2.2.3
<PackageReference Include="Pdsr.HealthChecks.Npgsql" Version="2.2.3" />
paket add Pdsr.HealthChecks.Npgsql --version 2.2.3
#r "nuget: Pdsr.HealthChecks.Npgsql, 2.2.3"
// Install Pdsr.HealthChecks.Npgsql as a Cake Addin #addin nuget:?package=Pdsr.HealthChecks.Npgsql&version=2.2.3 // Install Pdsr.HealthChecks.Npgsql as a Cake Tool #tool nuget:?package=Pdsr.HealthChecks.Npgsql&version=2.2.3
Pdsr HealthChecks Libraries
Contains HealthChecks for OpenId-Connect, RedisCacheManager, Postgres, and RabbitMQ.
Getting Started
Health checks need to register in the DI container.
Redis Healthcheck
In the minimal API, use builder.Services
to add the extension method, AddRedisCacheManager
to IHealthChecksBuilder
.
var degradedThreshold = 50; // in milliseconds, response time higher than 50 will be considered degraded
var unhealthyThreshold = 100; // in milliseconds, response time higher than 100 will be considered unhealthy
builder.Services.AddHealthChecks()
.AddRedisCacheManager(degradedThreshold,unhealthyThreshold);
Memory HealthCheck
You can define a memory usage limit for the MemoryHealthCheck
In the minimal API, use builder.Services
to add the extension method, AddMemoryHealthCheck
to IHealthChecksBuilder
builder.Services.AddHealthChecks()
.AddMemoryHealthCheck(
degradedThreshold: 50 * 1024L * 1024L, // shows degraded at this 50 MB
unhealthyThreshold: 100 * 2048L * 2048L, // threshold to show failureStatus (unhealthy), 100MB
failureStatus: HealthStatus.Unhealthy, // default failure status is HealthStatus.Unhealthy
tags: new string[] { "memory", "ram" }); // optional tags
Health Publisher
The interface ISystemHealth
and the abstract class SystemHealthBase
are available to be used as publisher.
you need to inherit from SystemHealthBase
:
public class MyHealthStatus : SystemHealthBase
{
// some custom properties
}
Register in DI container
builder.Services.RegisterReadinessPublisher<MyHealthStatus>();
The instance of MyHealthStatus
is available through injection.
public class SomeService : ISomeService
{
private readonly MySystemHealth _mySystemHealth;
public SomeService(MySystemHealth mySystemHealth)
{
_mySystemHealth = _mySystemHealth;
}
public void SomeMethod()
{
var health = _mySystemHealth.HealthReport;
// do whatever you like with that health status.
}
}
Samples
Refer to the samples folder.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 7.0.11)
- Pdsr.HealthChecks (>= 2.2.3)
-
net7.0
- Npgsql.EntityFrameworkCore.PostgreSQL (>= 7.0.11)
- Pdsr.HealthChecks (>= 2.2.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.