David continues his song to Yahweh.
I have kept the ways of Yahweh
Here "the ways" refers to the ways Yahweh wants his people to act. This means David has done what Yahweh commands.
have been before me
This means David constantly reads and thinks about God's decrees.