Jeremiah lamented about the fatal day of destruction. He wanted to be healed and saved by Yahweh because he praised him. He was taunted by others for his connection to Yahweh. However, he had not run away from being a shepherd or leader in the service of Yahweh. He had not desired this fatal day of destruction. Yahweh knew what he had said in front of him. He did not want Yahweh to scare him on this future fatal day. Instead, he wanted his persecutors to be ashamed and dismayed, but not him. He wanted to bring on this fatal day to them with a double dose of destruction.
This psalm ends with a plea from David to save him from his persecutors. They were too strong for him. He could not deal with them himself. He wanted to be brought out of prison. There is no specific time mentioned in the stories of David where he was actually in a prison. This might be a metaphor since he feels like he cannot move. If he escaped he would give thanks to the name of Yahweh. He wanted to be surrounded by the righteous ones. He felt that Yahweh would deal with him mercifully and bountifully.