/// Metrics to log when device first connects to an AP, and periodically afterward
/// (at least once a day) if the device is still connected to the AP.
Metrics to log when device first connects to an AP, and periodically afterward
(at least once a day) if the device is still connected to the AP.
Metrics to log when device first connects to an AP and periodically afterward ( at least once a day ) if the device is still connected to the AP .
async fn log_device_connected_cobalt_metrics(
        &mut self,
        multiple_bss_candidates: bool,
        latest_ap_state: &BssDescription,
    ) {
        let mut metric_events = vec![];
        metric_events.push(MetricEvent {
            metric_id: metrics::NUMBER_OF_CONNECTED_DEVICES_METRIC_ID,
            event_codes: vec![],
            payload: MetricEventPayload::Count(1),
        });
        let security_type_dim = convert::convert_security_type(&latest_ap_state.protection());
        metric_events.push(MetricEvent {
            metric_id: metrics::CONNECTED_NETWORK_SECURITY_TYPE_METRIC_ID,
            event_codes: vec![security_type_dim as u32],
            payload: MetricEventPayload::Count(1),
        });
        if latest_ap_state.supports_uapsd() {
            metric_events.push(MetricEvent {
                metric_id: metrics::DEVICE_CONNECTED_TO_AP_THAT_SUPPORTS_APSD_METRIC_ID,
                event_codes: vec![],
                payload: MetricEventPayload::Count(1),
            });
        }
        if let Some(rm_enabled_cap) = latest_ap_state.rm_enabled_cap() {
            let rm_enabled_cap_head = rm_enabled_cap.rm_enabled_caps_head;
            if rm_enabled_cap_head.link_measurement_enabled() {
                metric_events.push(MetricEvent {
                    metric_id:
                        metrics::DEVICE_CONNECTED_TO_AP_THAT_SUPPORTS_LINK_MEASUREMENT_METRIC_ID,
                    event_codes: vec![],
                    payload: MetricEventPayload::Count(1),
                });
            }
            if rm_enabled_cap_head.neighbor_report_enabled() {
                metric_events.push(MetricEvent {
                    metric_id:
                        metrics::DEVICE_CONNECTED_TO_AP_THAT_SUPPORTS_NEIGHBOR_REPORT_METRIC_ID,
                    event_codes: vec![],
                    payload: MetricEventPayload::Count(1),
                });
            }
        }
        if latest_ap_state.supports_ft() {
            metric_events.push(MetricEvent {
                metric_id: metrics::DEVICE_CONNECTED_TO_AP_THAT_SUPPORTS_FT_METRIC_ID,
                event_codes: vec![],
                payload: MetricEventPayload::Count(1),
            });
        }
        if let Some(cap) = latest_ap_state.ext_cap().map(|cap| cap.ext_caps_octet_3).flatten() {
            if cap.bss_transition() {
                metric_events.push(MetricEvent {
                    metric_id: metrics::DEVICE_CONNECTED_TO_AP_THAT_SUPPORTS_BSS_TRANSITION_MANAGEMENT_METRIC_ID,
                    event_codes: vec![],
                    payload: MetricEventPayload::Count(1),
                });
            }
        }
        let is_multi_bss_dim = convert::convert_is_multi_bss(multiple_bss_candidates);
        metric_events.push(MetricEvent {
            metric_id: metrics::DEVICE_CONNECTED_TO_AP_BREAKDOWN_BY_IS_MULTI_BSS_METRIC_ID,
            event_codes: vec![is_multi_bss_dim as u32],
            payload: MetricEventPayload::Count(1),
        });
        append_device_connected_channel_cobalt_metrics(
            &mut metric_events,
            latest_ap_state.channel.primary,
        );
        // Cobalt STRING metrics don't have AT_LEAST_ONCE local aggregation. So in order to
        // imitate the metric "how many devices connect to APs from an OUI", we build a set
        // seen OUIs now and then make sure we only log them once each day.
        let oui = latest_ap_state.bssid.0.to_oui_uppercase("");
        let _new = self.last_1d_detailed_stats.connected_ouis.insert(oui);
        log_cobalt_1dot1_batch!(
            self.cobalt_1dot1_proxy,
            &mut metric_events.iter_mut(),
            "log_device_connected_cobalt_metrics",
        );
    }
