Described is an apparatus for detecting and removing deposits from a surface exposed to wellbore fluids. The apparatus can monitor the rate of deposition and subsequently remove the deposited material. The combination of detection apparatus and removal apparatus provides an instrument with self-cleaning operation mode.