Atomic spectroscopy on a chip