How do you know when to give up - on a sick kitty

I took Ms Kitty to the vet and had her put down. I hate myself for doing this. 17yrs and now she’s gone.