Class DynatraceOpenKitBuilder


  • public class DynatraceOpenKitBuilder
    extends java.lang.Object
    Concrete builder that creates an OpenKit instance for Dynatrace Saas/Managed
    • Field Detail

      • DEFAULT_SERVER_ID

        public static final int DEFAULT_SERVER_ID
        The default server ID to communicate with.
        See Also:
        Constant Field Values
      • OPENKIT_TYPE

        public static final java.lang.String OPENKIT_TYPE
        A string, identifying the type of OpenKit this builder is made for.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DynatraceOpenKitBuilder

        public DynatraceOpenKitBuilder​(java.lang.String endpointURL,
                                       java.lang.String applicationID,
                                       long deviceID)
        Creates a new instance of type DynatraceOpenKitBuilder
        Parameters:
        endpointURL - endpoint OpenKit connects to
        applicationID - unique application id
        deviceID - unique device id
    • Method Detail

      • withLogger

        public DynatraceOpenKitBuilder withLogger​(Logger logger)
        Sets the logger. If no logger is set the default console logger is used. For the default logger verbose mode is enabled by calling withLogLevel.
        Parameters:
        logger - the logger
        Returns:
        this
      • withApplicationVersion

        public DynatraceOpenKitBuilder withApplicationVersion​(java.lang.String applicationVersion)
        Defines the version of the application. The value is only set if it is neither null nor empty.
        Parameters:
        applicationVersion - the application version
        Returns:
        this
      • withTrustManager

        public DynatraceOpenKitBuilder withTrustManager​(SSLTrustManager trustManager)
        Sets the trust manager. Overrides the default trust manager which is SSLStrictTrustManager by default-
        Parameters:
        trustManager - trust manager implementation
        Returns:
        this
      • withOperatingSystem

        public DynatraceOpenKitBuilder withOperatingSystem​(java.lang.String operatingSystem)
        Sets the operating system information. The value is only set if it is neither null nor empty.
        Parameters:
        operatingSystem - the operating system
        Returns:
        this
      • withManufacturer

        public DynatraceOpenKitBuilder withManufacturer​(java.lang.String manufacturer)
        Sets the manufacturer information. The value is only set if it is neither null nor empty.
        Parameters:
        manufacturer - the manufacturer
        Returns:
        this
      • withModelID

        public DynatraceOpenKitBuilder withModelID​(java.lang.String modelID)
        Sets the model id. The value is only set if it is neither null nor empty.
        Parameters:
        modelID - the model id
        Returns:
        this
      • withBeaconCacheMaxRecordAge

        public DynatraceOpenKitBuilder withBeaconCacheMaxRecordAge​(long maxRecordAgeInMilliseconds)
        Sets the maximum beacon record age of beacon data in cache.
        Parameters:
        maxRecordAgeInMilliseconds - The maximum beacon record age in milliseconds, or unbounded if negative.
        Returns:
        this
      • withBeaconCacheLowerMemoryBoundary

        public DynatraceOpenKitBuilder withBeaconCacheLowerMemoryBoundary​(long lowerMemoryBoundaryInBytes)
        Sets the lower memory boundary of the beacon cache.

        When this is set to a positive value the memory based eviction strategy clears the collected data, until the data size in the cache falls below the configured limit.

        Parameters:
        lowerMemoryBoundaryInBytes - The lower boundary of the beacon cache or negative if unlimited.
        Returns:
        this
      • withBeaconCacheUpperMemoryBoundary

        public DynatraceOpenKitBuilder withBeaconCacheUpperMemoryBoundary​(long upperMemoryBoundaryInBytes)
        Sets the upper memory boundary of the beacon cache.

        When this is set to a positive value the memory based eviction strategy starts to clear data from the beacon cache when the cache size exceeds this setting.

        Parameters:
        upperMemoryBoundaryInBytes - The lower boundary of the beacon cache or negative if unlimited.
        Returns:
        this
      • withDataCollectionLevel

        public DynatraceOpenKitBuilder withDataCollectionLevel​(DataCollectionLevel dataCollectionLevel)
        Sets the data collection level. Depending on the chosen level the amount and granularity of data sent is controlled.
        Off (0) - no data collected
        PERFORMANCE (1) - only performance related data is collected
        USER_BEHAVIOR (2) - all available RUM data including performance related data is collected
        Default value: USER_BEHAVIOR
        Parameters:
        dataCollectionLevel - Data collection level to apply.
        Returns:
        this
      • withCrashReportingLevel

        public DynatraceOpenKitBuilder withCrashReportingLevel​(CrashReportingLevel crashReportLevel)
        Sets the flag if crash reporting is enabled OFF (0) - Crashes are not sent to the server
        OPT_OUT_CRASHES (1) - Crashes are not sent to the server
        OPT_IN_CRASHES (2) - Crashes are sent to the server
        Default value: OPT_IN_CRASHES
        Parameters:
        crashReportLevel - Flag if crash reporting is enabled
        Returns:
        this
      • build

        public OpenKit build()
        Builds a new OpenKit instance
        Returns:
        returns an OpenKit instance
      • getOpenKitType

        public java.lang.String getOpenKitType()
        Get a string identifying the OpenKit type that gets created by this builder.

        The only real purpose is for logging reasons.

        Returns:
        Some identification string identifying the OpenKit's type.
      • getApplicationID

        public java.lang.String getApplicationID()
        Get the application id for which the OpenKit reports data.
        Returns:
        Application id for which data will be reported.
      • getDefaultServerID

        public int getDefaultServerID()
        Get the default server ID to communicate with.
        Returns:
        Default server id to communicate with.
      • getEndpointURL

        public java.lang.String getEndpointURL()
        Get the endpoint URL that has been set in the constructor.

        The endpoint URL is used to send beacon data to.

        Returns:
        Endpoint URL that has been configured in constructor.
      • getDeviceID

        public long getDeviceID()
        Get this device identifier that has been set in the constructor.

        The device identifier is a unique numeric value that identifies this device or installation. The user of the OpenKit library is responsible for providing a unique value per device/installation, which stays consistent per device/installation.

        Returns:
        Device identifier set in the constructor.
      • getOrigDeviceID

        public java.lang.String getOrigDeviceID()
        Returns the device identifier in the representation before it was hashed (in case the original device ID was a non numeric string).
        Returns:
        Device identifier in the representation as it was originally passed to the constructor.
      • getTrustManager

        public SSLTrustManager getTrustManager()
        Get the SSL trust manager that has been set with withTrustManager(SSLTrustManager).

        SSLTrustManager implementation are responsible for checking the X509 certificate chain and rejecting untrusted/invalid certificates. The default implementation rejects every untrusted/invalid (including self-signed) certificate.

        Returns:
        Previously set SSL trust manager or a default implementation.