[Analysis] Add new thresholds config schema

Generalize the threshold schema to support arbitrary metrics.
This is part of migrating to the new schema.
The old bug_filing_threshold and priorities.threshold will be removed once the migration is done.

Bug: None
Change-Id: I7d79b2f43a6ce7ad187fd1e75663d0629723325f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/306560
Reviewed-by: Christoffer Jansson <jansson@webrtc.org>
Commit-Queue: Beining Chen <beining@google.com>
Cr-Commit-Position: refs/heads/main@{#40145}
diff --git a/infra/config/luci-analysis.cfg b/infra/config/luci-analysis.cfg
index af2ef46..fa6dc4f 100644
--- a/infra/config/luci-analysis.cfg
+++ b/infra/config/luci-analysis.cfg
@@ -12,6 +12,24 @@
     one_day: 500
   }
 }
+# TODO(beining): WIP. This is going to replace bug_filling_threshold.
+bug_filing_thresholds {
+  metric_id: "human-cls-failed-presubmit"
+  threshold {
+    # clusters blocking developers should have bugs filed.
+    one_day: 3
+  }
+}
+bug_filing_thresholds {
+  metric_id: "test-runs-failed"
+  threshold {
+    # clusters that aren't blocking developers but are failing a significant
+    # amount of tasks should have bugs filed to look into optimizing machine
+    # resource usage.
+    one_day: 500
+  }
+}
+
 clustering {
   test_name_rules {
     name: "Google Test (Type-parameterized)"
@@ -39,6 +57,13 @@
         one_day: 20
       }
     }
+    # TODO(beining): WIP. This is going to replace threshold.
+    thresholds {
+      metric_id: "human-cls-failed-presubmit"
+      threshold {
+        one_day: 20
+      }
+    }
   }
   priorities {
     priority: "1"
@@ -47,6 +72,13 @@
         one_day: 10
       }
     }
+    # TODO(beining): WIP. This is going to replace threshold.
+    thresholds {
+      metric_id: "human-cls-failed-presubmit"
+      threshold {
+        one_day: 10
+      }
+    }
   }
   priorities {
     priority: "2"
@@ -55,6 +87,13 @@
         one_day: 2
       }
     }
+    # TODO(beining): WIP. This is going to replace threshold.
+    thresholds {
+      metric_id: "human-cls-failed-presubmit"
+      threshold {
+        one_day: 2
+      }
+    }
   }
   priorities {
     priority: "3"
@@ -68,6 +107,21 @@
         seven_day: 1
       }
     }
+    # TODO(beining): WIP. This is going to replace threshold.
+    # Clusters which fail to meet this threshold will be closed.
+    thresholds {
+      metric_id: "test-runs-failed"
+      threshold {
+        one_day: 2
+      }
+    }
+    thresholds {
+      metric_id: "human-cls-failed-presubmit"
+      threshold {
+        one_day: 1
+        seven_day: 1
+      }
+    }
   }
   priority_hysteresis_percent: 50
   monorail_hostname: "bugs.chromium.org"