Skip to content

Commit

Permalink
Merge branch 'main' into release/0.10.0
Browse files Browse the repository at this point in the history
  • Loading branch information
buenaflor committed Oct 24, 2024
2 parents f738c20 + 842ac62 commit 478e5c8
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 24 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ Sentry.init { options ->
```
- Add `Sentry.isEnabled()` API to common code ([#273](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/273))
- Add `enableWatchdogTerminationTracking` in common options ([#281](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/281))
- Add `diagnosticLevel` in common options ([#287](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/287))

### Dependencies

- Bump Cocoa SDK from v8.36.0 to v8.38.0 ([#279](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/279), [#285](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/285))
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8380)
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.36.0...8.38.0)
- Bump Java SDK from v7.14.0 to v7.15.0 ([#284](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/284))
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7150)
- [diff](https://github.com/getsentry/sentry-java/compare/7.14.0...7.15.0)
- Bump Java SDK from v7.14.0 to v7.16.0 ([#284](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/284), [#289](https://github.com/getsentry/sentry-kotlin-multiplatform/pull/289))
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7160)
- [diff](https://github.com/getsentry/sentry-java/compare/7.14.0...7.16.0)

## 0.9.0

Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ object Config {
object Libs {
val kotlinStd = "org.jetbrains.kotlin:kotlin-stdlib"

val sentryJavaVersion = "7.15.0"
val sentryJavaVersion = "7.16.0"
val sentryAndroid = "io.sentry:sentry-android:$sentryJavaVersion"
val sentryJava = "io.sentry:sentry:$sentryJavaVersion"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ public class io/sentry/kotlin/multiplatform/SentryOptions {
public final fun getBeforeBreadcrumb ()Lkotlin/jvm/functions/Function1;
public final fun getBeforeSend ()Lkotlin/jvm/functions/Function1;
public final fun getDebug ()Z
public final fun getDiagnosticLevel ()Lio/sentry/kotlin/multiplatform/SentryLevel;
public final fun getDist ()Ljava/lang/String;
public final fun getDsn ()Ljava/lang/String;
public final fun getEnableAppHangTracking ()Z
Expand Down Expand Up @@ -197,6 +198,7 @@ public class io/sentry/kotlin/multiplatform/SentryOptions {
public final fun setBeforeBreadcrumb (Lkotlin/jvm/functions/Function1;)V
public final fun setBeforeSend (Lkotlin/jvm/functions/Function1;)V
public final fun setDebug (Z)V
public final fun setDiagnosticLevel (Lio/sentry/kotlin/multiplatform/SentryLevel;)V
public final fun setDist (Ljava/lang/String;)V
public final fun setDsn (Ljava/lang/String;)V
public final fun setEnableAppHangTracking (Z)V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ public class io/sentry/kotlin/multiplatform/SentryOptions {
public final fun getBeforeBreadcrumb ()Lkotlin/jvm/functions/Function1;
public final fun getBeforeSend ()Lkotlin/jvm/functions/Function1;
public final fun getDebug ()Z
public final fun getDiagnosticLevel ()Lio/sentry/kotlin/multiplatform/SentryLevel;
public final fun getDist ()Ljava/lang/String;
public final fun getDsn ()Ljava/lang/String;
public final fun getEnableAppHangTracking ()Z
Expand Down Expand Up @@ -194,6 +195,7 @@ public class io/sentry/kotlin/multiplatform/SentryOptions {
public final fun setBeforeBreadcrumb (Lkotlin/jvm/functions/Function1;)V
public final fun setBeforeSend (Lkotlin/jvm/functions/Function1;)V
public final fun setDebug (Z)V
public final fun setDiagnosticLevel (Lio/sentry/kotlin/multiplatform/SentryLevel;)V
public final fun setDist (Ljava/lang/String;)V
public final fun setDsn (Ljava/lang/String;)V
public final fun setEnableAppHangTracking (Z)V
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.sentry.kotlin.multiplatform

import io.sentry.android.core.SentryAndroidOptions
import io.sentry.kotlin.multiplatform.extensions.toAndroidSentryOptionsCallback
import io.sentry.kotlin.multiplatform.extensions.toKmpSentryLevel
import io.sentry.kotlin.multiplatform.utils.fakeDsn
import kotlin.test.assertContains
import kotlin.test.assertEquals
Expand Down Expand Up @@ -30,6 +31,9 @@ class SentryAndroidOptionsWrapper(private val androidOptions: SentryAndroidOptio
override val debug: Boolean
get() = androidOptions.isDebug

override val diagnosticLevel: SentryLevel
get() = androidOptions.diagnosticLevel.toKmpSentryLevel()!!

override val environment: String?
get() = androidOptions.environment

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ internal fun CocoaSentryOptions.applyCocoaBaseOptions(kmpOptions: SentryOptions)
cocoaOptions.enableAppHangTracking = kmpOptions.enableAppHangTracking
cocoaOptions.enableWatchdogTerminationTracking = kmpOptions.enableWatchdogTerminationTracking
cocoaOptions.appHangTimeoutInterval = kmpOptions.appHangTimeoutIntervalMillis.toDouble()
cocoaOptions.diagnosticLevel = kmpOptions.diagnosticLevel.toCocoaSentryLevel()
kmpOptions.sampleRate?.let {
cocoaOptions.sampleRate = NSNumber(double = it)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.sentry.kotlin.multiplatform

import io.sentry.kotlin.multiplatform.extensions.toCocoaOptionsConfiguration
import io.sentry.kotlin.multiplatform.extensions.toKmpSentryLevel
import io.sentry.kotlin.multiplatform.utils.fakeDsn
import kotlinx.cinterop.convert
import kotlin.test.assertEquals
Expand Down Expand Up @@ -50,6 +51,9 @@ open class SentryAppleOptionsWrapper(private val cocoaOptions: CocoaSentryOption
override val enableWatchdogTerminationTracking: Boolean
get() = cocoaOptions.enableWatchdogTerminationTracking

override val diagnosticLevel: SentryLevel
get() = cocoaOptions.diagnosticLevel.toKmpSentryLevel()!!

override fun applyFromOptions(options: SentryOptions) {
options.toCocoaOptionsConfiguration().invoke(cocoaOptions)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,34 @@ internal fun SentryOptions.toJvmSentryOptionsCallback(): (JvmSentryOptions) -> U
* Applies the given base SentryOptions to this JvmSentryOption
* This avoids code duplication during init on Android
*/
internal fun JvmSentryOptions.applyJvmBaseOptions(options: SentryOptions) {
dsn = options.dsn
isAttachThreads = options.attachThreads
isAttachStacktrace = options.attachStackTrace
dist = options.dist
environment = options.environment
release = options.release
isDebug = options.debug
sessionTrackingIntervalMillis = options.sessionTrackingIntervalMillis
isEnableAutoSessionTracking = options.enableAutoSessionTracking
maxAttachmentSize = options.maxAttachmentSize
maxBreadcrumbs = options.maxBreadcrumbs
sampleRate = options.sampleRate
tracesSampleRate = options.tracesSampleRate
setBeforeBreadcrumb { jvmBreadcrumb, _ ->
if (options.beforeBreadcrumb == null) {
internal fun JvmSentryOptions.applyJvmBaseOptions(kmpOptions: SentryOptions) {
val jvmOptions = this
jvmOptions.dsn = kmpOptions.dsn
jvmOptions.isAttachThreads = kmpOptions.attachThreads
jvmOptions.isAttachStacktrace = kmpOptions.attachStackTrace
jvmOptions.dist = kmpOptions.dist
jvmOptions.environment = kmpOptions.environment
jvmOptions.release = kmpOptions.release
jvmOptions.isDebug = kmpOptions.debug
jvmOptions.sessionTrackingIntervalMillis = kmpOptions.sessionTrackingIntervalMillis
jvmOptions.isEnableAutoSessionTracking = kmpOptions.enableAutoSessionTracking
jvmOptions.maxAttachmentSize = kmpOptions.maxAttachmentSize
jvmOptions.maxBreadcrumbs = kmpOptions.maxBreadcrumbs
jvmOptions.sampleRate = kmpOptions.sampleRate
jvmOptions.tracesSampleRate = kmpOptions.tracesSampleRate
jvmOptions.setDiagnosticLevel(kmpOptions.diagnosticLevel.toJvmSentryLevel())
jvmOptions.setBeforeBreadcrumb { jvmBreadcrumb, _ ->
if (kmpOptions.beforeBreadcrumb == null) {
jvmBreadcrumb
} else {
options.beforeBreadcrumb?.invoke(jvmBreadcrumb.toKmpBreadcrumb())?.toJvmBreadcrumb()
kmpOptions.beforeBreadcrumb?.invoke(jvmBreadcrumb.toKmpBreadcrumb())?.toJvmBreadcrumb()
}
}
setBeforeSend { jvmSentryEvent, hint ->
if (options.beforeSend == null) {
jvmOptions.setBeforeSend { jvmSentryEvent, hint ->
if (kmpOptions.beforeSend == null) {
jvmSentryEvent
} else {
options.beforeSend?.invoke(SentryEvent(jvmSentryEvent))?.let {
kmpOptions.beforeSend?.invoke(SentryEvent(jvmSentryEvent))?.let {
jvmSentryEvent.applyKmpEvent(it)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ public open class SentryOptions {
/** Information about the Sentry SDK that generated this event. */
public var sdk: SdkVersion? = null

/** Sets the minimum log level. Default is [SentryLevel.DEBUG] */
public var diagnosticLevel: SentryLevel = SentryLevel.DEBUG

/** This variable controls the total amount of breadcrumbs that should be captured. Default is 100. */
public var maxBreadcrumbs: Int = DEFAULT_MAX_BREADCRUMBS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface CommonPlatformOptions {
val release: String?
val debug: Boolean
val environment: String?
val diagnosticLevel: SentryLevel
val dist: String?
val enableAutoSessionTracking: Boolean
val sessionTrackingIntervalMillis: Long
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class SentryOptionsTest : BaseSentryTest() {
assertNull(options.beforeBreadcrumb)
assertNull(options.beforeSend)
assertNull(options.sdk)
assertEquals(SentryLevel.DEBUG, options.diagnosticLevel)
assertEquals(DEFAULT_MAX_BREADCRUMBS, options.maxBreadcrumbs)
assertEquals(DEFAULT_MAX_ATTACHMENT_SIZE, options.maxAttachmentSize)
assertFalse(options.attachViewHierarchy)
Expand Down Expand Up @@ -145,6 +146,7 @@ class SentryOptionsTest : BaseSentryTest() {
dist = "dist"
enableAutoSessionTracking = false
sessionTrackingIntervalMillis = 1000L
diagnosticLevel = SentryLevel.ERROR
maxBreadcrumbs = 10
maxAttachmentSize = 100L
sampleRate = 0.5
Expand Down Expand Up @@ -178,6 +180,7 @@ class SentryOptionsTest : BaseSentryTest() {
assertEquals(100L, platformOptions.maxAttachmentSize)
assertEquals(0.5, platformOptions.sampleRate)
assertEquals(0.5, platformOptions.tracesSampleRate)
assertEquals(SentryLevel.ERROR, platformOptions.diagnosticLevel)

platformOptions.assertPlatformSpecificOptions(options)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.sentry.kotlin.multiplatform

import io.sentry.kotlin.multiplatform.extensions.toJvmSentryOptionsCallback
import io.sentry.kotlin.multiplatform.extensions.toKmpSentryLevel
import io.sentry.kotlin.multiplatform.utils.fakeDsn

actual interface PlatformOptions : CommonPlatformOptions
Expand Down Expand Up @@ -42,6 +43,9 @@ class SentryJvmOptionsWrapper(private val jvmOptions: JvmSentryOptions) : Platfo
override val tracesSampleRate: Double?
get() = jvmOptions.tracesSampleRate

override val diagnosticLevel: SentryLevel
get() = jvmOptions.diagnosticLevel.toKmpSentryLevel()!!

override fun applyFromOptions(options: SentryOptions) {
options.toJvmSentryOptionsCallback().invoke(jvmOptions)
}
Expand Down

0 comments on commit 478e5c8

Please sign in to comment.