-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Ft]:[DEVX-8764]:Clickstream Health refactor
- Loading branch information
1 parent
5ea23c8
commit 301d2cf
Showing
165 changed files
with
5,183 additions
and
4,878 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
app/src/main/java/com/clickstream/app/config/DefaultHealthConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.clickstream.app.config | ||
|
||
import DefaultCSHealthGateway | ||
import android.content.Context | ||
import android.util.Log | ||
import clickstream.health.intermediate.CSHealthEventLoggerListener | ||
import clickstream.health.intermediate.CSMemoryStatusProvider | ||
import clickstream.health.model.CSHealthEventConfig | ||
import clickstream.health.time.CSHealthTimeStampGenerator | ||
import clickstream.logger.CSLogLevel | ||
import clickstream.logger.CSLogger | ||
|
||
|
||
fun getHealthGateway(context: Context) = DefaultCSHealthGateway( | ||
context = context, | ||
csInfo = csInfo(), | ||
logger = CSLogger(CSLogLevel.DEBUG), | ||
timeStampGenerator = timeStampGenerator(), | ||
csMemoryStatusProvider = memoryStatusProvider(), | ||
csHealthEventConfig = healthConfig(), | ||
csHealthEventLoggerListener = healthEventLogger() | ||
) | ||
|
||
|
||
fun healthEventLogger() = object : CSHealthEventLoggerListener { | ||
override fun logEvent(eventName: String, healthData: HashMap<String, Any>) { | ||
Log.d("CS External Logger", "$eventName: $healthData") | ||
} | ||
|
||
} | ||
|
||
fun memoryStatusProvider() = object : CSMemoryStatusProvider { | ||
override fun isLowMemory(): Boolean { | ||
return false | ||
} | ||
} | ||
|
||
fun timeStampGenerator() = object : CSHealthTimeStampGenerator { | ||
override fun getTimeStamp(): Long { | ||
return System.currentTimeMillis() | ||
} | ||
} | ||
|
||
fun healthConfig() = | ||
CSHealthEventConfig( | ||
minTrackedVersion = "1.1.0", | ||
randomUserIdRemainder = (0..9).toList(), | ||
destination = listOf("CS", "CT"), | ||
verbosityLevel = "minimum" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 14 additions & 7 deletions
21
clickstream-health-metrics-api/src/main/kotlin/clickstream/health/CSHealthGateway.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,25 @@ | ||
package clickstream.health | ||
|
||
import androidx.annotation.RestrictTo | ||
import clickstream.health.intermediate.CSEventHealthListener | ||
import clickstream.health.intermediate.CSHealthEventFactory | ||
import clickstream.health.intermediate.CSHealthEventProcessor | ||
import clickstream.health.intermediate.CSHealthEventRepository | ||
|
||
/** | ||
* Wrapper class that creates [CSHealthEventProcessor]. | ||
* | ||
* */ | ||
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP) | ||
public interface CSHealthGateway { | ||
public val eventHealthListener: CSEventHealthListener | ||
|
||
public val healthEventRepository: CSHealthEventRepository | ||
/** | ||
* Class to process health events. | ||
* | ||
* */ | ||
public val healthEventProcessor: CSHealthEventProcessor? | ||
|
||
public val healthEventProcessor: CSHealthEventProcessor | ||
/** | ||
* Clears health events on app version upgrade. | ||
* | ||
* */ | ||
public suspend fun clearHealthEventsForVersionChange() | ||
|
||
public val healthEventFactory: CSHealthEventFactory | ||
} |
13 changes: 13 additions & 0 deletions
13
...kstream-health-metrics-api/src/main/kotlin/clickstream/health/constant/CSErrorConstant.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package clickstream.health.constant | ||
|
||
public object CSErrorConstant { | ||
public const val PARSING_EXCEPTION: String = "parsing_exception" | ||
public const val LOW_BATTERY: String = "low_battery" | ||
public const val NETWORK_UNAVAILABLE: String = "network_unavailable" | ||
public const val SOCKET_NOT_OPEN: String = "socket_not_open" | ||
public const val UNKNOWN: String = "unknown" | ||
public const val USER_UNAUTHORIZED: String = "401 Unauthorized" | ||
public const val SOCKET_TIMEOUT: String = "socket_timeout" | ||
public const val MAX_USER_LIMIT_REACHED: String = "max_user_limit_reached" | ||
public const val MAX_CONNECTION_LIMIT_REACHED: String = "max_connection_limit_reached" | ||
} |
Oops, something went wrong.