Let $\phi:Y\to X$ be a morphism of $\Bbbk$-varieties. In Görtz and Wedhorn's Algebraic Geometry 1, the ramification index is defined by
$e_Q(Y) := \mathrm{length}_{\mathcal{O}_{Y,Q}}\left(\mathcal{O}_{Y,Q}\right)$
and then $e_{Q/P} := e_Q(Y_P)$ where $Y_P$ is the scheme-theoretic fiber of $P\in X$ under $\phi$, i.e. $Y_P=Y\times_X\mathrm{Spec}(\Bbbk(P))$. For points of codimension one and assuming that $X$ and $Y$ are smooth, I know a different definition: Namely, let $f$ be a uniformizing parameter at $P$, i.e. $\mathfrak{m}_P=(f)$ is the unique maximal ideal of $\mathcal{O}_{X,P}$. Let $v_Q:\Bbbk(Y)\to\mathbb{Z}$ be the valuation corresponding to $\mathcal{O}_{Y,Q}$. Then,
$e_{Q/P} = v_Q(\phi^\sharp_Q(f))$
where $\phi^\sharp_Q: \mathcal{O}_{X,P} \to \mathcal{O}_{Y,Q}$ is the induced map. I would like to know why these two definitions coincide (in codimension one). I frankly don't even have an idea where to start.