[feedback] Track reboot reason persist duration

Bug: 52274

Change-Id: I0e7d40c3f1b01dc260835eab966e70c22ad9ad52
Reviewed-on: https://fuchsia-review.googlesource.com/c/cobalt-registry/+/390583
Commit-Queue: Alex Pankhurst <pankhurst@google.com>
Reviewed-by: Mitch Rudominer <rudominer@google.com>
Reviewed-by: Francois Rousseau <frousseau@google.com>
diff --git a/fuchsia/feedback/metrics.yaml b/fuchsia/feedback/metrics.yaml
index 09b0e21..2b02304 100644
--- a/fuchsia/feedback/metrics.yaml
+++ b/fuchsia/feedback/metrics.yaml
@@ -192,7 +192,7 @@
   meta_data:
     max_release_stage: GA
     expiration_date: "2020/08/27"
-
+    
 #####################################################################
 # bugreport_generation_duration_usecs
 #
@@ -233,3 +233,42 @@
   meta_data:
     max_release_stage: GA
     expiration_date: "2020/08/27"
+
+#######################################################################
+# reboot_reason_persist_duration_usecs
+#
+# Whenever last_reboot.cmx receives a notification that the system is
+# going to shutdown we log the elapsed time in microseconds that it
+# takes to persist the reboot reason to disk. This metric is collected
+# once each time a device shuts down.
+#######################################################################
+- id: 7
+  metric_name: reboot_reason_persist_duration_usecs
+  metric_type: ELAPSED_TIME
+  metric_dimensions:
+    - dimension: write_result
+      event_codes:
+        0: Success
+        1: Failure
+  reports:
+      #####################################################################
+      # histogram
+      #
+      # Determine the distribution of how long it takes to persist the
+      # reboot reason between 0 and 5 seconds, using 0.1 second wide
+      # bucket.
+      #####################################################################
+    - report_name: histogram
+      id: 1
+      report_type: INT_RANGE_HISTOGRAM
+      int_buckets:
+        linear:
+          floor: 0
+          num_buckets: 50
+          step_size: 100000 # .1 second
+      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/15"
+