Skip to content

kestingj/StatsDAndroidClient

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Android Library for Collecting Metrics with StatsD

USAGE

Step 1: Configure Android Manifest

Add the following to AndroidManifest.xml

AND

inside the tags.

Step 2: Initialize StatsD Client within onCreate()

NonBlockingStatsDClient statsD;

@Override protected void onCreate (Bundle savedInstanceState) {

StatsDClientKey key = new StatsDClientKey ("example.prefix", "www.exampledomain.com", portNumber);
statsD = StatsDClientContainer.INSTANCE.getClient(key);
...
...

}

Step 3: Override onResume()

@Override public void onResume() { super.onResume(); NetworkStateManager.testNetworkConnectionChange(getApplicationContext());

...
...

}

Step 4: Send Metrics

-Send counter:

statsD.count("metric.name", metricValue);

-Send timer: statsD.recordExecutionTime("metric.name", metricValue);

-Send set

statsD.recordSetEvent("metric.name", "eventName");

-Send gauge

statsD.recordGaugeValue("metric.name", metricValue);

Step 5: Close StatsD Client within onDestroy()

@Override protected void onDestroy() { statsDClientContainer.closeClient(client);

OR

statsDClientContainer.closeClient("prefix", "domain", port);

...
...

}

Scope

All NonBlockingStatsDClient objects are shared across the project. If two calls to create client are made from different activites with the same prefix, domain, and port a reference to the same object will be returned in both cases.

Wiki

https://w.amazon.com/index.php/Amazon_Music/Componentization/Europa

Maintainers

@kestingj

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors