[feedback] Better reboot metric

We want to track more reboot reasons and the uptime of the last boot.

Bug: 52903

Change-Id: I44233df11b5cf04184c7614309d7b9e4a8a1a088
Reviewed-on: https://fuchsia-review.googlesource.com/c/cobalt-registry/+/392742
Reviewed-by: Mitch Rudominer <rudominer@google.com>
Reviewed-by: Francois Rousseau <frousseau@google.com>
Commit-Queue: Alex Pankhurst <pankhurst@google.com>
diff --git a/fuchsia/feedback/metrics.yaml b/fuchsia/feedback/metrics.yaml
index 2b02304..876c10d 100644
--- a/fuchsia/feedback/metrics.yaml
+++ b/fuchsia/feedback/metrics.yaml
@@ -9,6 +9,7 @@
 #
 # Count of times the system rebooted.
 # We send the event upon reboot.
+# This metric is being phased out in favor of last_reboot_uptime.
 #####################################################################
 - id: 1
   metric_name: reboot
@@ -192,7 +193,7 @@
   meta_data:
     max_release_stage: GA
     expiration_date: "2020/08/27"
-    
+
 #####################################################################
 # bugreport_generation_duration_usecs
 #
@@ -272,3 +273,48 @@
     max_release_stage: GA
     expiration_date: "2021/05/15"
 
+#####################################################################
+# last_reboot_uptime
+#
+# The uptime of the last boot in microseconds and what caused the
+# device to reboot.
+# We send the event once after a reboot.
+#####################################################################
+- id: 8
+  metric_name: last_reboot_uptime
+  metric_type: ELAPSED_TIME
+  metric_dimensions:
+    - dimension: reason
+      event_codes:
+        0: Unknown
+        1: GenericGraceful
+        2: GenericUngraceful
+        3: Cold
+        4: BriefPowerLoss
+        5: Brownout
+        6: KernelPanic
+        7: SystemOutOfMemory
+        8: HardwareWatchdogTimeout
+        9: SoftwareWatchdogTimeout
+  reports:
+      #####################################################################
+      # histogram
+      #
+      # Distribution of uptimes for each type of reboot reason in
+      # microseconds.
+      #####################################################################
+    - report_name: histogram
+      id: 3671940974 # legacy long report_id
+      report_type: INT_RANGE_HISTOGRAM
+      int_buckets:
+        exponential:
+          floor: 0
+          num_buckets: 25
+          initial_step: 60000000 # 1 minute
+          step_multiplier: 2
+      local_privacy_noise_level: NONE
+      system_profile_field: [BOARD_NAME, PRODUCT_NAME, SYSTEM_VERSION, CHANNEL]
+  meta_data:
+    max_release_stage: GA
+    expiration_date: "2021/05/26"
+