Creating Custom Metrics

How do I create a custom metric