Atomistic understanding of sensor mechanisms: Spectroscopic studies at prototype electronic and ionic conductors