Skip to content

Commit

Permalink
Merge pull request #2092 from bugsnag/PLAT-12835/improved-delivery
Browse files Browse the repository at this point in the history
Improved EventPayload for Delivery
  • Loading branch information
lemnik authored Oct 29, 2024
2 parents 6488ddc + f2a0afa commit 80fd618
Show file tree
Hide file tree
Showing 22 changed files with 397 additions and 151 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

* Native crashes will now identify the crashing/error reporting thread
[#2087](https://github.com/bugsnag/bugsnag-android/pull/2087)
* A new `OkHttpDelivery` delivery implementation is available in the [bugsnag-plugin-android-okhttp](bugsnag-plugin-android-okhttp) module
[#2092](https://github.com/bugsnag/bugsnag-android/pull/2092)

## 6.8.0 (2024-09-30)

Expand Down
51 changes: 40 additions & 11 deletions bugsnag-android-core/api/bugsnag-android-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,15 @@ public class com/bugsnag/android/Configuration : com/bugsnag/android/CallbackAwa
public fun setVersionCode (Ljava/lang/Integer;)V
}

public abstract interface class com/bugsnag/android/Deliverable {
public abstract fun getIntegrityToken ()Ljava/lang/String;
public abstract fun toByteArray ()[B
}

public final class com/bugsnag/android/Deliverable$DefaultImpls {
public static fun getIntegrityToken (Lcom/bugsnag/android/Deliverable;)Ljava/lang/String;
}

public abstract interface class com/bugsnag/android/Delivery {
public abstract fun deliver (Lcom/bugsnag/android/EventPayload;Lcom/bugsnag/android/DeliveryParams;)Lcom/bugsnag/android/DeliveryStatus;
public abstract fun deliver (Lcom/bugsnag/android/Session;Lcom/bugsnag/android/DeliveryParams;)Lcom/bugsnag/android/DeliveryStatus;
Expand All @@ -248,13 +257,19 @@ public final class com/bugsnag/android/DeliveryParams {
}

public final class com/bugsnag/android/DeliveryStatus : java/lang/Enum {
public static final field Companion Lcom/bugsnag/android/DeliveryStatus$Companion;
public static final field DELIVERED Lcom/bugsnag/android/DeliveryStatus;
public static final field FAILURE Lcom/bugsnag/android/DeliveryStatus;
public static final field UNDELIVERED Lcom/bugsnag/android/DeliveryStatus;
public static final fun forHttpResponseCode (I)Lcom/bugsnag/android/DeliveryStatus;
public static fun valueOf (Ljava/lang/String;)Lcom/bugsnag/android/DeliveryStatus;
public static fun values ()[Lcom/bugsnag/android/DeliveryStatus;
}

public final class com/bugsnag/android/DeliveryStatus$Companion {
public final fun forHttpResponseCode (I)Lcom/bugsnag/android/DeliveryStatus;
}

public class com/bugsnag/android/Device : com/bugsnag/android/JsonStream$Streamable {
public final fun getCpuAbi ()[Ljava/lang/String;
public final fun getId ()Ljava/lang/String;
Expand Down Expand Up @@ -395,13 +410,23 @@ public class com/bugsnag/android/Event : com/bugsnag/android/FeatureFlagAware, c
protected fun updateSeverityReason (Ljava/lang/String;)V
}

public final class com/bugsnag/android/EventPayload : com/bugsnag/android/JsonStream$Streamable {
public final class com/bugsnag/android/EventPayload : com/bugsnag/android/Deliverable, com/bugsnag/android/JsonStream$Streamable {
public static final field Companion Lcom/bugsnag/android/EventPayload$Companion;
public static final field DEFAULT_MAX_PAYLOAD_SIZE I
public fun <init> (Ljava/lang/String;Lcom/bugsnag/android/Event;Lcom/bugsnag/android/Notifier;Lcom/bugsnag/android/internal/ImmutableConfig;)V
public fun <init> (Ljava/lang/String;Lcom/bugsnag/android/Notifier;Lcom/bugsnag/android/internal/ImmutableConfig;)V
public final fun getApiKey ()Ljava/lang/String;
public final fun getEvent ()Lcom/bugsnag/android/Event;
public fun getIntegrityToken ()Ljava/lang/String;
public final fun setApiKey (Ljava/lang/String;)V
public fun toByteArray ()[B
public fun toStream (Lcom/bugsnag/android/JsonStream;)V
public final fun trimToSize ()Lcom/bugsnag/android/EventPayload;
public final fun trimToSize (I)Lcom/bugsnag/android/EventPayload;
public static synthetic fun trimToSize$default (Lcom/bugsnag/android/EventPayload;IILjava/lang/Object;)Lcom/bugsnag/android/EventPayload;
}

public final class com/bugsnag/android/EventPayload$Companion {
}

public final class com/bugsnag/android/FeatureFlag : java/util/Map$Entry {
Expand Down Expand Up @@ -585,17 +610,19 @@ public abstract interface class com/bugsnag/android/Plugin {
public abstract fun unload ()V
}

public final class com/bugsnag/android/Session : com/bugsnag/android/JsonStream$Streamable, com/bugsnag/android/UserAware {
public final class com/bugsnag/android/Session : com/bugsnag/android/Deliverable, com/bugsnag/android/JsonStream$Streamable, com/bugsnag/android/UserAware {
public fun getApiKey ()Ljava/lang/String;
public fun getApp ()Lcom/bugsnag/android/App;
public fun getDevice ()Lcom/bugsnag/android/Device;
public fun getId ()Ljava/lang/String;
public fun getIntegrityToken ()Ljava/lang/String;
public fun getStartedAt ()Ljava/util/Date;
public fun getUser ()Lcom/bugsnag/android/User;
public fun setApiKey (Ljava/lang/String;)V
public fun setId (Ljava/lang/String;)V
public fun setStartedAt (Ljava/util/Date;)V
public fun setUser (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
public fun toByteArray ()[B
public fun toStream (Lcom/bugsnag/android/JsonStream;)V
}

Expand Down Expand Up @@ -876,7 +903,7 @@ public final class com/bugsnag/android/internal/DateUtils {
}

public final class com/bugsnag/android/internal/ImmutableConfig {
public fun <init> (Ljava/lang/String;ZLcom/bugsnag/android/ErrorTypes;ZLcom/bugsnag/android/ThreadSendPolicy;Ljava/util/Collection;Ljava/util/Collection;Ljava/util/Collection;Ljava/util/Set;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Lcom/bugsnag/android/Delivery;Lcom/bugsnag/android/EndpointConfiguration;ZJLcom/bugsnag/android/Logger;IIIIJLkotlin/Lazy;ZZZLandroid/content/pm/PackageInfo;Landroid/content/pm/ApplicationInfo;Ljava/util/Collection;)V
public fun <init> (Ljava/lang/String;ZLcom/bugsnag/android/ErrorTypes;ZLcom/bugsnag/android/ThreadSendPolicy;Ljava/util/Collection;Ljava/util/Collection;Ljava/util/Collection;Ljava/util/Set;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Lcom/bugsnag/android/Delivery;Lcom/bugsnag/android/EndpointConfiguration;ZJLcom/bugsnag/android/Logger;IIIIIJLkotlin/Lazy;ZZZLandroid/content/pm/PackageInfo;Landroid/content/pm/ApplicationInfo;Ljava/util/Collection;)V
public final fun component1 ()Ljava/lang/String;
public final fun component10 ()Ljava/util/Set;
public final fun component11 ()Ljava/lang/String;
Expand All @@ -894,23 +921,24 @@ public final class com/bugsnag/android/internal/ImmutableConfig {
public final fun component22 ()I
public final fun component23 ()I
public final fun component24 ()I
public final fun component25 ()J
public final fun component26 ()Lkotlin/Lazy;
public final fun component27 ()Z
public final fun component25 ()I
public final fun component26 ()J
public final fun component27 ()Lkotlin/Lazy;
public final fun component28 ()Z
public final fun component29 ()Z
public final fun component3 ()Lcom/bugsnag/android/ErrorTypes;
public final fun component30 ()Landroid/content/pm/PackageInfo;
public final fun component31 ()Landroid/content/pm/ApplicationInfo;
public final fun component32 ()Ljava/util/Collection;
public final fun component30 ()Z
public final fun component31 ()Landroid/content/pm/PackageInfo;
public final fun component32 ()Landroid/content/pm/ApplicationInfo;
public final fun component33 ()Ljava/util/Collection;
public final fun component4 ()Z
public final fun component5 ()Lcom/bugsnag/android/ThreadSendPolicy;
public final fun component6 ()Ljava/util/Collection;
public final fun component7 ()Ljava/util/Collection;
public final fun component8 ()Ljava/util/Collection;
public final fun component9 ()Ljava/util/Set;
public final fun copy (Ljava/lang/String;ZLcom/bugsnag/android/ErrorTypes;ZLcom/bugsnag/android/ThreadSendPolicy;Ljava/util/Collection;Ljava/util/Collection;Ljava/util/Collection;Ljava/util/Set;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Lcom/bugsnag/android/Delivery;Lcom/bugsnag/android/EndpointConfiguration;ZJLcom/bugsnag/android/Logger;IIIIJLkotlin/Lazy;ZZZLandroid/content/pm/PackageInfo;Landroid/content/pm/ApplicationInfo;Ljava/util/Collection;)Lcom/bugsnag/android/internal/ImmutableConfig;
public static synthetic fun copy$default (Lcom/bugsnag/android/internal/ImmutableConfig;Ljava/lang/String;ZLcom/bugsnag/android/ErrorTypes;ZLcom/bugsnag/android/ThreadSendPolicy;Ljava/util/Collection;Ljava/util/Collection;Ljava/util/Collection;Ljava/util/Set;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Lcom/bugsnag/android/Delivery;Lcom/bugsnag/android/EndpointConfiguration;ZJLcom/bugsnag/android/Logger;IIIIJLkotlin/Lazy;ZZZLandroid/content/pm/PackageInfo;Landroid/content/pm/ApplicationInfo;Ljava/util/Collection;ILjava/lang/Object;)Lcom/bugsnag/android/internal/ImmutableConfig;
public final fun copy (Ljava/lang/String;ZLcom/bugsnag/android/ErrorTypes;ZLcom/bugsnag/android/ThreadSendPolicy;Ljava/util/Collection;Ljava/util/Collection;Ljava/util/Collection;Ljava/util/Set;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Lcom/bugsnag/android/Delivery;Lcom/bugsnag/android/EndpointConfiguration;ZJLcom/bugsnag/android/Logger;IIIIIJLkotlin/Lazy;ZZZLandroid/content/pm/PackageInfo;Landroid/content/pm/ApplicationInfo;Ljava/util/Collection;)Lcom/bugsnag/android/internal/ImmutableConfig;
public static synthetic fun copy$default (Lcom/bugsnag/android/internal/ImmutableConfig;Ljava/lang/String;ZLcom/bugsnag/android/ErrorTypes;ZLcom/bugsnag/android/ThreadSendPolicy;Ljava/util/Collection;Ljava/util/Collection;Ljava/util/Collection;Ljava/util/Set;Ljava/util/Set;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Integer;Ljava/lang/String;Lcom/bugsnag/android/Delivery;Lcom/bugsnag/android/EndpointConfiguration;ZJLcom/bugsnag/android/Logger;IIIIIJLkotlin/Lazy;ZZZLandroid/content/pm/PackageInfo;Landroid/content/pm/ApplicationInfo;Ljava/util/Collection;IILjava/lang/Object;)Lcom/bugsnag/android/internal/ImmutableConfig;
public fun equals (Ljava/lang/Object;)Z
public final fun getApiKey ()Ljava/lang/String;
public final fun getAppInfo ()Landroid/content/pm/ApplicationInfo;
Expand All @@ -933,6 +961,7 @@ public final class com/bugsnag/android/internal/ImmutableConfig {
public final fun getMaxPersistedEvents ()I
public final fun getMaxPersistedSessions ()I
public final fun getMaxReportedThreads ()I
public final fun getMaxStringValueLength ()I
public final fun getPackageInfo ()Landroid/content/pm/PackageInfo;
public final fun getPersistUser ()Z
public final fun getPersistenceDirectory ()Lkotlin/Lazy;
Expand Down
12 changes: 5 additions & 7 deletions bugsnag-android-core/detekt-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<CurrentIssues>
<ID>CyclomaticComplexMethod:AppDataCollector.kt$AppDataCollector$@SuppressLint("SwitchIntDef") @Suppress("DEPRECATION") private fun getProcessImportance(): String?</ID>
<ID>CyclomaticComplexMethod:ConfigInternal.kt$ConfigInternal$fun getConfigDifferences(): Map&lt;String, Any></ID>
<ID>ImplicitDefaultLocale:DeliveryHeaders.kt$String.format("%02x", byte)</ID>
<ID>ImplicitDefaultLocale:Deliverable.kt$Deliverable$String.format("%02x", byte)</ID>
<ID>LongParameterList:App.kt$App$( /** * The architecture of the running application binary */ var binaryArch: String?, /** * The package name of the application */ var id: String?, /** * The release stage set in [Configuration.releaseStage] */ var releaseStage: String?, /** * The version of the application set in [Configuration.version] */ var version: String?, /** The revision ID from the manifest (React Native apps only) */ var codeBundleId: String?, /** * The unique identifier for the build of the application set in [Configuration.buildUuid] */ var buildUuid: String?, /** * The application type set in [Configuration#version] */ var type: String?, /** * The version code of the application set in [Configuration.versionCode] */ var versionCode: Number? )</ID>
<ID>LongParameterList:AppDataCollector.kt$AppDataCollector$( appContext: Context, private val packageManager: PackageManager?, private val config: ImmutableConfig, private val sessionTracker: SessionTracker, private val activityManager: ActivityManager?, private val launchCrashTracker: LaunchCrashTracker, private val memoryTrimState: MemoryTrimState )</ID>
<ID>LongParameterList:AppWithState.kt$AppWithState$( binaryArch: String?, id: String?, releaseStage: String?, version: String?, codeBundleId: String?, buildUuid: String?, type: String?, versionCode: Number?, /** * The number of milliseconds the application was running before the event occurred */ var duration: Number?, /** * The number of milliseconds the application was running in the foreground before the * event occurred */ var durationInForeground: Number?, /** * Whether the application was in the foreground when the event occurred */ var inForeground: Boolean?, /** * Whether the application was launching when the event occurred */ var isLaunching: Boolean? )</ID>
Expand All @@ -23,9 +23,9 @@
<ID>MagicNumber:BugsnagEventMapper.kt$BugsnagEventMapper$16</ID>
<ID>MagicNumber:BugsnagEventMapper.kt$BugsnagEventMapper$32</ID>
<ID>MagicNumber:BugsnagEventMapper.kt$BugsnagEventMapper$56</ID>
<ID>MagicNumber:DefaultDelivery.kt$DefaultDelivery$299</ID>
<ID>MagicNumber:DefaultDelivery.kt$DefaultDelivery$429</ID>
<ID>MagicNumber:DefaultDelivery.kt$DefaultDelivery$499</ID>
<ID>MagicNumber:DeliveryStatus.kt$DeliveryStatus.Companion$299</ID>
<ID>MagicNumber:DeliveryStatus.kt$DeliveryStatus.Companion$429</ID>
<ID>MagicNumber:DeliveryStatus.kt$DeliveryStatus.Companion$499</ID>
<ID>MagicNumber:EventStore.kt$EventStore$60</ID>
<ID>MagicNumber:JsonHelper.kt$JsonHelper$0xff</ID>
<ID>MagicNumber:JsonHelper.kt$JsonHelper$1000</ID>
Expand All @@ -39,16 +39,14 @@
<ID>MaxLineLength:LastRunInfo.kt$LastRunInfo$return "LastRunInfo(consecutiveLaunchCrashes=$consecutiveLaunchCrashes, crashed=$crashed, crashedDuringLaunch=$crashedDuringLaunch)"</ID>
<ID>MaxLineLength:ThreadState.kt$ThreadState$"[${allThreads.size - maxThreadCount} threads omitted as the maxReportedThreads limit ($maxThreadCount) was exceeded]"</ID>
<ID>NestedBlockDepth:FileStore.kt$FileStore$fun deleteStoredFiles(storedFiles: Collection&lt;File>?)</ID>
<ID>NestedBlockDepth:FileStore.kt$FileStore$fun discardOldestFileIfNeeded()</ID>
<ID>NestedBlockDepth:FileStore.kt$FileStore$fun findStoredFiles(): MutableList&lt;File></ID>
<ID>NestedBlockDepth:JsonHelper.kt$JsonHelper$fun jsonToLong(value: Any?): Long?</ID>
<ID>ProtectedMemberInFinalClass:ConfigInternal.kt$ConfigInternal$protected val plugins = HashSet&lt;Plugin>()</ID>
<ID>ProtectedMemberInFinalClass:EventInternal.kt$EventInternal$protected fun isAnr(event: Event): Boolean</ID>
<ID>ProtectedMemberInFinalClass:EventInternal.kt$EventInternal$protected fun shouldDiscardClass(): Boolean</ID>
<ID>ProtectedMemberInFinalClass:EventInternal.kt$EventInternal$protected fun updateSeverityInternal(severity: Severity)</ID>
<ID>ProtectedMemberInFinalClass:EventInternal.kt$EventInternal$protected fun updateSeverityReason(@SeverityReason.SeverityReasonType reason: String)</ID>
<ID>ReturnCount:DefaultDelivery.kt$DefaultDelivery$fun deliver( urlString: String, json: ByteArray, headers: Map&lt;String, String?> ): DeliveryStatus</ID>
<ID>SpreadOperator:FileStore.kt$FileStore$(*listFiles)</ID>
<ID>ReturnCount:DefaultDelivery.kt$DefaultDelivery$fun deliver( urlString: String, json: ByteArray, integrity: String?, headers: Map&lt;String, String?> ): DeliveryStatus</ID>
<ID>SwallowedException:ActivityBreadcrumbCollector.kt$ActivityBreadcrumbCollector$re: Exception</ID>
<ID>SwallowedException:AppDataCollector.kt$AppDataCollector$e: Exception</ID>
<ID>SwallowedException:BugsnagEventMapper.kt$BugsnagEventMapper$pe: IllegalArgumentException</ID>
Expand Down
Loading

0 comments on commit 80fd618

Please sign in to comment.