On a class of first order Hamilton-Jacobi equations in metric spaces