There is a Weyl integration formula that deals with this problem. $\newcommand{\bR}{\mathbb{R}}$ Denote by $G_n$ the space of symmetric $n\times n$ real matrices. It states that for any $O(n)$-invariant $h:G_n\to \bR$ we have
$$ (2\pi)^{-\frac{n(n+1)}{4}} \int_{G_n} h(A) e^{-\frac{{\rm tr} A^2}{4}} dA $$
$$ =\frac{1}{Z_n}\int_{\mathbb{R}^n} h(\lambda_1,\dotsc, \lambda_n) e^{-\frac{1}{4} \sum_{j=1}^n \lambda_j^2} \; {\prod_{j<k}} |\lambda_j-\lambda_k| \; d\lambda_1\cdots d\lambda_n$$
where
$$Z_n =2^{\frac{n}{2}}n! \prod_{j=1}^n \Gamma(\frac{j}{2}).$$
Now, use this formula for
$$ h(A)= f(g(A))\, e^{\frac{{\rm tr} A^2}{4}}. $$
For more details see Appendix C of this paper and the references therein.