Most manufacturers of gas-fired equipment such as a gas-fired heating system require a sediment trap (or dirt leg). The sediment trap protects the appliance from debris in the gas - such as dirt, soil, pipe chips, pipe joint tapes and compounds, and construction site debris that may enter the pipe during installation or repair.
Sediment traps are designed to cause the gas flow to change direction 90 degrees at the sediment collection point. The change in direction causes the contaminants to drop out of the gas flow.
The sediment trap utilizes a tee fitting. The nipple and cap must not be located in the branch opening of a tee fitting, because this wouldn’t allow the change in direction. Contaminants would pass right through the fitting and not drop out.
Three inches is commonly used as the length of the nipple.
The sediment trap should be downstream of the shutoff valve and within 6 feet of the appliance. This allows the trap to be serviced after the valve is closed.
This is a picture of a sediment trap that does not change the direction of the gas flow. Improper installation.