There's no single answer, but there's a reliable way to think about it. Four things generally decide it:
Age against expected lifespan.
A tank runs eight to twelve years, less with local hard water. Under six years, repair is almost always right. Past ten, you're spending money on a unit that's going to ask again soon. Between those, the other three factors decide it.
What actually failed.
Thermostats, heating elements, thermocouples, gas valves, and dip tubes are all straightforward repairs on a unit that's otherwise sound. A tank that has rusted through isn't repairable at any age, because the failure is the tank itself.
Where the leak is.
This one matters more than people expect. Water at a fitting, a valve, or a connection is usually a repair. Water seeping from the body of the tank means corrosion has worked through the steel, and no repair fixes that.
How often it has needed attention.
One repair on a healthy unit is normal maintenance. A third service call in two years is the unit telling you something, and at that point, the repairs are financing a replacement in installments.
We Diagnose Before We Quote
A water heater has a handful of parts that fail and several that look like they failed. Testing the element, the thermostat, and the gas control takes a few extra minutes and saves replacing something that was working fine. You get told what failed and why, not just what it costs.
Sediment Gets Addressed, Not Ignored
Hard water is the reason most heaters in California fall short of their rated lifespan, and sediment on the tank floor is what does it. When we're already there for a repair, flushing the tank is worth doing, and we'll tell you if yours has enough buildup to be shortening its life.