From 2d7f3cbf6a88225ce3f9d002d17f5337c4d4fc86 Mon Sep 17 00:00:00 2001 From: ltdk Date: Mon, 25 May 2026 14:23:34 -0400 Subject: [PATCH] Emit network address in health events --- modules/caddyhttp/reverseproxy/healthchecks.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/caddyhttp/reverseproxy/healthchecks.go b/modules/caddyhttp/reverseproxy/healthchecks.go index f3515a326..34cc0da75 100644 --- a/modules/caddyhttp/reverseproxy/healthchecks.go +++ b/modules/caddyhttp/reverseproxy/healthchecks.go @@ -474,7 +474,7 @@ func (h *Handler) doActiveHealthCheck(dialInfo DialInfo, hostAddr string, networ if upstream.activeHealthFails() >= h.HealthChecks.Active.Fails { // dispatch an event that the host newly became unhealthy if upstream.setHealthy(false) { - h.events.Emit(h.ctx, "unhealthy", map[string]any{"host": hostAddr}) + h.events.Emit(h.ctx, "unhealthy", map[string]any{"host": hostAddr, "addr": networkAddr}) upstream.resetHealth() } } @@ -497,7 +497,7 @@ func (h *Handler) doActiveHealthCheck(dialInfo DialInfo, hostAddr string, networ if c := h.HealthChecks.Active.logger.Check(zapcore.InfoLevel, "host is up"); c != nil { c.Write(zap.String("host", hostAddr)) } - h.events.Emit(h.ctx, "healthy", map[string]any{"host": hostAddr}) + h.events.Emit(h.ctx, "healthy", map[string]any{"host": hostAddr, "addr": networkAddr}) upstream.resetHealth() } }