Home / Android / Yelp Varanus Helps Android Apps Monitor and Limit Network Traffic – InfoQ.com

Yelp Varanus Helps Android Apps Monitor and Limit Network Traffic – InfoQ.com

Recently open-sourced by Yelp, Varanus is an Android library aiming to prevent apps from inadvertently consuming too much data. Besides monitoring network traffic, Varanus can also shut it off if required.

The original goal of Varanus was to protect against bugs where an excessive amount of network traffic is sent, potentially accidentally DDOS-ing the site (as described in this droidcon talk). However it’s suitable for managing and monitoring network traffic more generally.

According to Yelp engineers Sanae Rosen and Kurt Bonatz, Varanus was built with three goals in mind: being simple and hard to break; working as expected out-of-the-box with no configuration; and not requiring much effort to be integrated into different apps.

Varanus enables monitoring or shutting off network traffic both globally and for specific endpoints. It works by intercepting all network traffic in a OkHttp interceptor. As you can see in the following image, the interceptor communicates with a Network Monitor and a Network Shutoff Manager, which are the two main entities in Varanus. Both of them use a user-provided logging service (Traffic Log Persister and Network Shutoff Persister) to store logs wherever the user wants. Logs are only generated when there is actually network usage to reduce performance overhead and batter consumption.

Whenever the remote service deems the app is consuming too much data, it can send non-standard 555 or 556 error codes to shut off either data going through to a specific endpoint or all network usage globally. Being able to send these custom error codes is the only requirement that must be fulfilled server-side to use Varanus in an app.

Varanus is written in Kotlin can be installed using gradle:

// Top level build.gradle
allprojects {
    repositories {

// Module level build.gradle
dependencies {
    implementation "com.yelp.android:varanus:<version-number>"

On a related note, Yelp has also open-sourced its own migration tool Rusty Jetpack.

The tool migrates all files in a git repository to use the new Android X package namespaces. This includes imports, fully qualified references, pro-guard declarations, and warnings about gradle packages that need to be changed.

Rusty Jetpack could be useful for migrating projects where the official migrator provided in Android Studio will not work, as was the case with Yelp projects, say Rosen and Bonatz.

Source link

Check Also

LaraCroft Go and Monument Valley 2 Now Free on Android, iOS – TechPP

As the world battles with the Corona Virus, a number of developers are doing their …

Leave a Reply

Your email address will not be published. Required fields are marked *