public class Dynatrace extends Object
| Constructor and Description |
|---|
Dynatrace()
Returns the
Dynatrace object |
| Modifier and Type | Method and Description |
|---|---|
static void |
applyUserPrivacyOptions(UserPrivacyOptions userPrivacyOptions)
Creates a new session with the specified privacy settings and stores the privacy settings for future sessions.
|
static void |
endVisit()
Can be called to end the current visit and start a new visit.
|
static DTXAction |
enterAction(String actionName)
Similar to
enterAction(String, DTXAction). |
static DTXAction |
enterAction(String actionName,
DTXAction parentAction)
This creates an action object for reporting the time elapsed between two user-defined times.
|
static void |
flushEvents()
Call this function to flush all collected events immediately.
|
static boolean |
getCaptureStatus()
Get the current data capture state
|
static DataCollectionLevel |
getDataCollectionLevel()
Deprecated.
As of version 8.191, replaced by
getUserPrivacyOptions() |
static String |
getRequestTag()
Generates a Dynatrace request tag for a web request, which has to be manually added as http header (header key can be obtained with the method
getRequestTagHeader()). |
static String |
getRequestTagHeader()
Returns the Dynatrace request tag header name to be used in conjunction with the value returned by
getRequestTag(). |
static UserPrivacyOptions |
getUserPrivacyOptions()
Returns the previously specified privacy settings from the user.
|
static WebRequestTiming |
getWebRequestTiming(HttpURLConnection connection)
This represents a network timing instance for reporting the time elapsed between two user-defined events.
|
static WebRequestTiming |
getWebRequestTiming(String tag)
This represents a network timing instance for reporting the time elapsed between two user-defined events.
|
static void |
identifyUser(String userId)
Similar to
identifyUser(String, DTXAction). |
static void |
identifyUser(String userId,
DTXAction parentAction)
The current visit/session will be tagged with the provided user id.
|
static void |
instrumentWebView(WebView webView)
Instruments the given
WebView to allow communication between the RUM JavaScript tag and OneAgent for Android. |
static boolean |
isCrashReportingOptedIn()
Deprecated.
As of version 8.191, replaced by
getUserPrivacyOptions() |
static void |
modifyUserAction(UserActionModifier modifier)
Allows to modify the currently pending user action.
|
static void |
reportError(String errorName,
int errorCode)
Similar to
DTXAction.reportError(String, int). |
static void |
reportError(String errorName,
Throwable throwable)
Similar to
DTXAction.reportError(String, Throwable). |
static void |
restoreCookies()
Restores the Dynatrace cookies for the specified domains.
|
static void |
setBeaconHeaders(Map<String,String> headers)
Puts a set of http headers on every agent http request (f.e.
|
static void |
setCrashReportingOptedIn(boolean confirmed)
Deprecated.
As of version 8.191, replaced by
applyUserPrivacyOptions(UserPrivacyOptions) |
static void |
setDataCollectionLevel(DataCollectionLevel dataCollectionLevel)
Deprecated.
As of version 8.191, replaced by
applyUserPrivacyOptions(UserPrivacyOptions) |
static void |
setGpsLocation(Location location)
Saves the given GPS location for reporting along with the captured data.
|
static void |
shutdown()
Shuts down the mobile agent gracefully.
|
static void |
startup(Context context,
com.dynatrace.android.agent.conf.Configuration configuration)
Initializing the mobile agent for capturing and reporting data.
|
static void |
tagRequest(HttpURLConnection conn)
Places a Dynatrace request tag on the web request, which is evaluated by the corresponding web server
agent.
|
public Dynatrace()
throws RuntimeException
Dynatrace objectRuntimeExceptionpublic static void startup(Context context, com.dynatrace.android.agent.conf.Configuration configuration)
context - Android application contextconfiguration - configuration object created by AppMonConfigurationBuilder or DynatraceConfigurationBuilderpublic static void shutdown()
public static boolean getCaptureStatus()
public static void setGpsLocation(Location location)
location - to be savedpublic static String getRequestTagHeader()
getRequestTag().public static String getRequestTag()
getRequestTagHeader()).
The tag value is evaluated by the corresponding web server agent. The Dynatrace server will link the server-side PurePath data with a mobile user action.
Since there is no explicit action, the web request is correlated to an action according to the following rule:
getRequestTagHeader(),
DTXAction.getRequestTag()public static void tagRequest(HttpURLConnection conn)
Since there is no explicit action, the web request is correlated to an action according to the following rule:
conn - the request tag will be added as header to the connectionDTXAction.tagRequest(HttpURLConnection)public static DTXAction enterAction(String actionName)
enterAction(String, DTXAction). But the action will be generated as root action.actionName - name of the actionpublic static DTXAction enterAction(String actionName, DTXAction parentAction)
enterAction and leaveAction to determine how long it takes
to pull content from a remote server.
Within the action scope, you can have visibility to the corresponding backend transactions. Also other
event types (reportEvent, reportValue and reportError) can be reported within the context of
the action object, thus creating a series of events within an action scope.
You must call leaveAction on an action object to complete an action.
actionName - name of the actionparentAction - a parent action or null to create a new 'root' action objectpublic static void endVisit()
public static void reportError(String errorName, int errorCode)
DTXAction.reportError(String, int). But the error event is reported as root action.errorName - error nameerrorCode - integer error codepublic static void reportError(String errorName, Throwable throwable)
DTXAction.reportError(String, Throwable). But the error event is reported as root action.errorName - error namethrowable - a caught exceptionpublic static void flushEvents()
public static void setBeaconHeaders(Map<String,String> headers)
Authorization header). It also triggers the agent to
reconnect to the beacon endpoint with the new headers. To clear the previous headers, call the method with a null or empty value.headers - a set of http headersConfigurationBuilder.withCommunicationProblemListener(CommunicationProblemListener)public static WebRequestTiming getWebRequestTiming(String tag)
You must call WebRequestTiming.startWebRequestTiming() to start and WebRequestTiming.stopWebRequestTiming(URL, int, String) or WebRequestTiming.stopWebRequestTiming(String, int, String) to complete the timing.
tag - an String tag generated by Dynatrace.getRequestTag()public static WebRequestTiming getWebRequestTiming(HttpURLConnection connection)
You must call WebRequestTiming.startWebRequestTiming() to start and WebRequestTiming.stopWebRequestTiming() to complete the timing.
connection - a non-null HttpURLConnection instancepublic static void identifyUser(String userId)
identifyUser(String, DTXAction). But the identifyUser event will be generated as root action.userId - a unique id that allows you to identify the current user. If userId is null or empty, then the user tag will be removed from the session.public static void identifyUser(String userId, DTXAction parentAction)
userId - a unique id that allows you to identify the current user. If userId is null or empty, then the user tag will be removed from the session.parentAction - The parent action for the user identify eventpublic static UserPrivacyOptions getUserPrivacyOptions()
ConfigurationBuilder.withUserOptIn(boolean)public static void applyUserPrivacyOptions(UserPrivacyOptions userPrivacyOptions)
This method can only be used, when user opt-in feature is enabled. This method call has no effect if it the given privacy settings are identical to the previously specified privacy settings.
userPrivacyOptions - the new privacy settings from the userConfigurationBuilder.withUserOptIn(boolean)@Deprecated public static boolean isCrashReportingOptedIn()
getUserPrivacyOptions()IllegalStateException - if the agent is not started@Deprecated public static void setCrashReportingOptedIn(boolean confirmed)
applyUserPrivacyOptions(UserPrivacyOptions)ConfigurationBuilder.withUserOptIn(boolean).
To use this feature properly, you also have to activate the crash reporting feature from the agent with the method ConfigurationBuilder.withCrashReporting(boolean).confirmed - true, if crash reporting is confirmed by the userIllegalStateException - if the agent is not startedConfigurationBuilder.withCrashReporting(boolean)@Deprecated public static DataCollectionLevel getDataCollectionLevel()
getUserPrivacyOptions()DataCollectionLevel.USER_BEHAVIOR, when the
user opt-in feature is not used.IllegalStateException - if the agent is not started@Deprecated public static void setDataCollectionLevel(DataCollectionLevel dataCollectionLevel)
applyUserPrivacyOptions(UserPrivacyOptions)ConfigurationBuilder.withUserOptIn(boolean).
When the user changes the data collection level a new session will be started.dataCollectionLevel - new data collection levelIllegalStateException - if the agent is not startedpublic static void modifyUserAction(UserActionModifier modifier)
modifier - modifications that should be applied to the pending user actionpublic static void instrumentWebView(WebView webView)
WebView to allow communication between the RUM JavaScript tag and OneAgent for Android.
For hybrid apps with the RUM JavaScript tag inside a WebView, it is required to execute this method for every WebView
that contains the RUM JavaScript tag. Without this method call it can't be ensured that the monitoring data will be combined
into same session.
Note that this method has no effect for API level 15 and 16 because of security reasons.
webView - the web view that should be instrumentedConfigurationBuilder.withHybridMonitoring(boolean)public static void restoreCookies()
For hybrid apps with web view instrumentation you have to ensure that the Dynatrace cookies are not deleted.
You must call this method, when you delete all cookies via CookieManager.removeAllCookies(ValueCallback)
and CookieManager.removeSessionCookies(ValueCallback). Without the cookies it is not possible to combine the data
from the RUM JavaScript tag and OneAgent for Android into one session.
© 2021 Dynatrace LLC. All Rights Reserved