Passage
I will give thanks unto thee with uprightness of heart, When I learn thy righteous judgments.
I will give thanks unto thee with uprightness of heart, When I learn thy righteous judgments.
Psalms 119:5 Oh that my ways were established To observe thy statutes!
Psalms 119:6 Then shall I not be put to shame, When I have respect unto all thy commandments.
Psalms 119:7 I will give thanks unto thee with uprightness of heart, When I learn thy righteous judgments.
Psalms 119:8 I will observe thy statutes: Oh forsake me not utterly. BETH.
Psalms 119:9 Wherewith shall a young man cleanse his way? By taking heed [thereto] according to thy word.
The verse centers on "give", "thanks", "thee", "uprightness", "heart", "learn", "righteous", and "judgments". It is saying that the verse draws attention to "give" and "thanks", so its meaning should be read from those terms before moving to application.
The nearby context moves from verse 6's "Then shall I not be put to..." into verse 8's "I will observe thy statutes Oh forsake...", so "give" and "thanks" belong inside that flow. In Psalms context, the local focus is worship, trust, the LORD's kingship, and covenant mercy.
A plain takeaway is to answer the verse's own emphasis on "give" and "thanks" with trust shaped by these words, not by a vague optimism outside the passage.