Open
Description
Android's Per-Application Network Selection (PANS) feature enables routing app-specific traffic through OEM-paid networks, allowing better control over data costs and connectivity management. To improve observability, we need to consume PANS metrics and send them as OpenTelemetry metrics for further analysis.
- Implement a service to collect PANS-related metrics from system services (e.g.,
netstats dumpsys
,connectivity dumpsys
). - Extract key metrics, including:
- Per-app network usage (Data transmitted via
OEM_PAID
andOEM_PRIVATE
networks) - App-to-network mappings (Which apps are using which OEM networks)
- Network preference changes (Updates to
setOemNetworkPreference
) - Connectivity issues or errors
- Per-app network usage (Data transmitted via
- Convert these metrics into OpenTelemetry format with appropriate labels such as:
app_package_name
network_type
(OEM_PAID, OEM_PRIVATE)data_transmitted_bytes
timestamp
- Use OpenTelemetry SDK to send metrics to the configured backend .
- Ensure proper error handling and logging for debugging connectivity issues.
Considerations
- Utilize Android
netstats
dumpsys for collecting network usage metrics per application. - Implement an Android Service that periodically fetches metrics and pushes them to OpenTelemetry.
- Use the OpenTelemetry Android SDK for sending telemetry data.
- Ensure compatibility with Android Automotive OS and PANS APIs.
- Provide persistence across reboots to reapply network preferences.
- Optimize for battery efficiency and minimize resource usage.
References
- [Android Automotive PANS API](https://source.android.com/docs/automotive/connectivity?authuser=1#call-pans-