Ametista
Engine
The AmetistaEngine class is the core component of the Ametista system. It collects performance data and tracks issues to send to your backend instance for analysis
Author
N7ghtm4r3 - Tecknobit
Properties
applicationId -> the identifier of the current application managed by the Engine
appVersion -> the current application version managed by the Engine
configurationLoaded -> whether the configuration has been loaded correctly
configurationMutex -> the mutex used to wait the configuration loaded before execute any operation
deviceInfo -> the current device information
ktorClient -> the HTTP client used to send the stats and the performance data
loggingEnabled -> whether the logging is enabled
requestsMutex -> the mutex used to synchronize the requests to avoid the interleaving between each request
serverSecret -> the server secret value used as authentication method to validate the requests of the Engine
Functions
Method to check the validity of the configuration loaded
Method to connect the platform where the application is currently running.
Method to execute an action after the configuration has been loaded. The configurationMutex synchronize the access locking it waiting the configuration loading
Method to execute the request
Method to format the host value in the correct localhost value address for the Android emulators with the ANDROID_LOCALHOST_VALUE
Method to get from the engine configuration the application version, this method check first if the version is specific for the current platform where the application is running, if not found will be used the generic one
Method to check whether the configuration is correctly loaded
Method to check whether the host value is correctly formatted
Method to load the configuration serializing the data in the EngineConfiguration data class and initializing the host, serverSecret, applicationId and appVersion instances
Method to notify the application launch and send the related value to the server.
Method to send the crash report of an issue occurred during the runtime of the application
Method to request the count of a network request sent by the application
Method to send a request
Method to set the logging
Method to throw an error if the configuration is not valid, if the error is related to the appVersion will be instead used a specific message