You'll know it's time to leave your relationship if you've truly worked on yourself and how you respond in the relationship. If you're developing into the person you want to be in a relationship, you've removed yourself from the reactive equation and your partner isn't willing to join you, it's time to leave.
If you're staying because you're afraid to be alone, and haven't learned the value of being alone with yourself. If you fear you'll feel empty and scared alone, you're probably staying for the wrong reasons. In order to feel stronger and better about yourself, learn how to smile at fear and take the courageous first step on your own. One foot in front of the other, that's all it takes.
Immediate reasons for you to leave a relationship is when you're taking abuse - emotional or physical and afraid to leave. Or, if you are living with a bully, a narcissist or a partner that lies repeatedly. A healthy relationship is not based on fear, control or abuse in any form. You've got to be willing to see the truth and trust the path towards a more joyful and peaceful life. Don't settle with anyone out of fear.
Even the best relationships have disappointments, and managing them well is part of being a mature partner. So, a good self-care practice is to know the difference between these two places. Be your own best friend, and have your own back and leave if you feel it's the time. Trust there will be a better relationship for you.