Skip to content

Conversation

@jranson
Copy link
Member

@jranson jranson commented Dec 8, 2025

this PR overhauls the Health Check Status Page with these improvements:

  • Replaces manual JSON body construction w/ a struct->marshal in JSON()
  • Extracts Text Output builder to a Tabular() function.
  • ^^ effectively separates the data structure construction from its Stringers.
  • Supports yaml output via ?yaml url param or Accept: application/yaml
  • Adds ALB and Pool health status to the outputs
    • an ALB is considered available if at least 1 pool member is available or unchecked.
  • Serves a Last-Modified header and supports 304 responses to If-Modified-Since requests.
  • adds updateLock mutex to updateStatusText to ensure it runs in singleton
  • Reorders the output order to Unavailable, Available, Unchecked, to ensure the most important section is first

Old Output (Plaintext)

Trickster Backend Health Status            last change: 2025-12-08 07:08:58 UTC
-------------------------------------------------------------------------------

prom1        prometheus   available

prom2        prometheus   unavailable since 2025-12-08 07:08:58 UTC

prom3        prometheus   not configured for automated health checks

-------------------------------------------------------------------------------

New Output (Plaintext)

Trickster Backend Health Status            last change: 2025-12-08 07:08:58 UTC
-------------------------------------------------------------------------------

prom2        prometheus   unavailable since 2025-12-08 07:08:58 UTC

prom1        prometheus   available
alb1         alb (tsm)    available u:[prom2] a:[prom1] nc:[prom3]

prom3        prometheus   not configured for automated health checks

-------------------------------------------------------------------------------

New Output (JSON)

{
  "title": "Trickster Backend Health Status",
  "updateTime": "2025-12-08 07:08:58 UTC",
  "unavailable": [
    {
      "name": "prom2",
      "provider": "prometheus",
      "downSince": "2025-12-08 07:08:58 UTC",
      "detail": "required status code mismatch, got [500] expected one of [200]"
    }
  ],
  "available": [
    {
      "name": "prom1",
      "provider": "prometheus"
    },
    {
      "name": "alb1",
      "provider": "alb",
      "mechanism": "tsm",
      "unavailablePoolMembers": [ "prom2" ],
      "availablePoolMembers": [ "prom1" ],
      "uncheckedPoolMembers": [ "prom3" ]
    }
  ],
  "unchecked": [
    {
      "name": "prom3",
      "provider": "prometheus"
    }
  ]
}

Fixes #876

Signed-off-by: James Ranson <[email protected]>
Signed-off-by: James Ranson <[email protected]>
Signed-off-by: James Ranson <[email protected]>
Signed-off-by: James Ranson <[email protected]>
@coveralls
Copy link

coveralls commented Dec 8, 2025

Pull Request Test Coverage Report for Build 20023376961

Details

  • 2 of 191 (1.05%) changed or added relevant lines in 4 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.5%) to 73.179%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/daemon/setup/setup.go 0 1 0.0%
pkg/proxy/headers/detect.go 0 3 0.0%
pkg/proxy/handlers/health/health.go 0 185 0.0%
Files with Coverage Reduction New Missed Lines %
pkg/proxy/engines/cache.go 2 92.42%
Totals Coverage Status
Change from base Build 20015258539: -0.5%
Covered Lines: 14993
Relevant Lines: 20488

💛 - Coveralls

Signed-off-by: James Ranson <[email protected]>
@jranson jranson merged commit 46c4ca5 into trickstercache:main Dec 8, 2025
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[feature request] Please include all backends at health uri (configured by mgmt.health_handler_path

3 participants