Interface DTXAction
-
public interface DTXAction
This interface provides functionality to create (child) actions, report events/values/errors and tracing web requests.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
cancel()
Cancels thisDTXAction
.String
getRequestTag()
Returns the Dynatrace request tag which has to be set manually as HTTP header.String
getRequestTagHeader()
Returns the Dynatrace request tag header name.boolean
isFinished()
Returns true if this action is completed.void
leaveAction()
Completes this action and prepares the data for the next sending interval.void
reportError(String errorName, int errorCode)
Reports an error with a specified name and error code.void
reportError(String errorName, Throwable throwable)
Reports an error with a specified name and aThrowable
.void
reportEvent(String eventName)
Reports an event with a specified name (but without any value).void
reportValue(String valueName, double value)
Reports adouble
value with a specified name.void
reportValue(String valueName, int value)
Reports anint
value with a specified name.void
reportValue(String valueName, long value)
Reports along
value with a specified name.void
reportValue(String valueName, String value)
Reports aString
value with a specified name.void
tagRequest(HttpURLConnection conn)
Deprecated.As of version 8.255, insteadmanually obtain the request tag
and theheader key
and add them to the HTTP headers ofHttpURLConnection
.
-
-
-
Method Detail
-
leaveAction
void leaveAction()
Completes this action and prepares the data for the next sending interval.When an outer/parent action is exited, all nested/child actions are automatically closed.
-
reportEvent
void reportEvent(String eventName)
Reports an event with a specified name (but without any value).If given
eventName
isnull
or an emptyString
then no event is reported to the system.- Parameters:
eventName
- name of the event
-
reportValue
void reportValue(String valueName, int value)
Reports anint
value with a specified name.If given
valueName
isnull
or an emptyString
then no event is reported to the system.- Parameters:
valueName
- name of this valuevalue
- value itself
-
reportValue
void reportValue(String valueName, long value)
Reports along
value with a specified name.If given
valueName
isnull
or an emptyString
then no event is reported to the system.- Parameters:
valueName
- name of this valuevalue
- value itself- Since:
- 8.197
-
reportValue
void reportValue(String valueName, double value)
Reports adouble
value with a specified name.If given
valueName
isnull
or an emptyString
then no event is reported to the system.- Parameters:
valueName
- name of this valuevalue
- value itself
-
reportValue
void reportValue(String valueName, String value)
Reports aString
value with a specified name.If given
valueName
isnull
or an emptyString
then no event is reported to the system.- Parameters:
valueName
- name of this valuevalue
- value itself Thevalue
can benull
or an emptyString
.
-
reportError
void reportError(String errorName, int errorCode)
Reports an error with a specified name and error code.If given
errorName
isnull
or an emptyString
then no event is reported to the system.- Parameters:
errorName
- name of this errorerrorCode
- numeric error code of this error
-
reportError
void reportError(String errorName, Throwable throwable)
Reports an error with a specified name and aThrowable
.If given
errorName
isnull
or an empty string then no event is reported to the system.- Parameters:
errorName
- name of this errorthrowable
-Throwable
causing this error
-
cancel
void cancel()
Cancels thisDTXAction
.Canceling an action is similar to
leaving an action
, except that the data and all unfinished child objects are discarded instead of being sent.- Since:
- 8.231
-
tagRequest
@Deprecated void tagRequest(HttpURLConnection conn)
Deprecated.As of version 8.255, insteadmanually obtain the request tag
and theheader key
and add them to the HTTP headers ofHttpURLConnection
.Places a Dynatrace request tag on aHttpURLConnection
web request.This tag is evaluated by the corresponding web server agent. The Dynatrace server will link the server-side PurePath data with this mobile user action.
- Parameters:
conn
- the request tag will be added as header to this connection- See Also:
Dynatrace.tagRequest(HttpURLConnection)
-
isFinished
boolean isFinished()
Returns true if this action is completed.Completion may be due to normal finalization, extraordinary termination (like agent shutdown) or cancellation. In all of these cases, this method will return true. Further interactions on finished actions are not allowed and should be avoided.
- Returns:
- true, if action is finished
- Since:
- 8.231
-
getRequestTagHeader
String getRequestTagHeader()
Returns the Dynatrace request tag header name.This header is used together with the tag generated by
Dynatrace.getRequestTag()
and placed as HTTP header onto a web request.- Returns:
- the request tag header name
- See Also:
Dynatrace.getRequestTagHeader()
-
getRequestTag
String getRequestTag()
Returns the Dynatrace request tag which has to be set manually as HTTP header.The header key can be obtained with the method
getRequestTagHeader()
. If there is an open action in the current thread at the time the request is tagged, the web request is assigned (by the mobile agent) to the open action.- Returns:
- the request tag value or an empty string, if the mobile agent is not active
- See Also:
getRequestTagHeader()
,Dynatrace.getRequestTag()
-
-