Commit b655730
Add Healthcheck Endpoint for Service Monitoring (#2248)
#### What problem does this PR solve?
This PR introduces a new `GET /healthcheck` endpoint to provide a
standard mechanism for monitoring the application's health and
availability. This is a common requirement for running services in
production, allowing load balancers, container orchestrators (like
Kubernetes), and other monitoring tools to verify that the application
is running and responsive.
#### What is the solution?
1. **New Endpoint:** A `GET /healthcheck` route has been added.
2. **Response:** The endpoint returns a JSON response containing:
* `status`: Always `"ok"` to indicate the service is running.
* `build`: The git revision hash of the current build. This provides
essential diagnostic information for debugging and tracking deployed
versions without exposing sensitive system details.
3. **API Documentation:** The new endpoint is fully documented using
`OpenApiSpex`, and the specification is available via the Swagger UI.
4. **Testing:** A new test suite has been added to verify the endpoint's
functionality.
This approach provides a simple, fast, and secure liveness probe while
still offering valuable, non-sensitive build information.
Co-authored-by: Nate Shoemaker <[email protected]>1 parent 0215f78 commit b655730
File tree
4 files changed
+58
-1
lines changed- lib/nerves_hub_web
- controllers
- test/nerves_hub_web/controllers
4 files changed
+58
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
| 150 | + | |
150 | 151 | | |
151 | 152 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
82 | 87 | | |
83 | 88 | | |
84 | 89 | | |
| |||
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
0 commit comments