[software_delivery] Rename some event codes and reports.

No events have been emitted for any of the metrics with changed elements.

Change-Id: I9e12fc80a642a8c5f36730233c31c143def9f7af
diff --git a/fuchsia/software_delivery/metrics.yaml b/fuchsia/software_delivery/metrics.yaml
index 578be45..ba04231 100644
--- a/fuchsia/software_delivery/metrics.yaml
+++ b/fuchsia/software_delivery/metrics.yaml
@@ -204,13 +204,14 @@
     expiration_date: "2020/04/15"
 
 ################################################################################
-# Fetch Blob Success
+# Fetch Blob Result
 #
-# Used to log a 1 every time fetch_blob fails or succeeds. This statistic does
-# not dedup retries. This would happens a lot after a new package was registered
-# but infrequently after that. This would occur thousands of times after an
-# update over a few minute or so. Updates are expected to be monthly however. So
-# bursts of more than one per second are expected.
+# Used to log a 1 every time fetch_blob is called. fetch_blob is called when
+# resolving a package that is not cached. It will be called at least once (e.g.
+# some network errors are retried) for each blob in the package. A system update
+# resolves every package in the target system image and so will emit ~1,000 of
+# these events over a period of about a minute. User devices are not expected to
+# system update more than once per day.
 ################################################################################
 - id: 6
   metric_name: fetch_blob
@@ -219,18 +220,18 @@
     - dimension: result
       event_codes:
         0: success
-        1: CreateBlob
-        2: BadHttpStatus
-        3: NoMirrors
-        4: ContentLengthMismatch
-        5: UnknownLength
-        6: BlobTooSmall
-        7: BlobTooLarge
-        8: Truncate
-        9: Write
-        10: Hyper
-        11: Http
-        12: BlobUrl
+        1: create_blob
+        2: bad_http_status
+        3: no_mirrors
+        4: content_length_mismatch
+        5: unknown_length
+        6: blob_too_small
+        7: blob_too_large
+        8: truncate
+        9: write
+        10: hyper
+        11: http
+        12: blob_url
   reports:
     - report_name: fetch_blob_stats
       id: 1
@@ -244,8 +245,8 @@
       int_buckets:
         linear:
           floor: 0
-          num_buckets: 100
-          step_size: 20
+          num_buckets: 50
+          step_size: 1
       window_size:
         - 1
       system_profile_field: [BOARD_NAME, PRODUCT_NAME, SYSTEM_VERSION, CHANNEL]
@@ -268,8 +269,8 @@
   metric_dimensions:
     - dimension: result
       event_codes:
-        0: not_font
-        1: font
+        0: font
+        1: not_font
   reports:
     - report_name: is_font_package_check_stats
       id: 1
@@ -306,11 +307,11 @@
     - dimension: result
       event_codes:
         0: success
-        1: Io
-        2: Parse
-        3: PkgUrl
+        1: io
+        2: parse
+        3: pkg_url
   reports:
-    - report_name: is_font_package_check_stats
+    - report_name: font_manager_load_static_registry_stats
       id: 1
       report_type: PER_DEVICE_NUMERIC_STATS
       window_size:
@@ -341,14 +342,15 @@
   metric_name: pkg_resolver_startup_duration
   metric_type: ELAPSED_TIME
   reports:
-    - report_name: pkg_resolver_startup_duration_stats
+    - report_name: pkg_resolver_startup_duration_hist
       id: 1
       report_type: PER_DEVICE_HISTOGRAM
       int_buckets:
-        linear:
+        exponential:
           floor: 0
-          num_buckets: 100
-          step_size: 250
+          num_buckets: 17
+          initial_step: 1000
+          step_multiplier: 2
       system_profile_field: [BOARD_NAME, PRODUCT_NAME, SYSTEM_VERSION, CHANNEL]
       aggregation_type: MAX
       window_size:
@@ -371,9 +373,9 @@
     - dimension: result
       event_codes:
         0: success
