The psalmist began to compare his life with those around him. He looked at the people that seemed to be prospering and became jealous, angry and short-changed. 
His response was to go to the sanctuary of God and meet with him. His perception was changed.
How often are we discouraged because we begin looking in the wrong places? Or when we begin to drift away from God?
The writer summed up what he learned with this scripture: But it is good for me to draw near to God: I have put my trust in the Lord God, that I may declare all that works. (Psalm 73:28)
If you are feeling down, draw near to God. Trust in him. He will remind you of his goodness. 
Scripture taken from: Psalm 73:1-28