Skip to content

reverseproxy: Add upstreams healthy metrics#4935

Merged
mholt merged 6 commits into
caddyserver:masterfrom
david-szabo97:add/reverseproxy-healthy-metrics
Aug 27, 2022
Merged

reverseproxy: Add upstreams healthy metrics#4935
mholt merged 6 commits into
caddyserver:masterfrom
david-szabo97:add/reverseproxy-healthy-metrics

Conversation

@david-szabo97

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

Copy link
Copy Markdown
Contributor

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

CLAassistant commented Aug 7, 2022

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@mholt mholt requested a review from hairyhenderson August 7, 2022 16:36
@mholt

mholt commented Aug 7, 2022

Copy link
Copy Markdown
Member

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

@mholt mholt left a comment

Copy link
Copy Markdown
Member

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.

Comment thread modules/caddyhttp/reverseproxy/metrics.go
Comment thread modules/caddyhttp/reverseproxy/metrics.go Outdated
Comment thread modules/caddyhttp/reverseproxy/metrics.go
Comment thread modules/caddyhttp/reverseproxy/metrics.go Outdated
Comment thread modules/caddyhttp/reverseproxy/metrics.go Outdated
@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

mholt commented Aug 18, 2022

Copy link
Copy Markdown
Member

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

@hairyhenderson hairyhenderson left a comment

Copy link
Copy Markdown
Collaborator

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

mholt commented Aug 27, 2022

Copy link
Copy Markdown
Member

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

@HeCorr

HeCorr commented Feb 6, 2023

Copy link
Copy Markdown

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