Skip to content

Commit

Permalink
Update Sentry SDK (#813)
Browse files Browse the repository at this point in the history
^ALTAPPS-1077
  • Loading branch information
ivan-magda authored Dec 22, 2023
1 parent ad61701 commit a78e741
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@ import org.hyperskill.app.sentry.domain.model.transaction.HyperskillSentryTransa
import org.hyperskill.app.sentry.domain.model.transaction.HyperskillSentryTransactionKeyValues

class SentryManagerImpl(
private val buildKonfig: BuildKonfig,
private val minLogLevel: HyperskillSentryLevel = HyperskillSentryLevel.min(buildKonfig.buildVariant)
private val buildKonfig: BuildKonfig
) : SentryManager {
private val currentTransactionsMap = mutableMapOf<Int, PlatformHyperskillSentryTransaction>()

override fun setup() {
SentryAndroid.init(HyperskillApp.application) { options ->
options.dsn = BuildConfig.SENTRY_DSN
options.environment = "${buildKonfig.flavor}-${BuildConfig.BUILD_TYPE}"
options.release = "${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})"
options.release = "${BuildConfig.APPLICATION_ID}@${BuildConfig.VERSION_NAME}+${BuildConfig.VERSION_CODE}"
options.isEnableAutoSessionTracking = true
options.isAnrEnabled = true
options.addIntegration(
Expand All @@ -40,11 +39,11 @@ class SentryManagerImpl(
)

if (BuildConfig.DEBUG) {
options.setDebug(true)
options.isDebug = true
options.tracesSampleRate = 1.0
options.setDiagnosticLevel(SentryLevel.INFO)
} else {
options.setDebug(false)
options.isDebug = false
options.tracesSampleRate = 0.3
}
}
Expand Down
5 changes: 3 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ mokoResources = "0.23.0"
mokoKswift = "0.6.1"
ktlintRules = '1.0.0'
adapters = '1.1.1'
sentry = '6.12.1'
sentry = '7.1.0'
sentryAndroidGradlePlugin = '4.1.0'
fragment = '1.5.7'
flipper = '0.148.0'
dokka = '1.7.20'
Expand Down Expand Up @@ -135,4 +136,4 @@ play-servises = ['gms-play-services', 'gms-play-login']
firebase = ['firebase-bom', 'firebase-messaging']

[plugins]
sentry-androidGradle = { id = "io.sentry.android.gradle", version = "3.11.0" }
sentry-androidGradle = { id = "io.sentry.android.gradle", version.ref = "sentryAndroidGradlePlugin" }
2 changes: 1 addition & 1 deletion iosHyperskillApp/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ target "iosHyperskillApp" do
pod "shared", :path => "../shared"

pod "SwiftLint", "0.53.0"
pod "Sentry", "8.14.2"
pod "Sentry", "8.17.2"

# Firebase
pod "Firebase/CoreOnly", "10.17.0"
Expand Down
20 changes: 10 additions & 10 deletions iosHyperskillApp/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ PODS:
- Nuke (~> 10.5)
- PanModal (1.2.7)
- PromisesObjC (2.3.1)
- Sentry (8.14.2):
- Sentry/Core (= 8.14.2)
- SentryPrivate (= 8.14.2)
- Sentry/Core (8.14.2):
- SentryPrivate (= 8.14.2)
- SentryPrivate (8.14.2)
- Sentry (8.17.2):
- Sentry/Core (= 8.17.2)
- SentryPrivate (= 8.17.2)
- Sentry/Core (8.17.2):
- SentryPrivate (= 8.17.2)
- SentryPrivate (8.17.2)
- shared (1.0)
- SkeletonUI (1.0.11)
- SnapKit (5.6.0)
Expand All @@ -111,7 +111,7 @@ DEPENDENCIES:
- lottie-ios (= 4.3.3)
- NukeUI (from `https://github.com/kean/NukeUI.git`, tag `0.8.3`)
- PanModal (from `https://github.com/ivan-magda/PanModal.git`, branch `remove-presenting-appearance-transitions`)
- Sentry (= 8.14.2)
- Sentry (= 8.17.2)
- shared (from `../shared`)
- SkeletonUI (= 1.0.11)
- SnapKit (= 5.6.0)
Expand Down Expand Up @@ -213,8 +213,8 @@ SPEC CHECKSUMS:
NukeUI: 3c7ec7b299dd99707afdc783b436f39768b4493b
PanModal: 3e16ead1a907fb06f4df3f13492fd00149fa4974
PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4
Sentry: e0ea366f95ebb68f26d6030d8c22d6b2e6d23dd0
SentryPrivate: 949a21fa59872427edc73b524c3ec8456761d97f
Sentry: 64a9f9c3637af913adcf53deced05bbe452d1410
SentryPrivate: 024c6fed507ac39ae98e6d087034160f942920d5
shared: 210f065b47c10083f8ccc49e665dec6d32c5b2d3
SkeletonUI: a5514a3877d39f28229c852a567660d0f7542330
SnapKit: e01d52ebb8ddbc333eefe2132acf85c8227d9c25
Expand All @@ -223,6 +223,6 @@ SPEC CHECKSUMS:
SVProgressHUD: 1428aafac632c1f86f62aa4243ec12008d7a51d6
SwiftLint: 5ce4d6a8ff83f1b5fd5ad5dbf30965d35af65e44

PODFILE CHECKSUM: 5b9e11f6c950f7555e8c01422a68067fdaf449d9
PODFILE CHECKSUM: 1613f08afc0d23eb5c1805973d23b2f5c885203e

COCOAPODS: 1.14.3
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ final class SentryManager: shared.SentryManager {
options.dsn = SentryInfo.dsn

options.environment = "\(ApplicationInfo.flavor)-\(BuildVariant.current.value)"

let userAgentInfo = UserAgentBuilder.userAgentInfo
options.releaseName = "\(userAgentInfo.versionName) (\(userAgentInfo.versionCode))"
options.releaseName = Self.makeReleaseName()

#if DEBUG
options.debug = true
Expand Down Expand Up @@ -63,6 +61,19 @@ final class SentryManager: shared.SentryManager {
}
}

/// Makes Sentry release id using Semantic Versioning naming strategy `package@version+build`.
/// For example `[email protected]+272`
/// - Returns: Sentry release id
private static func makeReleaseName() -> String {
guard let identifier = MainBundleInfo.identifier,
let shortVersionString = MainBundleInfo.shortVersionString,
let buildNumberString = MainBundleInfo.buildNumberString else {
fatalError("Can't make Sentry release name. Check main bundle.")
}

return "\(identifier)@\(shortVersionString)+\(buildNumberString)"
}

// MARK: Breadcrumbs

func addBreadcrumb(breadcrumb: HyperskillSentryBreadcrumb) {
Expand Down

0 comments on commit a78e741

Please sign in to comment.