You might want to first carry out a unitary transformation $A(x)\mapsto U(x)A(x)U^\top(x)$, such that all diagonal elements are zero.$^\ast$
Then $A(x)=BC(x)-C(x)B$ with
$$B=\begin{pmatrix}
1&0&0\\
0&2&0\\
0&0&3
\end{pmatrix},\;\;
C_{ij}(x)=\begin{cases}
0&\text{if}\;i=j\\
\frac{A_{ij}(x)}{B_{ii}-B_{jj}}&\text{if}\;\;i\neq j.
\end{cases}
$$
$^\ast$ This is always possible for a traceless $A$, see for example https://math.stackexchange.com/q/267192/87355
For a $3\times 3$ real matrix the unitary has the two-parameter form
$$U(x)=\begin{pmatrix}
\cos\alpha(x)&\sin\alpha(x)&0\\
-\sin\alpha(x)&\cos\alpha(x)&0\\
0&0&1
\end{pmatrix}
\begin{pmatrix}
1&0&0\\
0&\cos\beta(x)&\sin\beta(x)\\
0&-\sin\beta(x)&\cos\beta(x)
\end{pmatrix}
.$$
You can solve first for $\alpha(x)$,
$$(\partial_x v_x) \cos ^2\alpha+(\partial_yv_y) \sin ^2\alpha+ (\partial_xv_y+\partial_y v_x)\sin\alpha\cos\alpha=0,$$
and then for $\beta(x)$.
For a $3\times 3$ matrix the unitary has the two-parameter form $$U(x)=\begin{pmatrix} \cos\alpha(x)&\sin\alpha(x)&0\\ -\sin\alpha(x)&\cos\alpha(x)&0\\ 0&0&1 \end{pmatrix} \begin{pmatrix} 1&0&0\\ 0&\cos\beta(x)&\sin\beta(x)\\ 0&-\sin\beta(x)&\cos\beta(x) \end{pmatrix} .$$ You can solve first for $\alpha(x)$, $$(\partial_1 v_1) \cos ^2\alpha+(\partial_2v_2) \sin ^2\alpha+ (\partial_1v_2+\partial_2 v_1)\sin\alpha\cos\alpha=0,$$ and then for $\beta(x)$.