Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add health endpoint #459

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tigattack
Copy link
Contributor

Checks DB connection & lock status.

I'm largely unfamiliar with TS (and Mongo for that matter lol), but this change has achieved my goal and seems to function well. Hopefully it's suitable. Let me know what you think.

Responses

Connected and unlocked:

{
    "status": "ok",
    "db_health": {
        "status": "UP",
        "details": {
            "version": "6.0.19",
            "uptime": 6843,
            "writable": true
        }
    }
}

Connected and locked:

{
    "status": "warning",
    "db_health": {
        "status": "READONLY",
        "details": {
            "version": "6.0.19",
            "uptime": 7244,
            "writable": false
        },
        "message": "Database is read-only (fsyncLock enabled)"
    }
}

Disconnected:

{
    "status": "error",
    "db_health": {
        "status": "DOWN",
        "message": "Error querying database health"
    }
}

@tigattack
Copy link
Contributor Author

On second thoughts, perhaps READONLY should be WARNING... Open to thoughts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant