package health import ( "context" "runtime" "github.com/pkg/errors" ) func NewGoRoutinesCheck(threshold int) CheckFunc { return func(ctx context.Context) error { count := runtime.NumGoroutine() if count > threshold { return errors.Errorf("too many goroutines (%d > %d)", count, threshold) } return nil } }