Two-dimensional dielectric microcavities are of widespread use in microoptics applications. Recently, a trace formula has been established for dielectric cavities which relates their resonance spectrum to the periodic rays inside the cavity. In the present paper we extend this trace formula to a dielectric disk with a small scatterer. This system has been introduced for microlaser applications, because it has long-lived resonances with strongly directional far field. We show that its resonance spectrum contains signatures not only of periodic rays, but also of diffractive rays that occur in Kellers geometrical theory of diffraction. We compare our results with those for a closed cavity with Dirichlet boundary conditions.