github.com/gramework/gramework@v1.8.1-0.20231027140105-82555c9057f5/healthchecks/hc.go (about) 1 package healthchecks 2 3 // Register both ping and healthcheck endpoints 4 func Register(r interface{}, collectors ...func() (statKey string, stats interface{})) error { 5 return doReg(r, collectors, true, true) 6 } 7 8 // RegisterPing registers ping endpoint 9 func RegisterPing(r interface{}) error { 10 return doReg(r, nil, true, false) 11 } 12 13 // RegisterHealthcheck registers healthcheck endpoint 14 func RegisterHealthcheck(r interface{}, collectors ...func() (statKey string, stats interface{})) error { 15 return doReg(r, collectors, false, true) 16 } 17 18 // ServeHealthcheck serves healthcheck 19 func ServeHealthcheck(collectors ...func() (statKey string, stats interface{})) func() interface{} { 20 return func() interface{} { 21 return check(collectors...) 22 } 23 }