Thankfulness for both mercies and miseries

I will give to the LORD the thanks due to his righteousness,
and I will sing praise to the name of the LORD, the Most High.

—Psalm 7:17 ESV

From The Treasury of David:

To bless God for mercies is the way to increase them; to bless him for miseries is the way to remove them: no good lives so long as that which is thankfully improved; no evil dies so soon as that which is patiently endured. —William Dyer