[GH-ISSUE #774] Feature Request: ping response body compatible with Prometheus format #542

Closed
opened 2026-02-25 23:42:49 +03:00 by kerem · 1 comment
Owner

Originally created by @fabricat on GitHub (Jan 13, 2023).
Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/774

I'd like to use your service in order to ensure that my Prometheus server is up. Unfortunately, since the ping response body is just OK, Prometheus does not recognize the format and marks the target as DOWN.

Despite the main goal (checking whether Prometheus is working) is achieved correctly, a small change (just add a fake value after "OK") could also avoid errors on Prometheus' side.

Can you make it possible to select an "output format", e.g. by accepting a format query parameter to the ping URL?

The code should be changed from this:
github.com/healthchecks/healthchecks@f849c5e1a1/hc/api/views.py (L84)
into something like this (sorry for the ugly code 😓 I am not a Python developer):

    content = "OK"
    if request.GET["format"] == "prometheus":
        content = "ping 1"  # ref. https://prometheus.io/docs/instrumenting/exposition_formats/
    response = HttpResponse(content)

That would be an enticing new feature, that only the best-in-class provide 😉

Originally created by @fabricat on GitHub (Jan 13, 2023). Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/774 I'd like to use your service in order to ensure that my [Prometheus](https://prometheus.io/) server is up. Unfortunately, since the ping response body is just `OK`, Prometheus does not recognize [the format](https://prometheus.io/docs/instrumenting/exposition_formats/) and marks the target as DOWN. Despite the main goal (checking whether Prometheus is working) is achieved correctly, a small change (just add a _fake value_ after "OK") could also avoid errors on Prometheus' side. Can you make it possible to select an "output format", e.g. by accepting a `format` query parameter to the ping URL? The code should be changed from this: https://github.com/healthchecks/healthchecks/blob/f849c5e1a1254541a06cacdb341a0153fa380232/hc/api/views.py#L84 into something like this (sorry for the ugly code 😓 I am not a Python developer): ```python content = "OK" if request.GET["format"] == "prometheus": content = "ping 1" # ref. https://prometheus.io/docs/instrumenting/exposition_formats/ response = HttpResponse(content) ``` That would be an enticing new feature, that only the best-in-class provide 😉
kerem closed this issue 2026-02-25 23:42:49 +03:00
Author
Owner

@cuu508 commented on GitHub (Jan 16, 2023):

Hi @fabricat, thanks for the suggestion!

I've considered this feature before, but ultimately decided against it – it would be a useful, but a niche feature. And I think it would be too niche to warrant the extra complexity. If I see ongoing demand for it, I will reconsider.

<!-- gh-comment-id:1383664141 --> @cuu508 commented on GitHub (Jan 16, 2023): Hi @fabricat, thanks for the suggestion! I've considered this feature before, but [ultimately decided against it](https://github.com/healthchecks/healthchecks/issues/577#issuecomment-1357286440) – it would be a useful, but a niche feature. And I think it would be too niche to warrant the extra complexity. If I see ongoing demand for it, I will reconsider.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/healthchecks#542
No description provided.