All water heaters whether gas or electric need to have a temperature and pressure relief valve (commonly called a T&P valve) in them. These valves are required because hot water heaters are in reality, pressurized tanks. T&P valves are there to reduce pressure inside the tank, if it builds up. Simply put, when water is heated, it expands, and pressure inside the tank increases so there has to be some way to relieve the pressure—or the tank could explode. As is obvious by the name, T&P valves monitor both the internal temperature and pressure inside a water heater. If either the temperature exceeds 210° F or the pressure rises above 150 psi, the valve should open in order to relieve the pressure.
Water dripping from the pipe connected to the T&P valve is a sign the valve could be failing. Even if there is no water dripping, the only way to tell if a T&P valve is working properly is to test it every couple of years.