Macroscopic superconducting components are an important building block of various quantum circuits. Since several of the envisioned applications require exposure to magnetic fields, it is of utmost importance to explore the impact of magnetic fields on their performance. Here we explore the complex pattern of magnetic field penetration and identify its impact on the resonance frequency of NbTiN superconducting resonators by combining magneto-optical imaging and high-frequency measurements. At temperatures below approximately half of the superconducting critical temperature, the development of magnetic flux avalanches manifests itself as a noisy response in the field-dependent resonance frequency. Magneto-optical imaging reveals different regimes and distinguishes the impact of avalanches in the ground plane and resonator. Our findings demonstrate that superconducting resonators represent a valuable tool to investigate magnetic flux dynamics. Moreover, the current blooming of niobium-based superconducting radio-frequency devices makes this report timely by unveiling the severe implications of magnetic flux dynamics.