Observing the origin of superconductivity in quantum critical metals