Class DynatraceOpenKitBuilder
- java.lang.Object
-
- com.dynatrace.openkit.DynatraceOpenKitBuilder
-
public class DynatraceOpenKitBuilder extends java.lang.ObjectConcrete builder that creates anOpenKitinstance for Dynatrace Saas/Managed
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_SERVER_IDThe default server ID to communicate with.static java.lang.StringOPENKIT_TYPEA string, identifying the type of OpenKit this builder is made for.
-
Constructor Summary
Constructors Constructor Description DynatraceOpenKitBuilder(java.lang.String endpointURL, java.lang.String applicationID, long deviceID)Creates a new instance of type DynatraceOpenKitBuilder
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OpenKitbuild()Builds a newOpenKitinstancejava.lang.StringgetApplicationID()Get the application id for which the OpenKit reports data.java.lang.StringgetApplicationVersion()Get the application version that has been set withwithApplicationVersion(String).longgetBeaconCacheLowerMemoryBoundary()Get the beacon cache lower memory boundary that has been set withwithBeaconCacheLowerMemoryBoundary(long).longgetBeaconCacheMaxRecordAge()Get the maximum beacon cache record age that has been set withwithBeaconCacheMaxRecordAge(long).longgetBeaconCacheUpperMemoryBoundary()Get the beacon cache upper memory boundary that has been set withwithBeaconCacheUpperMemoryBoundary(long).CrashReportingLevelgetCrashReportLevel()Get crash reporting level that has been set withwithCrashReportingLevel(CrashReportingLevel).DataCollectionLevelgetDataCollectionLevel()Get data collection level that has been set withwithDataCollectionLevel(DataCollectionLevel).intgetDefaultServerID()Get the default server ID to communicate with.longgetDeviceID()Get this device identifier that has been set in the constructor.java.lang.StringgetEndpointURL()Get the endpoint URL that has been set in the constructor.HttpRequestInterceptorgetHttpRequestInterceptor()GetHttpRequestInterceptorthat has been set withwithHttpRequestInterceptor(HttpRequestInterceptor).HttpResponseInterceptorgetHttpResponseInterceptor()GetHttpResponseInterceptorthat has been set withwithHttpResponseInterceptor(HttpResponseInterceptor).LoggergetLogger()GetLoggerthat has been set withwithLogger(Logger).java.lang.StringgetManufacturer()Get the manufacturer that has been set withwithManufacturer(String).java.lang.StringgetModelID()Get the model identifier that has been set withwithModelID(String).java.lang.StringgetOpenKitType()Get a string identifying the OpenKit type that gets created by this builder.java.lang.StringgetOperatingSystem()Get the operating system that has been set withwithOperatingSystem(String).java.lang.StringgetOrigDeviceID()Returns thedevice identifierin the representation before it was hashed (in case the original device ID was a non numeric string).SSLTrustManagergetTrustManager()Get the SSL trust manager that has been set withwithTrustManager(SSLTrustManager).DynatraceOpenKitBuilderwithApplicationVersion(java.lang.String applicationVersion)Defines the version of the application.DynatraceOpenKitBuilderwithBeaconCacheLowerMemoryBoundary(long lowerMemoryBoundaryInBytes)Sets the lower memory boundary of the beacon cache.DynatraceOpenKitBuilderwithBeaconCacheMaxRecordAge(long maxRecordAgeInMilliseconds)Sets the maximum beacon record age of beacon data in cache.DynatraceOpenKitBuilderwithBeaconCacheUpperMemoryBoundary(long upperMemoryBoundaryInBytes)Sets the upper memory boundary of the beacon cache.DynatraceOpenKitBuilderwithCrashReportingLevel(CrashReportingLevel crashReportLevel)Sets the flag if crash reporting is enabledOFF (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_CRASHESDynatraceOpenKitBuilderwithDataCollectionLevel(DataCollectionLevel dataCollectionLevel)Sets the data collection level.DynatraceOpenKitBuilderwithHttpRequestInterceptor(HttpRequestInterceptor httpRequestInterceptor)Sets a customHttpRequestInterceptorDynatraceOpenKitBuilderwithHttpResponseInterceptor(HttpResponseInterceptor httpResponseInterceptor)Sets a customHttpResponseInterceptorDynatraceOpenKitBuilderwithLogger(Logger logger)Sets the logger.DynatraceOpenKitBuilderwithLogLevel(LogLevel level)Sets the default log level if the default logger is used.DynatraceOpenKitBuilderwithManufacturer(java.lang.String manufacturer)Sets the manufacturer information.DynatraceOpenKitBuilderwithModelID(java.lang.String modelID)Sets the model id.DynatraceOpenKitBuilderwithOperatingSystem(java.lang.String operatingSystem)Sets the operating system information.DynatraceOpenKitBuilderwithTrustManager(SSLTrustManager trustManager)Sets the trust manager.
-
-
-
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 toapplicationID- unique application iddeviceID- unique device id
-
-
Method Detail
-
withLogLevel
public DynatraceOpenKitBuilder withLogLevel(LogLevel level)
Sets the default log level if the default logger is used. If a custom logger is provided by callingwithLogger(Logger), debug and info log output depends on the values returned byLogger.isDebugEnabled()andLogger.isInfoEnabled().- Parameters:
level- The logLevel for the custom logger- Returns:
DynatraceOpenKitBuilder
-
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 callingwithLogLevel.- 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 isSSLStrictTrustManagerby 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 enabledOFF (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
-
withHttpRequestInterceptor
public DynatraceOpenKitBuilder withHttpRequestInterceptor(HttpRequestInterceptor httpRequestInterceptor)
Sets a customHttpRequestInterceptor- Parameters:
httpRequestInterceptor- Interceptor for intercepting requests to Dynatrace backends.- Returns:
this
-
withHttpResponseInterceptor
public DynatraceOpenKitBuilder withHttpResponseInterceptor(HttpResponseInterceptor httpResponseInterceptor)
Sets a customHttpResponseInterceptor- Parameters:
httpResponseInterceptor- Interceptor for intercepting responses received from Dynatrace backends.- Returns:
this
-
build
public OpenKit build()
Builds a newOpenKitinstance- Returns:
- returns an
OpenKitinstance
-
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.
-
getApplicationVersion
public java.lang.String getApplicationVersion()
Get the application version that has been set withwithApplicationVersion(String).- Returns:
- Previously set application version or
OpenKitConstants.DEFAULT_APPLICATION_VERSIONif none has been set.
-
getOperatingSystem
public java.lang.String getOperatingSystem()
Get the operating system that has been set withwithOperatingSystem(String).- Returns:
- Previously set operating system or
OpenKitConstants.DEFAULT_OPERATING_SYSTEMif none has been set.
-
getManufacturer
public java.lang.String getManufacturer()
Get the manufacturer that has been set withwithManufacturer(String).- Returns:
- Previously set manufacturer or
OpenKitConstants.DEFAULT_MANUFACTURERif none has been set.
-
getModelID
public java.lang.String getModelID()
Get the model identifier that has been set withwithModelID(String).- Returns:
- Previously set model ID or
OpenKitConstants.DEFAULT_MODEL_IDif none has been set.
-
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 thedevice identifierin 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 withwithTrustManager(SSLTrustManager).SSLTrustManagerimplementation 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.
-
getBeaconCacheMaxRecordAge
public long getBeaconCacheMaxRecordAge()
Get the maximum beacon cache record age that has been set withwithBeaconCacheMaxRecordAge(long).- Returns:
- Previously set maximum beacon cache record age or
ConfigurationDefaults.DEFAULT_MAX_RECORD_AGE_IN_MILLISif none has been set.
-
getBeaconCacheLowerMemoryBoundary
public long getBeaconCacheLowerMemoryBoundary()
Get the beacon cache lower memory boundary that has been set withwithBeaconCacheLowerMemoryBoundary(long).- Returns:
- Previously set lower memory boundary or
ConfigurationDefaults.DEFAULT_LOWER_MEMORY_BOUNDARY_IN_BYTESif none has been set.
-
getBeaconCacheUpperMemoryBoundary
public long getBeaconCacheUpperMemoryBoundary()
Get the beacon cache upper memory boundary that has been set withwithBeaconCacheUpperMemoryBoundary(long).- Returns:
- Previously set upper memory boundary or
ConfigurationDefaults.DEFAULT_UPPER_MEMORY_BOUNDARY_IN_BYTESif none has been set.
-
getDataCollectionLevel
public DataCollectionLevel getDataCollectionLevel()
Get data collection level that has been set withwithDataCollectionLevel(DataCollectionLevel).- Returns:
- Previously set data collection level or
ConfigurationDefaults.DEFAULT_DATA_COLLECTION_LEVELif nothing has been set.
-
getCrashReportLevel
public CrashReportingLevel getCrashReportLevel()
Get crash reporting level that has been set withwithCrashReportingLevel(CrashReportingLevel).- Returns:
- Previously set crash reporting level or
ConfigurationDefaults.DEFAULT_CRASH_REPORTING_LEVELif nothing has been set.
-
getHttpRequestInterceptor
public HttpRequestInterceptor getHttpRequestInterceptor()
GetHttpRequestInterceptorthat has been set withwithHttpRequestInterceptor(HttpRequestInterceptor).- Returns:
- Previously set HTTP request interceptor or
NullHttpRequestInterceptor.INSTANCEif nothing has been set.
-
getHttpResponseInterceptor
public HttpResponseInterceptor getHttpResponseInterceptor()
GetHttpResponseInterceptorthat has been set withwithHttpResponseInterceptor(HttpResponseInterceptor).- Returns:
- Previously set HTTP response interceptor or
NullHttpResponseInterceptor.INSTANCEif nothing has been set.
-
getLogger
public Logger getLogger()
GetLoggerthat has been set withwithLogger(Logger).- Returns:
- Previously set logger or
DefaultLoggerif none has been set.
-
-