A metric based approach to quantifying resilience