-        1: Io
-        2: Parse
-        3: Overridden
+        1: io
+        2: parse
+        3: overridden
   reports:
     - report_name: repository_manager_load_static_configs_stats
       id: 1
@@ -409,8 +411,8 @@
   metric_dimensions:
     - dimension: result
       event_codes:
-        0: failure
-        1: success
+        0: success
+        1: failure
   reports:
     - report_name: repository_manager_load_repository_for_channel_stats
       id: 1
@@ -436,7 +438,7 @@
 ################################################################################
 # Create TUF Client
 #
-# Triggers when Repository tries to create a tuf client. Logs a 1 and the status
+# Triggers when Repository tries to create a TUF client. Logs a 1 and the status
 # of creating the TUF client. This happens once per boot.
 ################################################################################
 - id: 12
@@ -444,20 +446,21 @@
   metric_type: EVENT_COUNT
   metric_dimensions:
     - dimension: result
-      event_codes:
+      event_codes: &rust_tuf_result_status_codes
         0: success
-        1: BadSignature
-        2: Encoding
-        3: ExpiredMetadata
-        4: IllegalArgument
-        5: MissingMetadata
-        6: NoSupportedHashAlgorithm
-        7: NotFound
-        8: Opaque
-        9: Programming
-        10: TargetUnavaliable
-        11: UnknownKeyType
-        12: VerificationFailure
+        1: bad_signature
+        2: encoding
+        3: expired_metadata
+        4: illegal_argument
+        5: missing_metadata
+        6: no_supported_hash_algorithm
+        7: not_found
+        8: opaque
+        9: programming
+        10: target_unavaliable
+        11: unknown_hash_algorithm
+        12: unknown_key_type
+        13: verification_failure
   reports:
     - report_name: create_tuf_client_stats
       id: 1
@@ -484,28 +487,14 @@
 # Update TUF Client
 #
 # Occurs when UpdatingTufClient tries to update. Logs a 1 and the update status.
-# If an error occurs it logs the error type. This would happen roughly once per
-# month.
+# This happens once per package resolve.
 ################################################################################
 - id: 13
   metric_name: update_tuf_client
   metric_type: EVENT_COUNT
   metric_dimensions:
     - dimension: result
-      event_codes:
-        0: success
-        1: BadSignature
-        2: Encoding
-        3: ExpiredMetadata
-        4: IllegalArgument
-        5: MissingMetadata
-        6: NoSupportedHashAlgorithm
-        7: NotFound
-        8: Opaque
-        9: Programming
-        10: TargetUnavaliable
-        11: UnknownKeyType
-        12: VerificationFailure
+      event_codes: *rust_tuf_result_status_codes
   reports:
     - report_name: update_tuf_client_stats
       id: 1
@@ -519,7 +508,7 @@
       int_buckets:
         linear:
           floor: 0
-          num_buckets: 20
+          num_buckets: 50
           step_size: 1
       window_size:
         - 1
@@ -531,13 +520,10 @@
 ################################################################################
 # Resolve
 #
-# Triggers when resolving a package. Logs a 1 and the status of the resolve
-# which indicates the error type or if everything was succesful. Event codes for
-# each status are positive versions of the execulisively negative error codes
-# used in zircon. This would happen basically every time a componet was run or
-# in a burst after an OTA. It's not clear how often this would happen but bursts
-# of greater than one per second are expected, such as at boot. After that
-# running a componet is expected to be much more rare.
+# Triggers when resolving a package. Logs a 1 and the status of the resolve.
+# Result event codes are positive versions of the exclusively negative error
+# codes used in Zircon. On user builds (with ephemeral off), this happens once
+# for each package in the system image per system update.
 ################################################################################
 - id: 14
   metric_name: resolve
@@ -545,56 +531,56 @@
   metric_dimensions:
     - dimension: result
       event_codes:
