Skip to content

in_http: add configurable health endpoint #10441

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

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

Conversation

niedbalski
Copy link
Collaborator

@niedbalski niedbalski commented Jun 5, 2025

Add optional health endpoint accessible via GET /health when enabled.

The endpoint returns JSON with status, version, git hash and timestamp. Please note that this endpoint is disabled by default.

The health_check configuration directive enables the endpoint:

inputs:
  - name: http
    port: 9880
    health_check: true

When enabled, GET /health returns:

{
  "status": "ok",
  "version": "4.0.0", 
  "git_hash": "9e84b08f0b69bf27d3307c31e08de90b4395f5e1",
  "timestamp": "2025-06-05T15:43:17.398269000Z"
}

Fixes #10003
Supersedes PR #10020

edsiper and others added 2 commits February 26, 2025 21:16
This PR adds the /health endpoint that works through the GET method so remote
clients can check if the http service is up or not.

When accessed, it returns a JSON response like this:

 {
   "status": "ok",
   "message": "I can only show you the door. You're the one that has to walk through it.",
   "timestamp": "2025-02-27T03:15:42.477701772Z"
 }

Signed-off-by: Eduardo Silva <[email protected]>
Add optional health endpoint accessible via GET /health when enabled.
The endpoint returns JSON with status, version, git hash and timestamp
instead of the original Matrix movie quote. The endpoint is disabled
by default for security.

The health_check configuration directive enables the endpoint:
  health_check true

Fixes #10003
Supersedes PR #10020
Add tests for the new health endpoint functionality:
- health_endpoint: tests enabled health check returns 200 with JSON
- health_endpoint_disabled: tests disabled health check returns 400

The tests verify the health_check configuration directive works
correctly and that JSON response contains expected fields.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HTTP Input GET method should return "alive" or similar
2 participants