Enum NullSession

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      INSTANCE
      The sole NullSession instance
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void end()
      Ends this Session and marks it as ready for immediate sending.
      RootAction enterAction​(java.lang.String actionName)
      Enters an Action with a specified name in this Session.
      void identifyUser​(java.lang.String userTag)
      Tags a session with the provided userTag.
      void reportCarrier​(java.lang.String carrier)
      Reports the name of the cellular network carrier.
      void reportConnectionType​(ConnectionType connectionType)
      Reports the type of connection with which the device is connected to the network.
      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.
      void reportCrash​(java.lang.Throwable throwable)
      Reports a crash with error name, crash reason and stacktrace determined from given Throwable.
      void reportNetworkTechnology​(java.lang.String technology)
      Reports the network technology in use (e.g.
      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.
      WebRequestTracer traceWebRequest​(java.lang.String url)
      Allows tracing and timing of a web request handled by any 3rd party HTTP Client (e.g.
      WebRequestTracer traceWebRequest​(java.net.URLConnection connection)
      Traces a web request - which is provided as a URLConnection - and allows adding timing information to this request.
      static NullSession valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static NullSession[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Method Detail

      • values

        public static NullSession[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (NullSession c : NullSession.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static NullSession valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • enterAction

        public RootAction enterAction​(java.lang.String actionName)
        Description copied from interface: Session
        Enters an Action with a specified name in this Session.

        If the given actionName is null or an empty string, no reporting will happen on that RootAction.

        Specified by:
        enterAction in interface Session
        Parameters:
        actionName - name of the Action
        Returns:
        Action instance to work with
      • identifyUser

        public void identifyUser​(java.lang.String userTag)
        Description copied from interface: Session
        Tags a session with the provided userTag.

        If the given userTag is null or an empty string, this is equivalent to logging off the user.

        The last non-empty userTag is 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.

        Specified by:
        identifyUser in interface Session
        Parameters:
        userTag - id of the user or null/"" to simulate a log off.
      • reportCrash

        public void reportCrash​(java.lang.String errorName,
                                java.lang.String reason,
                                java.lang.String stacktrace)
        Description copied from interface: Session
        Reports a crash with a specified error name, crash reason and a stacktrace.

        If the given errorName is null or an empty string, no crash report will be sent to the server. If the reason is longer than 1000 characters, it is truncated to this value. If the stacktrace is longer than 128.000 characters, it is truncated according to the last line break.

        Specified by:
        reportCrash in interface Session
        Parameters:
        errorName - name of the error leading to the crash (e.g. Exception class)
        reason - reason or description of that error
        stacktrace - stacktrace leading to that crash
      • reportCrash

        public void reportCrash​(java.lang.Throwable throwable)
        Description copied from interface: Session
        Reports a crash with error name, crash reason and stacktrace determined from given Throwable.

        This method is offered as convenience method for Session.reportCrash(Throwable).

        Specified by:
        reportCrash in interface Session
        Parameters:
        throwable - The Throwable causing the crash.
      • reportNetworkTechnology

        public void reportNetworkTechnology​(java.lang.String technology)
        Description copied from interface: Session
        Reports the network technology in use (e.g. 2G, 3G, 802.11x, offline, ...) Use null to clear the value again and it will no longer be sent with the next beacon.
        Specified by:
        reportNetworkTechnology in interface Session
        Parameters:
        technology - the used network technology
      • reportConnectionType

        public void reportConnectionType​(ConnectionType connectionType)
        Description copied from interface: Session
        Reports the type of connection with which the device is connected to the network. Use null to clear the value again and it will no longer be sent with the next beacon.
        Specified by:
        reportConnectionType in interface Session
        Parameters:
        connectionType - the type of connection
      • reportCarrier

        public void reportCarrier​(java.lang.String carrier)
        Description copied from interface: Session
        Reports the name of the cellular network carrier. Use null to clear the value again and it will no longer be sent with the next beacon.

        The given value will be truncated to 250 characters.

        Specified by:
        reportCarrier in interface Session
        Parameters:
        carrier - the cellular network carrier
      • traceWebRequest

        public WebRequestTracer traceWebRequest​(java.net.URLConnection connection)
        Description copied from interface: Session
        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.
        Specified by:
        traceWebRequest in interface Session
        Parameters:
        connection - the URLConnection of the HTTP request to be tagged and timed
        Returns:
        a WebRequestTracer which allows adding timing information
      • traceWebRequest

        public WebRequestTracer traceWebRequest​(java.lang.String url)
        Description copied from interface: Session
        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.
        Specified by:
        traceWebRequest in interface Session
        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

        public void sendBizEvent​(java.lang.String type,
                                 java.util.Map<java.lang.String,​JSONValue> attributes)
        Description copied from interface: Session
        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.
        Specified by:
        sendBizEvent in interface Session
        Parameters:
        type - Mandatory event type
        attributes - 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

        public void end()
        Description copied from interface: Session
        Ends this Session and marks it as ready for immediate sending.
        Specified by:
        end in interface Session
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable