There's not a fixed rule. I'm sure you could find an expected timeline, but it really is 100% personal preference. What is your minimum standard of performance for carpet? Does you carpet still do that?
Personally, as long as it's physically intact, it's stil ok for me. If it's physically ok, but stained or dirty: Try doing one of those steam clean runs (you can rent a machine at Home Depot) and some spot cleaning. That might get you a couple more years out of it.
Once the carpet is damaged or worn to where you can no longer tolerate it, get some new stuff. It will get there.
If you want some more opinions, try posting some pictures and more details? How old is the carpet? Do you have kids / pets?