-        0: ZX_OK
-        1: ZX_ERR_INTERNAL
-        2: ZX_ERR_NOT_SUPPORTED
-        3: ZX_ERR_NO_RESOURCES
-        4: ZX_ERR_NO_MEMORY
-        6: ZX_ERR_INTERNAL_INTR_RETRY
-        10: ZX_ERR_INVALID
-        11: ZX_ERR_BAD_HANDLE
-        12: ZX_ERR_WRONG_TYPE
-        13: ZX_ERR_BAD_SYSCALL
-        14: ZX_ERR_OUT_OF_RANGE
-        15: ZX_ERR_BUFFER_TOO_SMALL
-        20: ZX_ERR_BAD_STATE
-        21: ZX_ERR_TIMED_OUT
-        22: ZX_ERR_SHOULD_WAIT
-        23: ZX_ERR_CANCLED
-        24: ZX_ERR_PEER_CLOSED
-        25: ZX_ERR_NOT_FOUND
-        26: ZX_ERR_ALREADY_EXISTS
-        27: ZX_ERR_ALREADY_BOUND
-        28: ZX_ERR_UNAVAILABLE
-        30: ZX_ERR_ACCESS_DENIED
-        40: ZX_ERR_IO
-        41: ZX_ERR_IO_REFUSED
-        42: ZX_ERR_IO_DATA_INTEGRITY
-        43: ZX_ERR_IO_DATA_LOSS
-        44: ZX_ERR_IO_NOT_PRESENT
-        45: ZX_ERR_IO_OVERRUN
-        46: ZX_ERR_IO_MISSED_DEADLINE
-        47: ZX_ERR_IO_INVALID
-        50: ZX_ERR_BAD_PATH
-        51: ZX_ERR_NOT_DIR
-        52: ZX_ERR_NOT_FILE
-        53: ZX_ERR_FILE_BIG
-        54: ZX_ERR_NO_SPACE
-        55: ZX_ERR_NOT_EMPTY
-        60: ZX_ERR_STOP
-        61: ZX_ERR_NEXT
-        62: ZX_ERR_ASYNC
-        70: ZX_ERR_PROTOCOL_NOT_SUPPORTED
-        71: ZX_ERR_ADDRESS_UNREACHABLE
-        72: ZX_ERR_ADDRESS_IN_USE
-        73: ZX_ERR_NOT_CONNECTED
-        74: ZX_ERR_CONNECTION_REFUSED
-        75: ZX_ERR_CONNECTION_RESET
-        76: ZX_ERR_CONNECTION_ABORTED
+        0: zx_ok
+        1: zx_err_internal
+        2: zx_err_not_supported
+        3: zx_err_no_resources
+        4: zx_err_no_memory
+        6: zx_err_internal_intr_retry
+        10: zx_err_invalid_args
+        11: zx_err_bad_handle
+        12: zx_err_wrong_type
+        13: zx_err_bad_syscall
+        14: zx_err_out_of_range
+        15: zx_err_buffer_too_small
+        20: zx_err_bad_state
+        21: zx_err_timed_out
+        22: zx_err_should_wait
+        23: zx_err_canceled
+        24: zx_err_peer_closed
+        25: zx_err_not_found
+        26: zx_err_already_exists
+        27: zx_err_already_bound
+        28: zx_err_unavailable
+        30: zx_err_access_denied
+        40: zx_err_io
+        41: zx_err_io_refused
+        42: zx_err_io_data_integrity
+        43: zx_err_io_data_loss
+        44: zx_err_io_not_present
+        45: zx_err_io_overrun
+        46: zx_err_io_missed_deadline
+        47: zx_err_io_invalid
+        50: zx_err_bad_path
+        51: zx_err_not_dir
+        52: zx_err_not_file
+        53: zx_err_file_big
+        54: zx_err_no_space
+        55: zx_err_not_empty
+        60: zx_err_stop
+        61: zx_err_next
+        62: zx_err_async
+        70: zx_err_protocol_not_supported
+        71: zx_err_address_unreachable
+        72: zx_err_address_in_use
+        73: zx_err_not_connected
+        74: zx_err_connection_refused
+        75: zx_err_connection_reset
+        76: zx_err_connection_aborted
     - dimension: resolver_type
       event_codes:
