caddy icon indicating copy to clipboard operation
caddy copied to clipboard

reverseproxy: Add upstreams healthy metrics

Open david-szabo97 opened this issue 3 years ago • 2 comments

Adds a new metric that tracks the health status of reverse proxy upstreams.

# HELP caddy_reverse_proxy_upstreams_healthy Health status of reverse proxy upstreams.
# TYPE caddy_reverse_proxy_upstreams_healthy gauge
caddy_reverse_proxy_upstreams_healthy{upstream="localhost:8080"} 1
caddy_reverse_proxy_upstreams_healthy{upstream="localhost:8081"} 0

Metric:

  • Name: caddy_reverse_proxy_upstreams_healthy
  • Type: gauge
  • Values:
    • 1 - the upstream is healthy
    • 0 - the upstream is unhealthy
  • Labels:
    • upstream - Address of the upstream

Example Grafana panel: image

Partially resolves https://github.com/caddyserver/caddy/issues/4140

david-szabo97 avatar Aug 07 '22 12:08 david-szabo97

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Aug 07 '22 12:08 CLAassistant

Looks cool! I'm not familiar with Prometheus so I'll let our in-house expert take a look if he has a chance :smiley:

I'll review the usage of the reverse proxy internals though.

mholt avatar Aug 07 '22 17:08 mholt

@hairyhenderson I know you're busy so I won't require a review from you to merge this! Let me know if you want me to hold off so you can review, otherwise I will probably just merge it in.

mholt avatar Aug 18 '22 16:08 mholt

Great, thank you for the contribution @david-szabo97 !

mholt avatar Aug 27 '22 18:08 mholt

I'm not a big fan of the hard-coded 10s delay between metric updates. I would personally like a shorter delay so metrics (and consequently alarms) are more precise, thus a way to configure that would be greatly appreciated! Awesome work nonetheless :)

HeCorr avatar Feb 06 '23 18:02 HeCorr