Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Commit

Permalink
Add scaffolding for query param alert (#1187)
Browse files Browse the repository at this point in the history
  • Loading branch information
sethvargo authored Nov 24, 2020
1 parent 833cd4f commit 51c008a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/controller/healthz.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ func HandleHealthz(ctx context.Context, cfg *database.Config, h *render.Renderer
logger := logging.FromContext(ctx).Named("controller.HandleHealthz")

params := r.URL.Query()
if s := params.Get("service"); s == "database" {
switch service := params.Get("service"); service {
case "database":
if cfg == nil {
InternalError(w, r, h, fmt.Errorf("database not configured for health check"))
return
Expand All @@ -65,6 +66,10 @@ func HandleHealthz(ctx context.Context, cfg *database.Config, h *render.Renderer
return
}
}
case "alerts":
// TODO(ych): fire a metric and configure an alert
default:
logger.Warnw("unknown service", "service", service)
}

h.RenderJSON(w, http.StatusOK, map[string]string{"status": "ok"})
Expand Down

0 comments on commit 51c008a

Please sign in to comment.