[recovery] Add ota metrics

Bug: b/231987256
Test: None
Change-Id: Ic26bcc27a2cd2acc94b07c430e75dcf8bd919ca0
Reviewed-on: https://fuchsia-review.googlesource.com/c/cobalt-registry/+/677680
Reviewed-by: Steve Fung <stevefung@google.com>
Privacy-Approval: Steve Fung <stevefung@google.com>
Reviewed-by: Mike "mc" Comfoltey <comfoltey@google.com>
Commit-Queue: Hai Bi <bihai@google.com>
diff --git a/fuchsia/recovery/metrics.yaml b/fuchsia/recovery/metrics.yaml
new file mode 100644
index 0000000..06a34b8
--- /dev/null
+++ b/fuchsia/recovery/metrics.yaml
@@ -0,0 +1,72 @@
+# Copyright 2022 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+################################################################################
+# Cobalt Project: recovery
+################################################################################
+
+metric_definitions:
+
+################################################################################
+# Next Metric ID: 3
+################################################################################
+
+################################################################################
+# ota_download_duration
+#
+# A histogram and logged to Cobalt for every ota, of the time taken for the ota
+# download to complete, in seconds.
+################################################################################
+- id: 1
+  metric_name: ota_download_duration
+  metric_type: INTEGER
+  metric_semantics: [METRIC_SEMANTICS_UNSPECIFIED]
+  metric_units: SECONDS
+  reports:
+    - report_name: histogram
+      id: 1
+      report_type: FLEETWIDE_HISTOGRAMS
+      system_profile_selection: REPORT_ALL
+      privacy_level: NO_ADDED_PRIVACY
+      int_buckets:
+        linear:
+          floor: 0
+          num_buckets: 100
+          step_size: 15  # 15 seconds
+      system_profile_field: [BOARD_NAME, PRODUCT_NAME, SYSTEM_VERSION, CHANNEL]
+  meta_data:
+    max_release_stage: GA
+    expiration_date: "2023/05/10"
+
+################################################################################
+# ota_download_status
+#
+# Pass or Fail
+################################################################################
+- id: 2
+  metric_name: ota_download_status
+  metric_type: OCCURRENCE
+  metric_semantics: [METRIC_SEMANTICS_UNSPECIFIED]
+  metric_dimensions:
+  - dimension: result
+    event_codes:
+      0: Unknown
+      1: Success
+      2: Failure
+  reports:
+    #####################################################################
+    # ota_download_counts
+    #
+    # This is a report used for the ota performed by the recovery.
+    # For each day, we count the total number of occurrences over the
+    # fleet of each error type.
+    #####################################################################
+    - report_name: ota_counts
+      id: 1
+      report_type: FLEETWIDE_OCCURRENCE_COUNTS
+      privacy_level: NO_ADDED_PRIVACY
+      system_profile_field: [OS, ARCH, BOARD_NAME, PRODUCT_NAME, SYSTEM_VERSION, CHANNEL, REALM]
+  meta_data:
+    max_release_stage: GA
+    expiration_date: "2023/05/10"
diff --git a/projects.yaml b/projects.yaml
index a9645fb..966bfc3 100644
--- a/projects.yaml
+++ b/projects.yaml
@@ -126,6 +126,9 @@
     - project_name:    setui
       project_id:      16
       project_contact: fuchsia-cobalt-dashboard-owners@google.com
+    - project_name:    recovery
+      project_id:      17
+      project_contact: fuchsia-cobalt-dashboard-owners@google.com
 
   # Deleted project IDs that must not be reused.
   deleted_project_ids: [100,101,102,103,104,105,106,107,108,109,1672220376]