Psalm 40:10 (ESV)

10 I have not hidden your deliverance within my heart; I have spoken of your faithfulness and your salvation; I have not concealed your steadfast love and your faithfulness from the great congregation.

I (David) do not hide your goodness in my heart, just for me. No, I witness of your faithfulness and your help, such as can be seen in your deliverances of the hostile Saul and the wars against the Philistines. Those were all regularly deep pits, dangerous morasses. In the end, the Lord gave David the promised throne. The people heard about those signs of faithfulness. It is important that the people know which way the Lord has gone with the king, who is obviously so different from Saul. This new king talks freely about God’s actions. In him we see a shadow of the Prophet-King who is to come as Son and Lord of David, namely, the Messiah.