Line data Source code
1 4 : (ns matchscore.api.health
2 : (:require
3 : [schemas.api.core :as api-schemas]))
4 :
5 :
6 4 : (defn health-handler
7 : {:malli/schema [:=> [:cat api-schemas/PublicRingRequest] api-schemas/RingResponse]
8 : :authz {:public? true}
9 : :summary "Health check"
10 : :description "Simple health check endpoint that returns the service status"}
11 : [request]
12 22 : (let [scheduler-health (some->
13 1 : request
14 : :goose
15 : :scheduler-health
16 0 : deref)]
17 4 : {:status 200
18 3 : :body (cond->
19 6 : {:status "ok"
20 : :service "matchscore-backend"
21 7 : :version (or (System/getenv "GIT_SHA") "unknown")}
22 1 : scheduler-health (assoc :scheduler
23 0 : (update
24 0 : scheduler-health
25 : :status
26 0 : #(some->
27 : %
28 0 : name))))}))
29 :
30 :
31 : ;; TODO: remove after Sentry verification
32 4 : (defn sentry-test-handler
33 : {:authz {:public? true}
34 : :summary "Sentry test — throws an unhandled exception to verify Sentry capture"}
35 : [_request]
36 7 : (throw (ex-info "Sentry test exception" {:source "manual-test"})))
|