Whenever you take damage, you gain 2% of that unmitigated damage as Attack Power. This Attack Power then decays over time, losing 5% of its value every second unless you dodge a melee attack. If you dodge a melee attack you will still gain Vengeance as if it had actually hit you. Note that this does not apply to "special attacks" that can also be dodged (Garalon's cleave for example). Blizzard has stated that all sources of damage now contribute to Vengeance instead of just melee attacks
. So things like magical damage, bleeds, and special attacks will also now grant Vengeance.