|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.appdynamics.eumagent.runtime.Instrumentation
public class Instrumentation
Interact with the AppDynamics Android Agent running in your application.
This class provides a number of methods to interact with the appd android agent including
Activity.onCreate(android.os.Bundle).onCreate method
before any other initialization routines in your application.
@Override
public void onCreate(Bundle savedInstanceState){
Instrumentation.start("ABC-DEF-GHI", getApplicationContext());
//your code here
}
where ABC-DEF-GHI is your application key.
Once initialized, further calls to start(String, android.content.Context) has no effect on the agent.
findViewById(R.id.checkout_button).setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
//run your checkout routine.
Instrumentation.reportMetric("Checkout Count", 1);
}
});
public class MyActivity extends Activity {
@Override
protected void onStart(){
Instrumentation.startTimer("Time Spent on MyActivity");
//your code here.
}
@Override
protected void onStop(){
Instrumentation.stopTimer("Time Spent on MyActivity");
//your code here.
}
}
Note that, startTimer(String) and stopTimer(String) can be called from different threads.
private void downlaodImage(URL url) {
CallTracker tracker =
Instrumentation.beginCall("com.example.android.awesomeapp.ImageDownloader", "downloadImage")
.withArguments(url);
try {
//download image.
tracker.reportCallEnded()
} catch(Exception e) {
//handle exception thrown
tracker.reportCallEndedWithException(e);
}
}
For more information please
see
beginCall(boolean, String, String, Object...)CallTracker.reportCallEnded()CallTracker.reportCallEndedWithException(Exception)CallTracker.reportCallEndedWithReturnValue(Object)
| Method Summary | |
|---|---|
static CallTracker |
beginCall(boolean isStaticMethod,
java.lang.String className,
java.lang.String methodName,
java.lang.Object... args)
Report that an info point has started. |
static CallTracker |
beginCall(java.lang.String className,
java.lang.String methodName,
java.lang.Object... args)
Report that an info point has started. |
static HttpRequestTracker |
beginHttpRequest(java.net.URL url)
Begins tracking an HTTP request. |
static void |
changeAppKey(java.lang.String appKey)
Change the app key. |
static void |
endCall(CallTracker tracker)
Deprecated. Instead, use: CallTracker.reportCallEnded() |
static void |
endCall(CallTracker tracker,
java.lang.Object returnValue)
Deprecated. Instead, use CallTracker.reportCallEndedWithReturnValue(Object) |
static void |
leaveBreadcrumb(java.lang.String breadcrumb)
Leave a breadcrumb that will appear in a crash report. |
static void |
reportMetric(java.lang.String name,
long value)
Report metric value for the given name. |
static void |
setUserData(java.lang.String key,
java.lang.String value,
boolean persist)
Sets a key-value pair identifier that will be included in all snapshots. |
static void |
start(AgentConfiguration agentConfiguration)
Initialize the agent with the given configuration. |
static void |
start(java.lang.String appKey,
android.content.Context context)
Initialize the agent with the given application key and Context. |
static void |
start(java.lang.String appKey,
android.content.Context context,
boolean debugEnabled)
Initialize the agent with the given application key and Context. |
static void |
start(java.lang.String appKey,
android.content.Context context,
java.lang.String collectorURL)
Initialize the agent with the given application key and Context. |
static void |
start(java.lang.String appKey,
android.content.Context context,
java.lang.String collectorURL,
boolean debugEnabled)
Initialize the agent with the given application key and Context. |
static void |
startTimer(java.lang.String name)
Starts a global timer with the given name NOTE: The name can contain only alphanumeric characters and spaces. |
static void |
stopTimer(java.lang.String name)
Stops a global timer with the given name and reports it to the cloud. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void changeAppKey(java.lang.String appKey)
appKey - New app key to use for reporting beacons.
java.lang.IllegalArgumentException - if appKey is null or empty.
public static void start(java.lang.String appKey,
android.content.Context context)
Context.
appKey - Application key.context - Context of your application.
java.lang.IllegalArgumentException - if appKey is null or empty.
java.lang.IllegalArgumentException - if context is null.
java.lang.IllegalStateException - if AppDynamics compile-time instrumentation has not been added to the application.
public static void start(java.lang.String appKey,
android.content.Context context,
java.lang.String collectorURL)
Context.
appKey - Application key.context - Context of your application.collectorURL - Valid app dynamics collector url.
java.lang.IllegalArgumentException - if appKey is null or empty.
java.lang.IllegalArgumentException - if collectorURL is null or invalid.
java.lang.IllegalArgumentException - if context is null.
java.lang.IllegalStateException - if AppDynamics compile-time instrumentation has not been added to the application.
public static void start(java.lang.String appKey,
android.content.Context context,
boolean debugEnabled)
Context.
appKey - Application key.context - Context of your application.debugEnabled - true to enable agent logging.
java.lang.IllegalArgumentException - if appKey is null or empty.
java.lang.IllegalArgumentException - if context is null.
java.lang.IllegalStateException - if AppDynamics compile-time instrumentation has not been added to the application.
public static void start(java.lang.String appKey,
android.content.Context context,
java.lang.String collectorURL,
boolean debugEnabled)
Context.
appKey - Application key.context - Context of your application.collectorURL - Valid app dynamics collector url.debugEnabled - true to enable agent logging.
java.lang.IllegalArgumentException - if appKey is null or empty.
java.lang.IllegalArgumentException - if collectorURL is null or not a valid url.
java.lang.IllegalArgumentException - if context is null.
java.lang.IllegalStateException - if AppDynamics compile-time instrumentation has not been added to the application.public static void start(AgentConfiguration agentConfiguration)
agentConfiguration - Agent configuration to use.
java.lang.IllegalArgumentException - if configuration is invalid.
java.lang.IllegalStateException - if AppDynamics compile-time instrumentation has not been added to the application.
public static void reportMetric(java.lang.String name,
long value)
name - name of the metric keyvalue - long value reported for the given key.
java.lang.IllegalArgumentException - if the name is empty or malformed.
java.lang.NullPointerException - if the name is null.public static void startTimer(java.lang.String name)
name - name of the timer.
java.lang.IllegalArgumentException - if the name is empty or malformed.
java.lang.NullPointerException - if the name is null.public static void stopTimer(java.lang.String name)
name - name of the timer.
java.lang.IllegalArgumentException - if the name is empty or malformed.
java.lang.NullPointerException - if the name is null.
public static CallTracker beginCall(java.lang.String className,
java.lang.String methodName,
java.lang.Object... args)
className - Class containing the info point method.methodName - name of the method that started execution.args - arguments passed to this method.
java.lang.IllegalArgumentException - if className is null or empty or if methodName is null or empty.
public static CallTracker beginCall(boolean isStaticMethod,
java.lang.String className,
java.lang.String methodName,
java.lang.Object... args)
isStaticMethod - true if the method being reported is static.className - Class containing the info point method.methodName - name of the method that started execution.args - arguments passed to this method.
java.lang.IllegalArgumentException - if className is null or empty or if methodName is null or empty.
public static void endCall(CallTracker tracker,
java.lang.Object returnValue)
CallTracker.reportCallEndedWithReturnValue(Object)
tracker - Tracker that was obtained by calling beginCall(boolean, String, String, Object...) / beginCall(String, String, Object...)returnValue - Value returned by the method invocation. (can be null)public static void endCall(CallTracker tracker)
CallTracker.reportCallEnded()
tracker - Tracker that was obtained by calling beginCall(boolean, String, String, Object...) / beginCall(String, String, Object...)public static HttpRequestTracker beginHttpRequest(java.net.URL url)
url - The URL being requested.
java.lang.NullPointerException - if the url is null.public static void leaveBreadcrumb(java.lang.String breadcrumb)
breadcrumb - A string to include in the crash report. If it's
longer than 2048 characters, it will be truncated.
If it's empty, no breadcrumb will be recorded.
java.lang.NullPointerException - if breadcrumb is null.
public static void setUserData(java.lang.String key,
java.lang.String value,
boolean persist)
key - your unique keyvalue - your value, or null to clear this datapersist - true to persist through app destroys
java.lang.NullPointerException - if key is null.
java.lang.IllegalArgumentException - if key or value string is longer 2048 characters
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||