mobile_insight.analyzer.kpi.kpi_manager module

kpi_manager.py An unified interface for users to track and query KPIs

Author: Yuanjie Li

class mobile_insight.analyzer.kpi.kpi_manager.KPIManager

Bases: mobile_insight.analyzer.analyzer.Analyzer

An unified interface for users to track and query KPIs

__check_kpis()

Find and include all supported KPIs into KPIManager.supported_kpis

enable_all_kpis(enable_storage=False)

Enable all KPIs’ monitoring

Parameters

enable_storage (boolean) – Whether to locally store the kpi. False by default

enable_kpi(kpi_name, periodicity='0s', cell=None, enable_storage=True)

Enable the KPI monitoring

Parameters
  • kpi_name (string) – The KPI to be monitored

  • enable_storage (boolean) – Whether to locally store the kpi. False by default

Returns

True if successfully activated, False otherwise

list_kpis()

Return a list of available KPIs

Returns

a list of string, each of which is a KPI name

local_query_kpi(kpi_name, mode='cell', timestamp=None)

Query the phone’s locally observed KPI

Parameters
  • kpi_name (string) – The KPI to be queried

  • timestamp (datetime) – The timestamp of the KPI. If None, this function returns the latest KPI

Returns

The KPI value, or None if the KPI is not available

remote_query_kpi(kpi_name, phone_model, operator, gps, timestamp)

Query the remote cloud for the KPI

Parameters
  • kpi_name (string) – The KPI to be queried

  • phone_model (string) – The the phone model

  • operator (string) – The network operator

  • gps (string) – The GPS coordinate

  • timestamp (datetime) – The timestamp of the KPI.

Returns

The KPI value, or None if the KPI is not available

supported_kpis = {}