"what was right in Yahweh's judgment" or "what Yahweh his God considers to be right"
David had done what is right.