-        0: font
-        1: regular
+        0: regular
+        1: font
   reports:
     - report_name: resolve_stats
       id: 1
@@ -609,7 +595,7 @@
         linear:
           floor: 0
           num_buckets: 1000
-          step_size: 100
+          step_size: 1
       window_size:
         - 1
       system_profile_field: [BOARD_NAME, PRODUCT_NAME, SYSTEM_VERSION, CHANNEL]
@@ -622,8 +608,7 @@
 #
 # Occurs after a package has finished resolving, successful or otherwise. Tracks
 # how long it takes to resolve a package. This is expected to take under a few
-# seconds. This event occurs in bursts during boot or after OTA and then rarely
-# after that. Bursts of greater than one per second are expected.
+# seconds. Happens once per package resolve.
 ################################################################################
 - id: 15
   metric_name: resolve_duration
@@ -631,21 +616,28 @@
   metric_dimensions:
     - dimension: result
       event_codes:
-        0: failure
-        1: success
+        0: success
+        1: failure
     - dimension: resolver_type
       event_codes:
-        0: font
-        1: regular
+        0: regular
+        1: font
   reports:
     - report_name: resolve_duration_stats
       id: 1
+      report_type: PER_DEVICE_NUMERIC_STATS
+      window_size:
+        - 1
+      system_profile_field: [BOARD_NAME, PRODUCT_NAME, SYSTEM_VERSION, CHANNEL]
+    - report_name: resolve_duration_hist
+      id: 2
       report_type: PER_DEVICE_HISTOGRAM
       int_buckets:
-        linear:
+        exponential:
           floor: 0
-          num_buckets: 600
-          step_size: 1000
+          num_buckets: 17
+          initial_step: 1000
+          step_multiplier: 2
       window_size:
         - 1
       system_profile_field: [BOARD_NAME, PRODUCT_NAME, SYSTEM_VERSION, CHANNEL]
@@ -657,10 +649,8 @@
 ################################################################################
 # Package Cache Open
 #
-# Occurs whenever a blob is opened in pkg-cache. Logs a 1 and the open status.
-# If an error does occur it gives the error type. It's expected to occur in
-# bursts during boot at greater than one per second but then become rare after
-# that.
+# Occurs whenever a blob is opened in pkg-cache. Logs a 1 and the result status.
+# Happens once per package resolve.
 ################################################################################
 - id: 16
   metric_name: pkg_cache_open
@@ -669,8 +659,8 @@
     - dimension: result
       event_codes:
         0: success
-        1: NotFound
-        2: Io
+        1: not_found
+        2: io
   reports:
     - report_name: pkg_cache_open_stats
       id: 1
@@ -684,8 +674,41 @@
       int_buckets:
         linear:
           floor: 0
-          num_buckets: 300
-          step_size: 10
+          num_buckets: 1000
+          step_size: 1
+      window_size:
+        - 1
+      system_profile_field: [BOARD_NAME, PRODUCT_NAME, SYSTEM_VERSION, CHANNEL]
+  meta_data:
+    max_release_stage: GA
+    expiration_date: "2021/03/18"
+
+################################################################################
+# Merkle For Url
+#
+# Occurs whenever the pkg-resolver looks up the merkle for a package url. Logs a
+# 1 and the result status. Happens once per package resolve.
+################################################################################
+- id: 17
+  metric_name: merkle_for_url
+  metric_type: EVENT_COUNT
+  metric_dimensions:
+    - dimension: result
+      event_codes:
+        0: success
+        1: fidl
+        2: not_found
+        3: unexpected_status
+        4: tuf_error
+        5: parse_error
+        6: blob_too_large
+        7: invalid_target_path
+        8: no_custom_metadata
+        9: serde_error
+  reports:
+    - report_name: merkle_for_url_stats
+      id: 1
+      report_type: PER_DEVICE_NUMERIC_STATS
       window_size:
         - 1
       system_profile_field: [BOARD_NAME, PRODUCT_NAME, SYSTEM_VERSION, CHANNEL]