Let $(M^2,g)$ be a closed surface and let $X,Y\in C^{\infty}(TM)$ such that $[X,Y] = 0$. I am working on a problem where I have to deal with the following term $$g(\nabla_XX,\nabla_YY) - |\nabla_XY|^2_g.$$

If one thinks about the connection matrix of $\nabla$ this looks a lot like something related to the determinant of this matrix. Is this expression related to some characteristic class? For example, in the case $T^2$ is a torus, should its integral be zero?