Let $(M,g)$ be a smooth manifold equipped with a metric tensor $g$, and $f\in C^\infty(M)$ a regular function (i.e., with nowhere vanishing differential).

Denote by $\mathrm{Hess}_g(f):=\nabla df$ the Hessian tensor of $f$ with respect to the metric $g$, and by $N_f:=f^{-1}(\{0\})$ the one-codimensional submanifold of $M$ determined by $f$.

QUESTION: how to characterise the functions $f$, with $\mathrm{Hess}_g(f)$ proportional to $g$? Do they belong to some well-known class? What about the submanifolds $N\subset M$, which can be written as $N=N_f$, for such an $f$?

By "proportional" I mean w.r.t. a conformal factor, and by "characterisation" I mean "what makes them special". The question may be restricted to the case when $g$ is flat.

**Motivating example.** Let $M=\mathbb{R}^2$ and $g$ the Euclidean metric. Then,
$$\mathrm{Hess}_g(f)=f_{xx}(dx)^2+f_{xy}dxdy+f_{yy}(dy)^2$$
is proportional to $g=(dx)^2+(dy)^2$ if and only if $f_{xy}=0$ and $f_{xx}=f_{yy}$, which means
$$
f=a(x^2+y^2)+bx+cy+d\, ,
$$
i.e., $f$ must be proportional to the square of the norm induced by $g$, plus some lower-order terms. I was wondering whether a similar result holds in general (of course, assuming $g$ to be flat).