In Chapter 4 from the book Theoretical Mechanics of Particles and Continua by A. L. Fetter and J. D. Walecka, it is solved the problem of a coupled pendulum system while considering small oscillations.
There, they say the number of degrees of freedom needed to describe the Lagrangian, are the infinitesimal displacements from equilibrium $\eta_1$ and $\eta_2$, corresponding to each pendulum mass.
My question is: why there are needed two degrees of freedom? Isn't the spring that is attached to both masses a constraint of motion that reduces the degrees of freedom to only one?
Actually, they explicitly write the following equation:
which is the equation of the change in length of the spring.
Thank you for any answers or suggestions!