This is a bit of an odd measurement and chimney clearance case because the chimney side is actually about 8 away from the roof edge.
Fireplace vent pipe clearance.
See fire clearances single wall metal flues vents for the clearance from combustibles required for flue vent connectors these are not chimneys but rather the flue pipe smoke pipe or stack pipe that connects a heating appliance to a chimney.
The general rule of thumb however is a 1 inch clearance all the way around for vertical vent runs.
Using a heat shield on a single wall stovepipe allows you to reduce the clearances from 18 to 6 to the wall and 9 to the ceiling.
Clearances for direct vent pipe may vary and these clearances will be specified by the manufacturer of your direct vent appliance.
This article gives typical clearance distance requirements between the termination cap of a gas fireplace or fireplace insert and other building or site features such as windows doors other mechanical system components air intakes exhausts.
Most of the double wall stove pipe allows for 6 clearance from wall combustibles and 8 from ceiling combustibles.
For non direct vent applications that is side wall venting only the required clearance is 7 feet.
The height of the chimney above the roof surface measured at the up slope side of the chimney from the roof surface to the chimney top should be at least three feet the green line in our photo.