1.0 KiB
1.0 KiB
Health Thresholds
Configure thresholds for degraded and unhealthy states.
Threshold Configuration
builder.Services.AddStreamHealthChecks(options =>
{
// Consumer lag thresholds
options.DegradedConsumerLagThreshold = 1000;
options.UnhealthyConsumerLagThreshold = 10000;
// Stall detection
options.DegradedStalledThreshold = TimeSpan.FromMinutes(5);
options.UnhealthyStalledThreshold = TimeSpan.FromMinutes(15);
// Error rates
options.DegradedErrorRate = 5; // errors/min
options.UnhealthyErrorRate = 10; // errors/min
});
Environment-Specific Thresholds
var thresholds = builder.Environment.IsProduction()
? new HealthCheckOptions
{
DegradedConsumerLagThreshold = 10000,
UnhealthyConsumerLagThreshold = 100000
}
: new HealthCheckOptions
{
DegradedConsumerLagThreshold = 100,
UnhealthyConsumerLagThreshold = 1000
};
builder.Services.AddStreamHealthChecks(thresholds);