terminus
terminus copied to clipboard
How to return all rejected health checks?
Expected behavior
Have some health indicators for database, Redis and Rabbit:
import { Get, Controller } from '@nestjs/common';
import {
HealthCheck,
HealthCheckResult,
HealthCheckService,
HealthIndicatorResult,
TypeOrmHealthIndicator,
} from '@nestjs/terminus';
import { RedisHealthIndicator } from '@/services/health/redis.health';
import { RabbitHealthIndicator } from '@/services/health/rabbit.health';
@Controller('system')
export class SystemController {
public constructor(
private readonly health: HealthCheckService,
private readonly db: TypeOrmHealthIndicator,
private readonly redisHealthIndicator: RedisHealthIndicator,
private readonly rabbitHealthIndicator: RabbitHealthIndicator,
) {}
@Get('healthcheck')
@HealthCheck()
public check(): Promise<HealthCheckResult> {
return this.health.check([
(): Promise<HealthIndicatorResult> => this.db.pingCheck('database'),
(): Promise<HealthIndicatorResult> =>
this.redisHealthIndicator.isHealthy(),
(): Promise<HealthIndicatorResult> =>
this.rabbitHealthIndicator.isHealthy(),
]);
}
}
In case I turn off both Redis and Rabbit this healthcheck endpoint will return only one first rejected health indicator in "error" object:
{ "status": "error", "info": { "database": { "status": "up" } }, "error": { "status": "down", "details": "Rabbit check failed: socket hang up" }, "details": { "database": { "status": "up" }, "status": "down", "details": "Rabbit check failed: socket hang up" } }
As you can see there is no any word about Redis health indicator in response. Is there any chance to return all health indicators?
Could you be more specific about the Pantheon API you are attempting to call? (This doesn't look like a Terminus issue)
Could you be more specific about the Pantheon API you are attempting to call? (This doesn't look like a Terminus issue)
edited
Unfamiliar with this code. This doesn't look like a Terminus issue.
This is not Pantheon Terminus related.