Restore returning 200 OK on root prometheus path for health check (#1678)
Restore the support to return a 200 OK in the root prometheus endpoint (/) as stated in the documentation. This feature was lost when removing libpromhttp Fixes #1672
This commit is contained in:
parent
8a71069517
commit
de84ecefb1
@ -56,6 +56,11 @@ MHD_RESULT promhttp_handler(void *cls, struct MHD_Connection *connection, const
|
||||
body = prom_collector_registry_bridge(PROM_COLLECTOR_REGISTRY_DEFAULT);
|
||||
mode = MHD_RESPMEM_MUST_FREE;
|
||||
status = MHD_HTTP_OK;
|
||||
} else if (strcmp(url, "/") == 0) {
|
||||
// Return 200 OK for root path as a health check
|
||||
body = "ok";
|
||||
mode = MHD_RESPMEM_PERSISTENT;
|
||||
status = MHD_HTTP_OK;
|
||||
}
|
||||
|
||||
struct MHD_Response *response = MHD_create_response_from_buffer(strlen(body), body, mode);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user