-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d0d514c
commit 2f37751
Showing
60 changed files
with
229 additions
and
276 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
2 changes: 1 addition & 1 deletion
2
.../embracesdk/internal/clock/SystemClock.kt → .../embracesdk/internal/clock/SystemClock.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
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
18 changes: 18 additions & 0 deletions
18
...e-android-core/src/main/kotlin/io/embrace/android/embracesdk/internal/spans/EmbraceExt.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,11 +1,29 @@ | ||
package io.embrace.android.embracesdk.internal.spans | ||
|
||
import io.opentelemetry.api.logs.Severity | ||
|
||
/** | ||
* Prefix added to OTel signal object names recorded by the SDK | ||
*/ | ||
private const val EMBRACE_OBJECT_NAME_PREFIX = "emb-" | ||
|
||
/** | ||
* Prefix added to all attribute keys for all usage attributes added by the SDK | ||
*/ | ||
private const val EMBRACE_USAGE_ATTRIBUTE_NAME_PREFIX = "emb.usage." | ||
|
||
/** | ||
* Return the appropriate name used for telemetry created by Embrace given the current value | ||
*/ | ||
public fun String.toEmbraceObjectName(): String = EMBRACE_OBJECT_NAME_PREFIX + this | ||
|
||
public fun io.embrace.android.embracesdk.Severity.toOtelSeverity(): Severity = when (this) { | ||
io.embrace.android.embracesdk.Severity.INFO -> Severity.INFO | ||
io.embrace.android.embracesdk.Severity.WARNING -> Severity.WARN | ||
io.embrace.android.embracesdk.Severity.ERROR -> Severity.ERROR | ||
} | ||
|
||
/** | ||
* Return the appropriate internal Embrace attribute usage name given the current string | ||
*/ | ||
internal fun String.toEmbraceUsageAttributeName(): String = EMBRACE_USAGE_ATTRIBUTE_NAME_PREFIX + this |
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
File renamed without changes.
8 changes: 4 additions & 4 deletions
8
...dk/internal/telemetry/TelemetryService.kt → ...dk/internal/telemetry/TelemetryService.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,22 +1,22 @@ | ||
package io.embrace.android.embracesdk.internal.telemetry | ||
|
||
internal interface TelemetryService { | ||
public interface TelemetryService { | ||
|
||
/** | ||
* Tracks the usage of a public API by name. We only track public APIs that are called when the SDK is initialized. | ||
* Name should be snake_case, e.g. "start_session". | ||
*/ | ||
fun onPublicApiCalled(name: String) | ||
public fun onPublicApiCalled(name: String) | ||
|
||
/** | ||
* Tracks the storage being used, in bytes. storageTelemetry is a map of storage telemetry names and their values in bytes, | ||
* such as: emb.storage.usage -> "1234" | ||
*/ | ||
fun logStorageTelemetry(storageTelemetry: Map<String, String>) | ||
public fun logStorageTelemetry(storageTelemetry: Map<String, String>) | ||
|
||
/** | ||
* Returns a map with every telemetry value. This is called when the session ends. | ||
* We clear the usage count map so we don't count the same usages in the next session. | ||
*/ | ||
fun getAndClearTelemetryAttributes(): Map<String, String> | ||
public fun getAndClearTelemetryAttributes(): Map<String, String> | ||
} |
File renamed without changes.
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
27 changes: 27 additions & 0 deletions
27
...rc/main/kotlin/io/embrace/android/embracesdk/internal/serialization/PlatformSerializer.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,27 @@ | ||
package io.embrace.android.embracesdk.internal.serialization | ||
|
||
import java.io.InputStream | ||
import java.io.OutputStream | ||
import java.lang.reflect.Type | ||
|
||
/** | ||
* Interface for JSON serializer wrapper than can then be wrapped for testing purposes | ||
*/ | ||
public interface PlatformSerializer { | ||
public fun <T> toJson(src: T): String | ||
public fun <T> toJson(src: T, clz: Class<T>): String | ||
public fun <T> toJson(src: T, type: Type): String | ||
public fun <T> toJson(any: T, clazz: Class<T>, outputStream: OutputStream) | ||
public fun <T> toJson(any: T, type: Type, outputStream: OutputStream) | ||
public fun <T> fromJson(json: String, clz: Class<T>): T | ||
public fun <T> fromJson(json: String, type: Type): T | ||
public fun <T> fromJson(inputStream: InputStream, clz: Class<T>): T | ||
public fun <T> fromJson(inputStream: InputStream, type: Type): T | ||
} | ||
|
||
/** | ||
* Return the first 200 elements of [elements] as a JSON-encoded string | ||
*/ | ||
public fun PlatformSerializer.truncatedStacktrace( | ||
elements: Array<StackTraceElement> | ||
): String = toJson(elements.take(200).map(StackTraceElement::toString).toList(), List::class.java) |
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
Oops, something went wrong.