Back to Graphql Engine

Source Health Check API Reference

docs/docs/api-reference/source-health.mdx

2.49.33.3 KB
Original Source

import ProductBadge from '@site/src/components/ProductBadge';

Source Health Check API Reference

<ProductBadge free pro ee />

Introduction

The Source Health API is an admin-only endpoint which reports the health of sources whose Health Check is configured. Documentation here.

Endpoint

All requests are GET requests to the /healthz/sources endpoint.

API Spec

Request

http
GET /healthz/sources HTTP/1.1
X-Hasura-Role: admin

Response

The response is an object with the source name as key and health status as value.

none
{
    "source_1": HealthStatus,
    "source_2": HealthStatus,
     ...        ...
    "source_n": HealthStatus

}

The HealthStatus is an object with the following members.

NameTypeDescription
statusstringThe status of the Health Check
errorany jsonAn additional field whose value varies based on the status
timestampstringA UTC time encoded value

Find the possible values of status field in the following along with corresponding error field value.

statuserrorDescription
"OK"nullHealth Check succeeded with configured test; the source is healthy
"TIMEOUT"nullHealth Check timed out
"ERROR"HealthCheckErrorExceptions occurred after running Health Check; refer error for in-depth details
"FAILED"StringHealth Check failed due to bad configuration

The HealthCheckError is an object with the following members.

NameTypeDescription
messagestringA very short description of the error
extraany jsonAn optional value that contains more details about the error

Sample response

http
HTTP/1.1 200 OK
Content-Type: application/json

{
  "mssql_source_name": {
    "error": null,
    "status": "OK",
    "timestamp": "2022-08-09T09:32:05.235347837Z"
  },
  "postgres_source_name": {
    "error": {
      "message": "connection error",
      "extra": "connection to server at \"localhost\" (::1), port 6432 failed: Connection refused\n\tIs the server running on that host and accepting TCP/IP connections?\nconnection to server at \"localhost\" (127.0.0.1), port 6432 failed: Connection refused\n\tIs the server running on that host and accepting TCP/IP connections?\n"
    },
    "status": "ERROR",
    "timestamp": "2022-08-09T09:30:05.235347837Z"
  }
}

:::info Note

The healthz/sources API endpoint cannot be disabled.

:::