Example 7, Find the minimum and maximum values of the function $y=\frac{x^{2}+2 x+5}{x^{2}+4 x+5}$.
Solve by eliminating the denominator and organizing into a quadratic equation in $x$:
$$
\begin{array}{l}
(y-1) x^{2}+(4 y-2) x+5 y-5=0 \\
\triangle=-4 y^{2}+24 y-16
\end{array}
$$
Since $x$ is a real number,
$$
\begin{array}{l}
\therefore y_{\text {minimum }}=3-\sqrt{5}, y_{\text {maximum }}=3+\sqrt{5} \text { . } \\
\end{array}
$$