Design metrics that provide actionable insights while maintaining system efficiency. Follow these key principles: 1. Track success and failure counts instead of just total counts to enable error rate calculations
Design metrics that provide actionable insights while maintaining system efficiency. Follow these key principles:
Example:
// Good: Track success/failure separately
pub static OPERATION_SUCCESS: Counter = register_counter!(
"operation_success_total",
"Number of successful operations"
);
pub static OPERATION_FAILURES: Counter = register_counter!(
"operation_failure_total",
"Number of failed operations"
);
// Bad: High cardinality with too many labels
pub static REQUESTS: CounterVec = register_counter_vec!(
"requests_total",
"Request count",
&["endpoint", "user_id", "session_id"] // Too many dimensions
);
// Good: Focused dimensions
pub static REQUESTS: CounterVec = register_counter_vec!(
"requests_total",
"Request count",
&["endpoint", "status"] // Key dimensions only
);
Enter the URL of a public GitHub repository