CONTEXT: This individual lament psalm focuses on the brevity of human life. The psalmist suffers because of sin (see note on 38:title–22; note on 38:11). He intended to remain silent but was unable to do so (vv. 1–3). He emphasizes the brevity of life and prays for Yahweh to reveal when he will die (vv. 4–6). He affirms his trust in Yahweh and asks Him for deliverance (vv. 7–8). The psalmist attributes his suffering to Yahweh’s discipline (vv. 9–11) and asks Yahweh to hear him and turn His discipline away (vv. 12–13). – Faithlife Study Bible
Why is it David is petitioning God for here in v.4 “Lord, let me know my [life’s] end… ” at first glance it seems he wants to inside tract on when he is doomed so he can plan to live a full life prior to that. I think that is what most folks would do, if they found out they were going to die Dec 8th 2030 they would party hardy up till just before then, some until 11:59 pm on the 7th.
But David (and all wise men) had other ideas he finishes v.4 with; … And [to appreciate] the extent of my days; Let me know how frail I am [how transient is my stay here]. He is in effect saying, God I need you to show me how really frail and weak I really am.
Remember this is KING DAVID, oh that all leaders would be so wise. Toi know and understand the limits of there power the true fragility of their existence and the sovereignty of God. May we all pray they come to their senses.