Product viability is determined by SMART reports. However, I'm proactive with array health instead of reactive. I'd rather do maintenance on my schedule than having to do emergency procedures.
Assuming a drive didn't cause severe issues to cause immediate replacement... I used to replace drives around when their warranty ran out at 4 to 5 years, and before the severe issues could happen. However drives seem to have substantially shorter warranty periods now, so my approach is to replace a drive when I can double their size or close to 5 years, whichever comes first. I replaced 4TB drives with 8TB before 5 years. Added benefit was shortening parity check times.
My drives are around 2.5 years now, so likely will replace sometime late 2021 to early 2022 if they dont release 16TB before then.