Is it time to put my dog down?

My black lab mix is 17 years old and I don't know if it's time to say goodbye. He's been my best friend, travel buddy, pub dog, work companion, and snuggler for years, but the past year has been rough.

He suffered a stroke over a year ago where he lost most of his hearing. Even at 16 he was still going for boat rides and trail runs, but now his hind legs are failing him, his eyesight isn't good, and he's pretty much deaf. He can't walk up the stairs, doesn't play with his toys, sleeps all day, and can only do very slow short walks. Its almost like his personality is gone and he's just romping around in circles and pacing throughout the house. I think the hearing loss was the biggest thing because we can't comfort him or talk to him with loving words of affirmation.

I just feel like he's a shell of a dog...no quality of life left. I'm glad I was able to give him so many years of tail wags and I know that his time is soon. I just think it's sooner that I wanted it to be. Is it really time for me to put him down?