[GH-ISSUE #345] API: Return Check status as an integer #262

Closed
opened 2026-02-25 23:41:49 +03:00 by kerem · 3 comments
Owner

Originally created by @jameskirsop on GitHub (Mar 23, 2020).
Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/345

As part of my work in building a Grafana integration, I've been working towards adding a linear integer representation of the check.get_status() result in addition to the text value. Having a linear scale is important for being able to appropriately colour the panel in Grafana.

Currently, I've built the following dict for pairing statuses on a linear scale:

status_ints = {
    "down": 0,
    "grace": 1,
    "started": 2,
    "paused": 3,
    "new": 3,
    "up": 4,
}

Do the integers I've chosen seem a logical representation - both in the pairing of paused/new, and their order along the scale? 0 being the most problematic and severity inversely decreasing as the numbers get higher.

This work is found on a branch which I'll issue a PR for if we can agree on the order!

Originally created by @jameskirsop on GitHub (Mar 23, 2020). Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/345 As part of my work in [building a Grafana integration](https://github.com/jameskirsop/grafana-healthchecksio-datasource), I've been working towards adding a linear integer representation of the `check.get_status()` result in addition to the text value. Having a linear scale is important for being able to appropriately colour the panel in Grafana. Currently, I've built the following `dict` for pairing statuses on a linear scale: ``` status_ints = { "down": 0, "grace": 1, "started": 2, "paused": 3, "new": 3, "up": 4, } ``` Do the integers I've chosen seem a logical representation - both in the pairing of paused/new, and their order along the scale? 0 being the most problematic and severity inversely decreasing as the numbers get higher. This work is [found on a branch](https://github.com/jameskirsop/healthchecks/tree/Integer-Statuses) which I'll issue a PR for if we can agree on the order!
kerem 2026-02-25 23:41:49 +03:00
  • closed this issue
  • added the
    feature
    label
Author
Owner

@jameskirsop commented on GitHub (Apr 14, 2020):

@cuu508, do you have thoughts on this scale/order of status?

<!-- gh-comment-id:613189252 --> @jameskirsop commented on GitHub (Apr 14, 2020): @cuu508, do you have thoughts on this scale/order of status?
Author
Owner

@cuu508 commented on GitHub (Apr 14, 2020):

The order looks logical.

I have a concern that this would be a fairly "niche" field, it would be sent in all API responses but potentially only be used in the Grafana datasource.

Would it not be possible to add the status_int field on the datasource side? Or are there problems with doing that?

<!-- gh-comment-id:613291447 --> @cuu508 commented on GitHub (Apr 14, 2020): The order looks logical. I have a concern that this would be a fairly "niche" field, it would be sent in all API responses but potentially only be used in the Grafana datasource. Would it not be possible to add the status_int field on the datasource side? Or are there problems with doing that?
Author
Owner

@jameskirsop commented on GitHub (May 26, 2020):

Sorry to leave this hanging for so long. I agree @cuu508 that it would be a pretty niche field, but I think having an integer scale would be of usefulness to other third-party data visualisation products, not just Grafana.

My current understanding of how Grafana works (at least in my current implementation based off their sample project) is that it takes the results from the 'source' API and presents those to the end user.

There may be ways of transforming these strings to integers on the datasource plugin's backend, but I've not yet worked out how that's possible - if it is.

It's possible to do this on a per-panel basis, but this would be a real pain for end users - as they'd have to do this every time they add a panel (or clone an existing one...).

<!-- gh-comment-id:633817388 --> @jameskirsop commented on GitHub (May 26, 2020): Sorry to leave this hanging for so long. I agree @cuu508 that it would be a pretty niche field, but I think having an integer scale would be of usefulness to other third-party data visualisation products, not just Grafana. My current understanding of how Grafana works (at least in my current implementation based off their sample project) is that it takes the results from the 'source' API and presents those to the end user. There may be ways of transforming these strings to integers on the datasource plugin's backend, but I've not yet worked out how that's possible - if it is. It's possible to do this on a per-panel basis, but this would be a real pain for end users - as they'd have to do this every time they add a panel (or clone an existing one...).
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#262
No description provided.