Interface Session
-
- All Superinterfaces:
java.lang.AutoCloseable,java.io.Closeable
- All Known Implementing Classes:
NullSession,SessionImpl,SessionProxyImpl
public interface Session extends java.io.CloseableThis interface provides functionality to create Actions in a Session.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidend()Ends this Session and marks it as ready for immediate sending.RootActionenterAction(java.lang.String actionName)Enters an Action with a specified name in this Session.voididentifyUser(java.lang.String userTag)Tags a session with the provideduserTag.voidreportCarrier(java.lang.String carrier)Reports the name of the cellular network carrier.voidreportConnectionType(ConnectionType connectionType)Reports the type of connection with which the device is connected to the network.voidreportCrash(java.lang.String errorName, java.lang.String reason, java.lang.String stacktrace)Reports a crash with a specified error name, crash reason and a stacktrace.voidreportCrash(java.lang.Throwable throwable)Reports a crash with error name, crash reason and stacktrace determined from givenThrowable.voidreportNetworkTechnology(java.lang.String technology)Reports the network technology in use (e.g.voidsendBizEvent(java.lang.String type, java.util.Map<java.lang.String,JSONValue> attributes)Send a Business Event With sendBizEvent, you can report a business event.WebRequestTracertraceWebRequest(java.lang.String url)Allows tracing and timing of a web request handled by any 3rd party HTTP Client (e.g.WebRequestTracertraceWebRequest(java.net.URLConnection connection)Traces a web request - which is provided as a URLConnection - and allows adding timing information to this request.
-
-
-
Method Detail
-
enterAction
RootAction enterAction(java.lang.String actionName)
Enters an Action with a specified name in this Session.If the given
actionNameisnullor an empty string, no reporting will happen on thatRootAction.- Parameters:
actionName- name of the Action- Returns:
- Action instance to work with
-
identifyUser
void identifyUser(java.lang.String userTag)
Tags a session with the provideduserTag.If the given
userTagisnullor an empty string, this is equivalent to logging off the user.The last non-empty
userTagis re-applied to split sessions. Details are described in https://github.com/Dynatrace/openkit-java/blob/main/docs/internals.md#identify-users-on-split-sessions.- Parameters:
userTag- id of the user ornull/""to simulate a log off.
-
reportCrash
void reportCrash(java.lang.String errorName, java.lang.String reason, java.lang.String stacktrace)Reports a crash with a specified error name, crash reason and a stacktrace.If the given
errorNameisnullor an empty string, no crash report will be sent to the server. If thereasonis longer than 1000 characters, it is truncated to this value. If thestacktraceis longer than 128.000 characters, it is truncated according to the last line break.- Parameters:
errorName- name of the error leading to the crash (e.g. Exception class)reason- reason or description of that errorstacktrace- stacktrace leading to that crash
-
reportCrash
void reportCrash(java.lang.Throwable throwable)
Reports a crash with error name, crash reason and stacktrace determined from givenThrowable.This method is offered as convenience method for
reportCrash(Throwable).- Parameters:
throwable- TheThrowablecausing the crash.
-
reportNetworkTechnology
void reportNetworkTechnology(java.lang.String technology)
Reports the network technology in use (e.g. 2G, 3G, 802.11x, offline, ...) Usenullto clear the value again and it will no longer be sent with the next beacon.- Parameters:
technology- the used network technology
-
reportConnectionType
void reportConnectionType(ConnectionType connectionType)
Reports the type of connection with which the device is connected to the network. Usenullto clear the value again and it will no longer be sent with the next beacon.- Parameters:
connectionType- the type of connection
-
reportCarrier
void reportCarrier(java.lang.String carrier)
Reports the name of the cellular network carrier. Usenullto clear the value again and it will no longer be sent with the next beacon.The given value will be truncated to 250 characters.
- Parameters:
carrier- the cellular network carrier
-
traceWebRequest
WebRequestTracer traceWebRequest(java.net.URLConnection connection)
Traces a web request - which is provided as a URLConnection - and allows adding timing information to this request. If the web request is continued on a server-side Agent (e.g. Java, .NET, ...) this Session will be correlated to the resulting server-side PurePath.- Parameters:
connection- the URLConnection of the HTTP request to be tagged and timed- Returns:
- a WebRequestTracer which allows adding timing information
-
traceWebRequest
WebRequestTracer traceWebRequest(java.lang.String url)
Allows tracing and timing of a web request handled by any 3rd party HTTP Client (e.g. Apache, Google, Jetty, ...). In this case the Dynatrace HTTP header (OpenKitConstants.WEBREQUEST_TAG_HEADER) has to be set manually to the tag value of this WebRequestTracer.
If the web request is continued on a server-side Agent (e.g. Java, .NET, ...) this Session will be correlated to the resulting server-side PurePath.- Parameters:
url- the URL of the web request to be tagged and timed- Returns:
- a WebRequestTracer which allows getting the tag value and adding timing information
-
sendBizEvent
void sendBizEvent(java.lang.String type, java.util.Map<java.lang.String,JSONValue> attributes)Send a Business Event With sendBizEvent, you can report a business event. These standalone events are being sent detached from user actions or sessions. Note: The 'dt' key, as well as all 'dt.' prefixed keys are considered reserved by Dynatrace and will be stripped from the passed in attributes. Note: Business events are only supported on Dynatrace SaaS deployments currently.- Parameters:
type- Mandatory event typeattributes- Must be a valid JSON object. The resulting event will be populated with the 'attributes'-parameter and enriched with additional properties. Therefore, even empty objects are valid.
-
end
void end()
Ends this Session and marks it as ready for immediate sending.
-
-