[WLAN] Add a metric template that uses UNIQUE_DEVICE_STRING_COUNTS

Add a metric template to use UNIQUE_DEVICE_STRING_COUNTS reports
and add a new metric for devices connnected to AP with OUI using the
new metric template. STRING_COUNTS was used as a work around until
there was support for UNIQUE_DEVICE_STRING_COUNTS.

Once the added metrics are verified, the STRING_COUNTS metrics can
be removed. (fxb/98997)

Bug: 97456
Change-Id: Ide686a50b0e8d4f8ee96f81cd2dd0c018e2466ea
Reviewed-on: https://fuchsia-review.googlesource.com/c/cobalt-registry/+/670822
Reviewed-by: Kiet Tran <kiettran@google.com>
Privacy-Approval: Andrew Hwang <anhwang@google.com>
Commit-Queue: Andrew Hwang <anhwang@google.com>
Reviewed-by: Laura Peskin <pesk@google.com>
diff --git a/fuchsia/connectivity_wlan/metrics.yaml b/fuchsia/connectivity_wlan/metrics.yaml
index 56a75b4..70f3142 100644
--- a/fuchsia/connectivity_wlan/metrics.yaml
+++ b/fuchsia/connectivity_wlan/metrics.yaml
@@ -3658,6 +3658,9 @@
 # metric, by logging only once. As such, two reports are generated, one
 # with system version and one without, because device count metrics are
 # not aggregatable across system version.
+# TODO(fxbug.dev/98997): remove this metric with report type
+# STRING_COUNTS, once the metric using UNIQUE_DEVICE_STRING_COUNTS
+# reports is verified.
 - id: 914
   metric_name: log_string_once_metric_template
   string_candidate_file: fuchsia/connectivity_wlan/ouis.txt
@@ -3685,6 +3688,9 @@
 # Example of how to use above metric's smaller anchors together.
 # This is also a placeholder where additional compatible reports can be defined
 # and reused.
+# TODO(fxbug.dev/98997): remove this metric with report type
+# STRING_COUNTS, once the metric using UNIQUE_DEVICE_STRING_COUNTS
+# reports is verified.
 - id: 915
   metric_name: log_string_once_metric_template__custom
   string_candidate_file: fuchsia/connectivity_wlan/ouis.txt
@@ -3692,6 +3698,48 @@
   reports:
     - *log_once_per_string_daily_string_counts_metric_template__default_report_1
 
+# Setup for string metrics that uses UNIQUE_DEVICE_STRING_COUNTS to count
+# strings only once per device per day. As such, two reports are
+# generated, one with system version and one without, because device count
+# metrics are not aggregatable across system version.
+- id: 916
+  metric_name: device_string_counts_metric_template
+  string_candidate_file: fuchsia/connectivity_wlan/ouis.txt
+  <<: &device_string_counts_metric_template
+    <<: &device_string_counts_metric_template__metric_portion
+      metric_type: STRING
+      metric_semantics: [NETWORK_COMMUNICATION, USAGE_COUNTING]
+      <<: *ga_release_metadata
+    reports:
+      - &device_string_counts_metric_template__default_report_1
+        report_name: device_daily_string_counts
+        id: 1
+        report_type: UNIQUE_DEVICE_STRING_COUNTS
+        system_profile_selection: SELECT_LAST
+        privacy_level: NO_ADDED_PRIVACY
+        string_buffer_max: 20
+        local_aggregation_period: WINDOW_1_DAY
+        system_profile_field: [BOARD_NAME, CHANNEL]
+      - &device_string_counts_metric_template__default_report_2
+        report_name: device_daily_string_counts_system_ver
+        id: 2
+        report_type: UNIQUE_DEVICE_STRING_COUNTS
+        system_profile_selection: SELECT_LAST
+        privacy_level: NO_ADDED_PRIVACY
+        string_buffer_max: 20
+        local_aggregation_period: WINDOW_1_DAY
+        system_profile_field: [BOARD_NAME, CHANNEL, SYSTEM_VERSION]
+
+# Example of how to use above metric's smaller anchors together.
+# This is also a placeholder where additional compatible reports can be defined
+# and reused.
+- id: 917
+  metric_name: device_string_counts_metric_template__custom
+  string_candidate_file: fuchsia/connectivity_wlan/ouis.txt
+  <<: *device_string_counts_metric_template__metric_portion
+  reports:
+    - *device_string_counts_metric_template__default_report_1
+
 ##########################
 ### 1XXX - Quality metrics
 ##########################
@@ -5262,11 +5310,24 @@
 #
 # Once a day, log the OUIs of all the APs that the client has connected to
 # or is connected to that day.
+#
+# TODO(fxbug.dev/98997): remove this metric once metric 5011 has been verified.
 ################################################################################
 - id: 5010
   metric_name: device_connected_to_ap_oui
   string_candidate_file: fuchsia/connectivity_wlan/ouis.txt
   <<: *log_once_per_string_daily_string_counts_metric_template
 
+################################################################################
+# Device connected to AP with some OUI
+#
+# Once a day, log the OUIs of all the APs that the client has connected to
+# or is connected to that day.
+################################################################################
+- id: 5011
+  metric_name: device_connected_to_ap_oui_2
+  string_candidate_file: fuchsia/connectivity_wlan/ouis.txt
+  <<: *device_string_counts_metric_template
+
 # Deleted metric IDs that must not be reused.
 deleted_metric_ids: [2,3,4,5,8,9,10,11,12,13]