## RECORDING RULES

### 例子

instance_path:requests:rate5m =  rate(requests_total{job="myjob"}[5m])path:requests:rate5m =  sum without (instance)(instance_path:requests:rate5m{job="myjob"})

instance_path:request_failures:rate5m =  rate(request_failures_total{job="myjob"}[5m])instance_path:request_failures_per_requests:ratio_rate5m =    instance_path:request_failures:rate5m{job="myjob"}  /    instance_path:requests:rate5m{job="myjob"}// Aggregate up numerator and denominator, then divide to get path-level ratio.path:request_failures_per_requests:ratio_rate5m =    sum without (instance)(instance_path:request_failures:rate5m{job="myjob"})  /    sum without (instance)(instance_path:requests:rate5m{job="myjob"})// No labels left from instrumentation or distinguishing instances,// so we use 'job' as the level.job:request_failures_per_requests:ratio_rate5m =    sum without (instance, path)(instance_path:request_failures:rate5m{job="myjob"})  /    sum without (instance, path)(instance_path:requests:rate5m{job="myjob"})

instance_path:request_latency_seconds_count:rate5m =  rate(request_latency_seconds_count{job="myjob"}[5m])instance_path:request_latency_seconds_sum:rate5m =  rate(request_latency_seconds_sum{job="myjob"}[5m])instance_path:request_latency_seconds:mean5m =    instance_path:request_latency_seconds_sum:rate5m{job="myjob"}  /    instance_path:request_latency_seconds_count:rate5m{job="myjob"}// Aggregate up numerator and denominator, then divide.path:request_latency_seconds:mean5m =    sum without (instance)(instance_path:request_latency_seconds_sum:rate5m{job="myjob"})  /    sum without (instance)(instance_path:request_latency_seconds_count:rate5m{job="myjob"})

job:request_latency_seconds_count:avg_rate5m =  avg without (instance, path)(instance:request_latency_seconds_count:rate5m{job="myjob"})