Ps 17:1 Hear a just cause, O Lord, attend to my cry; give ear to my prayer which is not from deceitful lips.
:2 Let my vindication come from Your presence; let Your eyes look on the things that are upright.
:3 You have tested my heart; You have visited me in the night; You have tried me and found nothing; I have purposed that my mouth shall not transgress.
:4 Concerning the works of men, by the word of Your lips, I have kept away from the paths of the destroyer.
:5 Uphold my steps in Your paths, that my footsteps may not slip.
:6 I have called upon You, for You will hear me, O God; incline Your ear to me, and hear my speech.
:7 Show Your marvelous lovingkindness by Your right hand, O You who save those who trust in You from those who rise up against them.
:8 Keep me as the apple of Your eye; hide me under the shadow of Your wings,
:9 from my deadly enemies who surround me.
:10 They have closed up their fat hearts; with their mouths they speak proudly.
:11 They have now surrounded us in our steps; they have set their eyes, crouching down to the earth,
:12 as a lion is eager to tear his prey, and like a young lion lurking in secret places.
:13 Arise, O Lord, confront him, cast him down; deliver my life from the wicked with Your sword,
:14 with Your hand from men, O Lord, from men of the world who have their portion in this life, and whose belly You fill with Your hidden treasure. They are satisfied with children, and leave the rest of their possession for their babes.
:15 As for me, I will see Your face in righteousness; I shall be satisfied when I wake in Your likeness.
It seems all David wanted was for someone to hear his side of the story. His only way to defend himself was to tell God on them. He asked God to be the judge. God could examine the hearts of all involved so there is no better judge for David to go to or for us to go to. Are we ready to completely open our hearts for God to examine? David prayed in faith that God would hear and would actively intervene on his behalf. When is the last time you prayed like that? If we keep our life honest and pure, enemies will rise up and try to pull us down. Don't take revenge. Tell God on them and then watch His justice at work. So many times we want to revenge ourselves and God won't honor that.
Christians will stand before the Judge too. We will not stand for condemnation because that was taken by Jesus on the cross. We will appear for an evaluation of our lives. What we have done with the resources and abilities entrusted to us will come under the intense inspection of Jesus. We will receive reward or lose reward based on His evaluation. If we are truly living our life for Jesus we shouldn't dread that day.