Skip to content

Commit

Permalink
Merge pull request #1749 from embrace-io/auto-term-param
Browse files Browse the repository at this point in the history
Fix auto termination propagation
  • Loading branch information
fractalwrench authored Dec 9, 2024
2 parents 2f8ad69 + e7a6db8 commit 9b5b93e
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 53 deletions.
38 changes: 16 additions & 22 deletions embrace-android-api/api/embrace-android-api.api
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ public abstract interface class io/embrace/android/embracesdk/internal/api/SdkAp

public final class io/embrace/android/embracesdk/internal/api/SdkApi$DefaultImpls {
public static fun createSpan (Lio/embrace/android/embracesdk/internal/api/SdkApi;Ljava/lang/String;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;)Lio/embrace/android/embracesdk/spans/EmbraceSpan;
public static fun recordCompletedSpan (Lio/embrace/android/embracesdk/internal/api/SdkApi;Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/AutoTerminationMode;)Z
public static fun recordCompletedSpan (Lio/embrace/android/embracesdk/internal/api/SdkApi;Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/EmbraceSpan;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;)Z
public static fun recordCompletedSpan (Lio/embrace/android/embracesdk/internal/api/SdkApi;Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;)Z
public static fun recordCompletedSpan (Lio/embrace/android/embracesdk/internal/api/SdkApi;Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;Lio/embrace/android/embracesdk/spans/EmbraceSpan;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;)Z
public static fun recordCompletedSpan (Lio/embrace/android/embracesdk/internal/api/SdkApi;Ljava/lang/String;JJLjava/util/Map;Ljava/util/List;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;)Z
public static fun recordCompletedSpan (Lio/embrace/android/embracesdk/internal/api/SdkApi;Ljava/lang/String;JJ)Z
public static fun recordCompletedSpan (Lio/embrace/android/embracesdk/internal/api/SdkApi;Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/EmbraceSpan;)Z
public static fun recordCompletedSpan (Lio/embrace/android/embracesdk/internal/api/SdkApi;Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;)Z
public static fun recordCompletedSpan (Lio/embrace/android/embracesdk/internal/api/SdkApi;Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;Lio/embrace/android/embracesdk/spans/EmbraceSpan;)Z
public static fun recordCompletedSpan (Lio/embrace/android/embracesdk/internal/api/SdkApi;Ljava/lang/String;JJLjava/util/Map;Ljava/util/List;)Z
public static fun recordSpan (Lio/embrace/android/embracesdk/internal/api/SdkApi;Ljava/lang/String;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;
public static fun recordSpan (Lio/embrace/android/embracesdk/internal/api/SdkApi;Ljava/lang/String;Lio/embrace/android/embracesdk/spans/EmbraceSpan;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;
public static fun recordSpan (Lio/embrace/android/embracesdk/internal/api/SdkApi;Ljava/lang/String;Ljava/util/Map;Ljava/util/List;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;
Expand Down Expand Up @@ -289,12 +289,12 @@ public abstract interface class io/embrace/android/embracesdk/spans/TracingApi {
public abstract fun createSpan (Ljava/lang/String;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;)Lio/embrace/android/embracesdk/spans/EmbraceSpan;
public abstract fun createSpan (Ljava/lang/String;Lio/embrace/android/embracesdk/spans/EmbraceSpan;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;)Lio/embrace/android/embracesdk/spans/EmbraceSpan;
public abstract fun getSpan (Ljava/lang/String;)Lio/embrace/android/embracesdk/spans/EmbraceSpan;
public abstract fun recordCompletedSpan (Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/AutoTerminationMode;)Z
public abstract fun recordCompletedSpan (Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/EmbraceSpan;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;)Z
public abstract fun recordCompletedSpan (Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;)Z
public abstract fun recordCompletedSpan (Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;Lio/embrace/android/embracesdk/spans/EmbraceSpan;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;)Z
public abstract fun recordCompletedSpan (Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;Lio/embrace/android/embracesdk/spans/EmbraceSpan;Ljava/util/Map;Ljava/util/List;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;)Z
public abstract fun recordCompletedSpan (Ljava/lang/String;JJLjava/util/Map;Ljava/util/List;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;)Z
public abstract fun recordCompletedSpan (Ljava/lang/String;JJ)Z
public abstract fun recordCompletedSpan (Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/EmbraceSpan;)Z
public abstract fun recordCompletedSpan (Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;)Z
public abstract fun recordCompletedSpan (Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;Lio/embrace/android/embracesdk/spans/EmbraceSpan;)Z
public abstract fun recordCompletedSpan (Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;Lio/embrace/android/embracesdk/spans/EmbraceSpan;Ljava/util/Map;Ljava/util/List;)Z
public abstract fun recordCompletedSpan (Ljava/lang/String;JJLjava/util/Map;Ljava/util/List;)Z
public abstract fun recordSpan (Ljava/lang/String;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;
public abstract fun recordSpan (Ljava/lang/String;Lio/embrace/android/embracesdk/spans/EmbraceSpan;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;
public abstract fun recordSpan (Ljava/lang/String;Lio/embrace/android/embracesdk/spans/EmbraceSpan;Ljava/util/Map;Ljava/util/List;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;
Expand All @@ -308,17 +308,11 @@ public final class io/embrace/android/embracesdk/spans/TracingApi$DefaultImpls {
public static fun createSpan (Lio/embrace/android/embracesdk/spans/TracingApi;Ljava/lang/String;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;)Lio/embrace/android/embracesdk/spans/EmbraceSpan;
public static synthetic fun createSpan$default (Lio/embrace/android/embracesdk/spans/TracingApi;Ljava/lang/String;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;ILjava/lang/Object;)Lio/embrace/android/embracesdk/spans/EmbraceSpan;
public static synthetic fun createSpan$default (Lio/embrace/android/embracesdk/spans/TracingApi;Ljava/lang/String;Lio/embrace/android/embracesdk/spans/EmbraceSpan;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;ILjava/lang/Object;)Lio/embrace/android/embracesdk/spans/EmbraceSpan;
public static fun recordCompletedSpan (Lio/embrace/android/embracesdk/spans/TracingApi;Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/AutoTerminationMode;)Z
public static fun recordCompletedSpan (Lio/embrace/android/embracesdk/spans/TracingApi;Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/EmbraceSpan;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;)Z
public static fun recordCompletedSpan (Lio/embrace/android/embracesdk/spans/TracingApi;Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;)Z
public static fun recordCompletedSpan (Lio/embrace/android/embracesdk/spans/TracingApi;Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;Lio/embrace/android/embracesdk/spans/EmbraceSpan;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;)Z
public static fun recordCompletedSpan (Lio/embrace/android/embracesdk/spans/TracingApi;Ljava/lang/String;JJLjava/util/Map;Ljava/util/List;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;)Z
public static synthetic fun recordCompletedSpan$default (Lio/embrace/android/embracesdk/spans/TracingApi;Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/AutoTerminationMode;ILjava/lang/Object;)Z
public static synthetic fun recordCompletedSpan$default (Lio/embrace/android/embracesdk/spans/TracingApi;Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/EmbraceSpan;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;ILjava/lang/Object;)Z
public static synthetic fun recordCompletedSpan$default (Lio/embrace/android/embracesdk/spans/TracingApi;Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;ILjava/lang/Object;)Z
public static synthetic fun recordCompletedSpan$default (Lio/embrace/android/embracesdk/spans/TracingApi;Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;Lio/embrace/android/embracesdk/spans/EmbraceSpan;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;ILjava/lang/Object;)Z
public static synthetic fun recordCompletedSpan$default (Lio/embrace/android/embracesdk/spans/TracingApi;Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;Lio/embrace/android/embracesdk/spans/EmbraceSpan;Ljava/util/Map;Ljava/util/List;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;ILjava/lang/Object;)Z
public static synthetic fun recordCompletedSpan$default (Lio/embrace/android/embracesdk/spans/TracingApi;Ljava/lang/String;JJLjava/util/Map;Ljava/util/List;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;ILjava/lang/Object;)Z
public static fun recordCompletedSpan (Lio/embrace/android/embracesdk/spans/TracingApi;Ljava/lang/String;JJ)Z
public static fun recordCompletedSpan (Lio/embrace/android/embracesdk/spans/TracingApi;Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/EmbraceSpan;)Z
public static fun recordCompletedSpan (Lio/embrace/android/embracesdk/spans/TracingApi;Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;)Z
public static fun recordCompletedSpan (Lio/embrace/android/embracesdk/spans/TracingApi;Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;Lio/embrace/android/embracesdk/spans/EmbraceSpan;)Z
public static fun recordCompletedSpan (Lio/embrace/android/embracesdk/spans/TracingApi;Ljava/lang/String;JJLjava/util/Map;Ljava/util/List;)Z
public static fun recordSpan (Lio/embrace/android/embracesdk/spans/TracingApi;Ljava/lang/String;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;
public static fun recordSpan (Lio/embrace/android/embracesdk/spans/TracingApi;Ljava/lang/String;Lio/embrace/android/embracesdk/spans/EmbraceSpan;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;
public static fun recordSpan (Lio/embrace/android/embracesdk/spans/TracingApi;Ljava/lang/String;Ljava/util/Map;Ljava/util/List;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public interface TracingApi {
public fun createSpan(
name: String,
autoTerminationMode: AutoTerminationMode = AutoTerminationMode.NONE,
): EmbraceSpan? = createSpan(name = name, parent = null)
): EmbraceSpan? = createSpan(name = name, parent = null, autoTerminationMode = autoTerminationMode)

/**
* Create an [EmbraceSpan] with the given name and parent. Passing in a parent that is null result in a new trace with this
Expand All @@ -37,7 +37,7 @@ public interface TracingApi {
public fun startSpan(
name: String,
autoTerminationMode: AutoTerminationMode = AutoTerminationMode.NONE,
): EmbraceSpan? = startSpan(name = name, parent = null)
): EmbraceSpan? = startSpan(name = name, parent = null, autoTerminationMode = autoTerminationMode)

/**
* Create, start, and return a new [EmbraceSpan] with the given name and parent. Returns null if the [EmbraceSpan] cannot be created
Expand All @@ -50,7 +50,8 @@ public interface TracingApi {
): EmbraceSpan? = startSpan(
name = name,
parent = parent,
startTimeMs = null
startTimeMs = null,
autoTerminationMode = autoTerminationMode,
)

/**
Expand All @@ -73,7 +74,14 @@ public interface TracingApi {
name: String,
autoTerminationMode: AutoTerminationMode = AutoTerminationMode.NONE,
code: () -> T,
): T = recordSpan(name = name, parent = null, attributes = null, events = null, code = code)
): T = recordSpan(
name = name,
parent = null,
attributes = null,
events = null,
code = code,
autoTerminationMode = autoTerminationMode,
)

/**
* Execute the given block of code and record a new span around it with the given parent. Passing in a parent that is null will result
Expand All @@ -86,7 +94,14 @@ public interface TracingApi {
parent: EmbraceSpan?,
autoTerminationMode: AutoTerminationMode = AutoTerminationMode.NONE,
code: () -> T,
): T = recordSpan(name = name, parent = parent, attributes = null, events = null, code = code)
): T = recordSpan(
name = name,
parent = parent,
attributes = null,
events = null,
code = code,
autoTerminationMode = autoTerminationMode,
)

/**
* Execute the given block of code and record a new trace around it with optional attributes and list of [EmbraceSpanEvent]. If the span
Expand All @@ -99,7 +114,14 @@ public interface TracingApi {
events: List<EmbraceSpanEvent>?,
autoTerminationMode: AutoTerminationMode = AutoTerminationMode.NONE,
code: () -> T,
): T = recordSpan(name = name, parent = null, attributes = attributes, events = events, code = code)
): T = recordSpan(
name = name,
parent = null,
attributes = attributes,
events = events,
code = code,
autoTerminationMode = autoTerminationMode,
)

/**
* Execute the given block of code and record a new span around it with the given parent with optional attributes and list
Expand All @@ -125,7 +147,6 @@ public interface TracingApi {
name: String,
startTimeMs: Long,
endTimeMs: Long,
autoTerminationMode: AutoTerminationMode = AutoTerminationMode.NONE,
): Boolean =
recordCompletedSpan(
name = name,
Expand All @@ -147,7 +168,6 @@ public interface TracingApi {
startTimeMs: Long,
endTimeMs: Long,
errorCode: ErrorCode?,
autoTerminationMode: AutoTerminationMode = AutoTerminationMode.NONE,
): Boolean =
recordCompletedSpan(
name = name,
Expand All @@ -168,7 +188,6 @@ public interface TracingApi {
startTimeMs: Long,
endTimeMs: Long,
parent: EmbraceSpan?,
autoTerminationMode: AutoTerminationMode = AutoTerminationMode.NONE,
): Boolean =
recordCompletedSpan(
name = name,
Expand All @@ -191,7 +210,6 @@ public interface TracingApi {
endTimeMs: Long,
errorCode: ErrorCode?,
parent: EmbraceSpan?,
autoTerminationMode: AutoTerminationMode = AutoTerminationMode.NONE,
): Boolean = recordCompletedSpan(
name = name,
startTimeMs = startTimeMs,
Expand All @@ -213,7 +231,6 @@ public interface TracingApi {
endTimeMs: Long,
attributes: Map<String, String>?,
events: List<EmbraceSpanEvent>?,
autoTerminationMode: AutoTerminationMode = AutoTerminationMode.NONE,
): Boolean = recordCompletedSpan(
name = name,
startTimeMs = startTimeMs,
Expand All @@ -239,7 +256,6 @@ public interface TracingApi {
parent: EmbraceSpan?,
attributes: Map<String, String>?,
events: List<EmbraceSpanEvent>?,
autoTerminationMode: AutoTerminationMode = AutoTerminationMode.NONE,
): Boolean

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ class EmbraceTracer(
parent: EmbraceSpan?,
attributes: Map<String, String>?,
events: List<EmbraceSpanEvent>?,
autoTerminationMode: AutoTerminationMode,
): Boolean = spanService.recordCompletedSpan(
name = name,
startTimeMs = startTimeMs.normalizeTimestampAsMillis(),
Expand All @@ -77,7 +76,6 @@ class EmbraceTracer(
private = false,
attributes = attributes ?: emptyMap(),
events = events ?: emptyList(),
autoTerminationMode = autoTerminationMode,
errorCode = errorCode
)

Expand Down
12 changes: 6 additions & 6 deletions embrace-android-sdk/api/embrace-android-sdk.api
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ public final class io/embrace/android/embracesdk/Embrace : io/embrace/android/em
public fun logPushNotification (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Ljava/lang/Boolean;Ljava/lang/Boolean;)V
public fun logWarning (Ljava/lang/String;)V
public fun logWebView (Ljava/lang/String;)V
public fun recordCompletedSpan (Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/AutoTerminationMode;)Z
public fun recordCompletedSpan (Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/EmbraceSpan;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;)Z
public fun recordCompletedSpan (Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;)Z
public fun recordCompletedSpan (Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;Lio/embrace/android/embracesdk/spans/EmbraceSpan;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;)Z
public fun recordCompletedSpan (Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;Lio/embrace/android/embracesdk/spans/EmbraceSpan;Ljava/util/Map;Ljava/util/List;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;)Z
public fun recordCompletedSpan (Ljava/lang/String;JJLjava/util/Map;Ljava/util/List;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;)Z
public fun recordCompletedSpan (Ljava/lang/String;JJ)Z
public fun recordCompletedSpan (Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/EmbraceSpan;)Z
public fun recordCompletedSpan (Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;)Z
public fun recordCompletedSpan (Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;Lio/embrace/android/embracesdk/spans/EmbraceSpan;)Z
public fun recordCompletedSpan (Ljava/lang/String;JJLio/embrace/android/embracesdk/spans/ErrorCode;Lio/embrace/android/embracesdk/spans/EmbraceSpan;Ljava/util/Map;Ljava/util/List;)Z
public fun recordCompletedSpan (Ljava/lang/String;JJLjava/util/Map;Ljava/util/List;)Z
public fun recordNetworkRequest (Lio/embrace/android/embracesdk/network/EmbraceNetworkRequest;)V
public fun recordSpan (Ljava/lang/String;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;
public fun recordSpan (Ljava/lang/String;Lio/embrace/android/embracesdk/spans/EmbraceSpan;Lio/embrace/android/embracesdk/spans/AutoTerminationMode;Lkotlin/jvm/functions/Function0;)Ljava/lang/Object;
Expand Down
Loading

0 comments on commit 9b5b93e

Please sign in to comment.