Skip to content

feat: immediate start HTTP server in DLE and provide the actual instance status (#307)

Artyom Kartasov requested to merge 307-immediate-start-api into master

Description

Provide immediate response and observability right after running the DLE instance

  • start DLE API and Local UI instance before running data retrieval
  • display a link to get support in logs in case of errors
  • provide actual instance status considering subsystems
  • provide data retrieval state and alerts

Related issue

#307 (closed)

Examples

Message in case of error

2021/12/01 12:51:33 main.go:64: [INFO]   If you have problems or questions, please contact our communities for help: https://postgres.ai/docs/questions-and-answers#where-to-get-help

Failed data retrieving

$ bin/dblab instance status

{
    "status": {
        "code": "WARNING",
        "message": "Subsystems that need attention: retrieving"
    },
    "engine": {
        "version": "v3.0.0-rc.1-2-g569dc27-20211201-1251",
        "startedAt": "2021-12-01T12:52:02Z",
        "telemetry": false
    },
    "cloning": {
        "expectedCloningTime": 0,
        "numClones": 0,
        "clones": []
    },
    "retrieving": {
        "mode": "logical",
        "status": "failed",
        "lastRefresh": "2021-12-01T12:51:55Z",
        "nextRefresh": null,
        "alerts": {
            "refresh_failed": {
                "level": "error",
                "message": "Failed to perform initial data retrieving: logical",
                "lastSeen": "2021-12-01T12:52:01.532127115Z",
                "count": 1
            }
        }
    },
    "provisioner": {
        "dockerImage": "postgresai/extended-postgres:11",
        "containerConfig": {
            "shm-size": "256MB"
        }
    },
    "pools": [
        {
            "name": "oldest5",
            "mode": "zfs",
            "dataStateAt": "",
            "status": "empty",
            "cloneList": [],
            "fileSystem": {
                "mode": "zfs",
                "compressRatio": 1,
                "size": "192 MiB",
                "free": "192 MiB",
                "used": "106 KiB",
                "dataSize": "12 KiB",
                "usedBySnapshots": "0 B",
                "usedByClones": "82 KiB"
            }
        }
    ]
}

Data retrieving in progress

$ bin/dblab instance status

{
    "status": {
        "code": "OK",
        "message": "Instance is ready"
    },
    "engine": {
        "version": "v3.0.0-rc.1-2-g569dc27-20211201-1251",
        "startedAt": "2021-12-01T12:54:11Z",
        "telemetry": false
    },
    "cloning": {
        "expectedCloningTime": 0,
        "numClones": 0,
        "clones": []
    },
    "retrieving": {
        "mode": "logical",
        "status": "refreshing",
        "lastRefresh": "2021-12-01T12:54:01Z",
        "nextRefresh": null,
        "alerts": {}
    },
    "provisioner": {
        "dockerImage": "postgresai/extended-postgres:11",
        "containerConfig": {
            "shm-size": "256MB"
        }
    },
    "pools": [
        {
            "name": "oldest5",
            "mode": "zfs",
            "dataStateAt": "",
            "status": "refreshing",
            "cloneList": [],
            "fileSystem": {
                "mode": "zfs",
                "compressRatio": 1,
                "size": "192 MiB",
                "free": "192 MiB",
                "used": "106 KiB",
                "dataSize": "12 KiB",
                "usedBySnapshots": "0 B",
                "usedByClones": "82 KiB"
            }
        }
    ]
}

Successful data retrieving

$ bin/dblab instance status

{
    "status": {
        "code": "OK",
        "message": "Instance is ready"
    },
    "engine": {
        "version": "v3.0.0-rc.1-2-g569dc27-20211201-1251",
        "startedAt": "2021-12-01T12:54:55Z",
        "telemetry": false
    },
    "cloning": {
        "expectedCloningTime": 0,
        "numClones": 0,
        "clones": []
    },
    "retrieving": {
        "mode": "logical",
        "status": "finished",
        "lastRefresh": "2021-12-01T12:54:01Z",
        "nextRefresh": null,
        "alerts": {}
    },
    "provisioner": {
        "dockerImage": "postgresai/extended-postgres:11",
        "containerConfig": {
            "shm-size": "256MB"
        }
    },
    "pools": [
        {
            "name": "oldest5",
            "mode": "zfs",
            "dataStateAt": "2021-12-01 12:54:07 +0000 UTC",
            "status": "active",
            "cloneList": [],
            "fileSystem": {
                "mode": "zfs",
                "compressRatio": 4.55,
                "size": "192 MiB",
                "free": "164 MiB",
                "used": "28 MiB",
                "dataSize": "121 MiB",
                "usedBySnapshots": "0 B",
                "usedByClones": "180 KiB"
            }
        }
    ]
}

Checklist

  • the MR description has been reviewed
  • this MR contains text changes and they have been reviewed OR there are no texts changes
  • this MR contains GUI/CLI changes and they have been reviewed OR there are no GUI/CLI changes
  • this MR contains API changes, specifications reflect those changes and they have been reviewed OR there are no API changes

Closes #307 (closed)

Edited by Artyom Kartasov

Merge request reports