async fn log_device_connected_cobalt_metrics ( & mut self , multiple_bss_candidates : bool , latest_ap_state : & BssDescription , ) { let mut metric_events = vec ! [ ] ; metric_events . push ( MetricEvent { metric_id : metrics :: NUMBER_OF_CONNECTED_DEVICES_METRIC_ID , event_codes : vec ! [ ] , payload : MetricEventPayload :: Count ( 1 ) , } ) ; let security_type_dim = convert :: convert_security_type ( & latest_ap_state . protection ( ) ) ; metric_events . push ( MetricEvent { metric_id : metrics :: CONNECTED_NETWORK_SECURITY_TYPE_METRIC_ID , event_codes : vec ! [ security_type_dim as u32 ] , payload : MetricEventPayload :: Count ( 1 ) , } ) ; if latest_ap_state . supports_uapsd ( ) { metric_events . push ( MetricEvent { metric_id : metrics :: DEVICE_CONNECTED_TO_AP_THAT_SUPPORTS_APSD_METRIC_ID , event_codes : vec ! [ ] , payload : MetricEventPayload :: Count ( 1 ) , } ) ; } if let Some ( rm_enabled_cap ) = latest_ap_state . rm_enabled_cap ( ) { let rm_enabled_cap_head = rm_enabled_cap . rm_enabled_caps_head ; if rm_enabled_cap_head . link_measurement_enabled ( ) { metric_events . push ( MetricEvent { metric_id : metrics :: DEVICE_CONNECTED_TO_AP_THAT_SUPPORTS_LINK_MEASUREMENT_METRIC_ID , event_codes : vec ! [ ] , payload : MetricEventPayload :: Count ( 1 ) , } ) ; } if rm_enabled_cap_head . neighbor_report_enabled ( ) { metric_events . push ( MetricEvent { metric_id : metrics :: DEVICE_CONNECTED_TO_AP_THAT_SUPPORTS_NEIGHBOR_REPORT_METRIC_ID , event_codes : vec ! [ ] , payload : MetricEventPayload :: Count ( 1 ) , } ) ; } } if latest_ap_state . supports_ft ( ) { metric_events . push ( MetricEvent { metric_id : metrics :: DEVICE_CONNECTED_TO_AP_THAT_SUPPORTS_FT_METRIC_ID , event_codes : vec ! [ ] , payload : MetricEventPayload :: Count ( 1 ) , } ) ; } if let Some ( cap ) = latest_ap_state . ext_cap ( ) . map ( | cap | cap . ext_caps_octet_3 ) . flatten ( ) { if cap . bss_transition ( ) { metric_events . push ( MetricEvent { metric_id : metrics :: DEVICE_CONNECTED_TO_AP_THAT_SUPPORTS_BSS_TRANSITION_MANAGEMENT_METRIC_ID , event_codes : vec ! [ ] , payload : MetricEventPayload :: Count ( 1 ) , } ) ; } } let is_multi_bss_dim = convert :: convert_is_multi_bss ( multiple_bss_candidates ) ; metric_events . push ( MetricEvent { metric_id : metrics :: DEVICE_CONNECTED_TO_AP_BREAKDOWN_BY_IS_MULTI_BSS_METRIC_ID , event_codes : vec ! [ is_multi_bss_dim as u32 ] , payload : MetricEventPayload :: Count ( 1 ) , } ) ; append_device_connected_channel_cobalt_metrics ( & mut metric_events , latest_ap_state . channel . primary , ) ; // Cobalt STRING metrics don't have AT_LEAST_ONCE local aggregation. So in order to // imitate the metric "how many devices connect to APs from an OUI", we build a set // seen OUIs now and then make sure we only log them once each day. let oui = latest_ap_state . bssid . 0 . to_oui_uppercase ( " " ) ; let _new = self . last_1d_detailed_stats . connected_ouis . insert ( oui ) ; log_cobalt_1dot1_batch ! ( self cobalt_1dot1_proxy mut metric_events iter_mut ( ) " " ) ; }
Metrics to log when device first connects to an AP, and periodically afterward
(at least once a day) if the device is still connected to the AP.
Metrics to log when device first connects to an AP and periodically afterward ( at least once a day ) if the device is still connected to the AP .
&mut self
multiple_bss_candidates
bool
latest_ap_state
&BssDescription