Skip to content

Commit

Permalink
feat: add healthy boolean field to indicators
Browse files Browse the repository at this point in the history
  • Loading branch information
temarusanov committed Apr 6, 2023
1 parent e779a3f commit d980277
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { HealthIndicator } from './interfaces/health-indicator.interface'

@Controller()
export class HealthChecksController {
private _logger = new Logger(HealthChecksController.name)
private _appStartedAt: number = Date.now()

@CustomInject<HealthIndicator>(HEALTH_CHECKS_PROVIDER, {
Expand All @@ -31,6 +30,7 @@ export class HealthChecksController {
const ratio = +(successfulServices / services.length).toFixed(2)

return {
healthy: successfulServices === services.length,
ratio,
uptime,
timestamp,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { HealthIndicatorResult } from './health-indicator-result.interface'

export interface HealthCheckResult {
healthy: boolean
ratio: number // ratio = (failed services / all services)
uptime: number
timestamp: number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ export type HealthIndicatorResult = {
name: string
status: HealthIndicatorStatus
error?: string
// eslint-disable-next-line @typescript-eslint/no-explicit-any
details?: Record<string, any>
}

0 comments on commit d980277

Please sign in to comment.