Documentation
    Preparing search index...

    Type Alias HealthCheckReport

    The health check report generated by the health check runner. Contains the overall status and results of all executed health checks.

    import { HealthChecks } from '@adonisjs/health'
    import { DiskSpaceCheck, MemoryHeapCheck } from '@adonisjs/health/checks'

    const healthChecks = new HealthChecks()
    healthChecks.register([
    new DiskSpaceCheck().warnWhenExceeds(70).failWhenExceeds(85),
    new MemoryHeapCheck().warnWhenExceeds('200 mb')
    ])

    const report: HealthCheckReport = await healthChecks.run()

    console.log(report.isHealthy) // true or false
    console.log(report.status) // 'ok' | 'warning' | 'error'
    console.log(report.checks.length) // 2
    console.log(report.debugInfo.pid) // Process ID

    // Check individual results
    report.checks.forEach(check => {
    console.log(`${check.name}: ${check.status}`)
    if (check.isCached) {
    console.log('Result was cached')
    }
    })
    type HealthCheckReport = {
        isHealthy: boolean;
        status: "ok" | "warning" | "error";
        finishedAt: Date;
        debugInfo: {
            pid: number;
            ppid?: number;
            uptime: number;
            version: string;
            platform: string;
        };
        checks: ({ isCached: boolean; name: string } & HealthCheckResult)[];
    }
    Index

    Properties

    isHealthy: boolean

    Is the entire report healthy. The value will be set to false when one or more of the checks has a status or "error"

    status: "ok" | "warning" | "error"

    Status of the entire report.

    • Set to "ok" when all checks have ok status
    • Set to "warning" when one or more checks have warning status
    • Set to "error" when one or more checks have error status
    finishedAt: Date

    The date/time when the entire report was computed

    debugInfo: {
        pid: number;
        ppid?: number;
        uptime: number;
        version: string;
        platform: string;
    }

    The debugging info for the running process

    Type Declaration

    • pid: number

      The process id

    • Optionalppid?: number

      The process id for the parent process (if any)

    • uptime: number

      The number of seconds for which the process has been running.

    • version: string

      Node.js version

    • platform: string

      The platform on which the application is running

    checks: ({ isCached: boolean; name: string } & HealthCheckResult)[]

    Perform checks and their report