What does this word mean and how to use it

what does this word mean and how to use it perfectly in sentence ?

“They were allowed to work overtime at discretion.”
“It is entirely within my discretion whether I will go or stay.”

You are allowed to respond to the Exchange request at your discretion and at your own risk.
It is entirely within your discretion whether you will try to learn more than one foreign language.