Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reverseproxy: Add upstreams healthy metrics #4935

Merged

Conversation

david-szabo97
Copy link
Contributor

@david-szabo97 david-szabo97 commented Aug 7, 2022

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 #4140

@CLAassistant
Copy link

CLAassistant commented Aug 7, 2022

CLA assistant check
All committers have signed the CLA.

@mholt
Copy link
Member

mholt commented Aug 7, 2022

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

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

@caddyserver caddyserver deleted a comment Aug 8, 2022
@caddyserver caddyserver deleted a comment Aug 8, 2022
Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good, thanks for the change! I'll leave it to Dave to do the final review if he has a chance.

modules/caddyhttp/reverseproxy/metrics.go Show resolved Hide resolved
modules/caddyhttp/reverseproxy/metrics.go Outdated Show resolved Hide resolved
modules/caddyhttp/reverseproxy/metrics.go Show resolved Hide resolved
modules/caddyhttp/reverseproxy/metrics.go Outdated Show resolved Hide resolved
modules/caddyhttp/reverseproxy/metrics.go Outdated Show resolved Hide resolved
@mholt mholt added the under review 🧐 Review is pending before merging label Aug 8, 2022
@mholt mholt added this to the 2.x milestone Aug 8, 2022
@mholt
Copy link
Member

mholt commented Aug 18, 2022

@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.

Copy link
Collaborator

@hairyhenderson hairyhenderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @david-szabo97, LGTM!

@mholt mholt removed the under review 🧐 Review is pending before merging label Aug 23, 2022
@mholt mholt modified the milestones: 2.x, v2.6.0-beta.1 Aug 23, 2022
@mholt mholt merged commit 0c57fac into caddyserver:master Aug 27, 2022
@mholt
Copy link
Member

mholt commented Aug 27, 2022

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

@HeCorr
Copy link

HeCorr commented Feb 6, 2023

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 :)

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.

Prometheus Metrics for reverse_proxy upstreams
5 participants