open class TelemetryConfiguration
(source)
The TelemetryConfiguration class collects the information describing the telemetry setup of an app. There are some parts that every app needs to configure: Where should measurements store data? What servers are we actually uploading pings to? This class should provide good defaults so that in the best case it is not needed to modify the configuration.
TelemetryConfiguration(context: Context) |
open fun getAppName(): String
Get the name of the app. This value is used as one dimension when uploading telemetry to the HTTP Edge server. |
|
open fun getAppVersion(): String
Get the version of the app (e.g. 45.0.1). This value is used as one dimension when uploading telemetry to the HTTP Edge server. |
|
open fun getBuildId(): String
Get the build id of the app (e.g. 20150125030202). This value is used as one dimension when uploading telemetry to the HTTP Edge server. |
|
open fun getClassLoadTimestampMillis(): Long |
|
open fun getConnectTimeout(): Int
Returns setting for connect timeout (milliseconds). A value of 0 implies that the option is disabled (i.e., timeout of infinity). |
|
open fun getContext(): Context
Application context this library is running in. |
|
open fun getDataDirectory(): File
Get the root directory where telemetry components should store data. |
|
open fun getInitialBackoffForUpload(): Long
Get the interval (in milliseconds) to wait initially after a ping upload has failed. |
|
open fun getMaximumNumberOfEventsPerPing(): Int
Get the maximum number of events per ping. |
|
open fun getMaximumNumberOfPingUploadsPerDay(): Int
Get the maximum number of pings that should be uploaded per day. |
|
open fun getMaximumNumberOfPingsPerType(): Int
Get the maximum number of pings that will be stored (for upload). |
|
open fun getMinimumEventsForUpload(): Int
Get the minimum number of telemetry events that need to be fired before even trying to upload an event ping. |
|
open fun getPreferencesImportantForTelemetry(): MutableSet<String>
Get a list of preference keys that are important for telemetry. |
|
open fun getReadTimeout(): Int
Returns setting for read timeout. 0 return implies that the option is disabled (i.e., timeout of infinity). |
|
open fun getServerEndpoint(): String
Set the server endpoint to upload telemetry pings to. |
|
open fun getSettingsProvider(): SettingsProvider
Get the provider for reading app settings. |
|
open fun getSharedPreferences(): SharedPreferences
Get shared preference for storing telemetry related data. |
|
open fun getUpdateChannel(): String
Get the update channel of the app (e.g. beta, release). This value is used as one dimension when uploading telemetry to the HTTP Edge server. |
|
open fun getUserAgent(): String
Get the user agent used when communicating with the telemetry endpoint. |
|
open fun isCollectionEnabled(): Boolean
Is collecting telemetry data enabled? |
|
open fun isUploadEnabled(): Boolean
Is uploading collected telemetry data enable? |
|
open fun setAppName(appName: String): TelemetryConfiguration
Set the name of the app. This value is used as one dimension when uploading telemetry to the HTTP Edge server. |
|
open fun setAppVersion(appVersion: String): TelemetryConfiguration
Set the version of the app (e.g. 45.0.1). This value is used as one dimension when uploading telemetry to the HTTP Edge server. |
|
open fun setBuildId(buildId: String): TelemetryConfiguration
Get the build id of the app (e.g. 20150125030202). This value is used as one dimension when uploading telemetry to the HTTP Edge server. |
|
open fun setCollectionEnabled(collectionEnabled: Boolean): TelemetryConfiguration
Enable or disable collection of telemetry data. Local dev builds should disable this to avoid collecting and sending any data. |
|
open fun setConnectTimeout(connectTimeout: Int): TelemetryConfiguration
Sets a specified timeout value, in milliseconds, to be used when opening a communications link to the telemetry endpoint. If the timeout expires before the connection can be established, the ping upload will be retried at a later time. A timeout of zero is interpreted as an infinite timeout. |
|
open fun setDataDirectory(dataDirectory: File): TelemetryConfiguration
Set the root directory where telemetry components should store data. |
|
open fun setInitialBackoffForUpload(initialBackoffForUpload: Long): TelemetryConfiguration
Set the interval (in milliseconds) to wait initially after a ping upload has failed. |
|
open fun setMaximumNumberOfEventsPerPing(maximumNumberOfEventsPerPing: Int): TelemetryConfiguration
Set the maximum number of events per ping. If this limit is reached a ping will built and stored automatically. The number of stored and uploaded pings might be limited too. |
|
open fun setMaximumNumberOfPingUploadsPerDay(maximumNumberOfPingUploadsPerDay: Int): TelemetryConfiguration
Set the maximum number of pings uploaded per day. This limit is enforced for every type. If you have 2 ping types and set a limit of 100 pings per day then in total 200 pings per day could be uploaded. |
|
open fun setMaximumNumberOfPingsPerType(maximumNumberOfPingsPerType: Int): TelemetryConfiguration
Set the maximum number of pings that will be stored for a given ping type. If more types are in the local store then pings will be removed (oldest first). For this to happen the maximum needs to be reached without any successful upload. |
|
open fun setMinimumEventsForUpload(minimumEventsForUpload: Int): TelemetryConfiguration
Set the minimum number of telemetry events that need to be fired before even trying to upload an event ping. The default value is 3. The minimum needs to be >= 1. |
|
open fun setPreferencesImportantForTelemetry(vararg preferences: String): TelemetryConfiguration
Set a list of preference keys that are important for telemetry. Some measurements and pings might use this to determine what preferences should be reported. |
|
open fun setReadTimeout(readTimeout: Int): TelemetryConfiguration
Sets the read timeout to a specified timeout, in milliseconds. A non-zero value specifies the timeout when reading from the telemetry endpoint. If the timeout expires before there is data available for read, the ping upload will be retried later. A timeout of zero is interpreted as an infinite timeout. |
|
open fun setServerEndpoint(endpoint: String): TelemetryConfiguration
Set the server endpoint to upload telemetry pings to. And endpoint value should include the schema and no trailing slash, e.g.: https://telemetry.example.org |
|
open fun setSettingsProvider(settingsProvider: SettingsProvider): TelemetryConfiguration
Set a provider for reading app settings. |
|
open fun setUpdateChannel(updateChannel: String): TelemetryConfiguration
Set the update channel of the app (e.g. beta, release). This value is used as one dimension when uploading telemetry to the HTTP Edge server. |
|
open fun setUploadEnabled(uploadEnabled: Boolean): TelemetryConfiguration
Enable or disable the upload of collected telemetry data. This is usually set based on a user visible preference. |
|
open fun setUserAgent(userAgent: String): TelemetryConfiguration
Set the user agent used when communicating with the telemetry endpoint. |