Not to offend anyone I hope but, if the O ring is shot, it hardly matters if you leave it in place and take the whole works into
the hardware store, or not. The helpful clerk will not be able to find you an exact match, or near exact, with the O ring in place.
You can measure the outside diameter as it is, but not the cross section. This is a seal that has to withstand some pretty good
pressure, so fit is important.
If it were me, I'd carefully cut the O ring in one place , with a sharp razor blade, and then remove it, and measure it.
You need the diameter, and the cross section. Or you can compare with available rings at the store. If they have them,
I'd get one as close as I can find, and one slightly larger in cross section.