I don't think a retirement is an achievement. So we should not rate it as good or poor. For professional sportsmen the retirements comes in very young age. So its just the matter of setting the right priorities and figuring out what's up next.
I like the way Sampras retired and equally like the way Agassi retired. The way an athlete retires is a reflection of their personalities.
Sampras being the clear headed and focused person throughout his career, knew when and how he wanted to retire. For one last time he wanted to show his best on the surface that suited him the best and retire on a high note. But when he realized that he cannot give his best at wimbledon, he did not bother playing. He could have decided to play thinking he may get a lucky draw. But he was not after the trophy.
On the other hand as much as Agassi hated the game, he took very very long time to figure out what's next. So he just kept playing. What made his retirement memorable was his speech, and it did not matter at all that his retirement came in the 3rd round of US Open.
I think we should just leave it to the individual to decide when and how to retire. Even if someone keeps playing and never gets back to their peak level again, it does not undermine their achievements from the past.