My alarm did not ring, I have a Sony phone

You are probably using the stamina battery saving mode or Extended Standby Mode which prevents Sleep as Android from waking up the device ans so the alarm will not ring if this mode is enabled.
For stamina mode, you can either disable this mode or add Sleep as Android to the active applications in standby. The option resides in settings->Power management. To add Sleep as Android to the active applications in standby, click on “stamina mode”, then “Add applications” and check Sleep as Android.

To disable Extended Standby Mode, go to settings->Power management and then uncheck Extended Standby mode.