Skip to content

Commit

Permalink
Merge pull request #437 from scala-steward/update/sentry-4.0.0
Browse files Browse the repository at this point in the history
Update sentry to 4.0.0
  • Loading branch information
mergify[bot] authored Jan 31, 2021
2 parents f751793 + 83d0e10 commit 2e467b5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ object Dependencies {
val scalafixScaluzzi = "com.github.vovapolu" %% "scaluzzi" % "0.1.17"
val scalafixOrganizeImports = "com.github.liancheng" %% "organize-imports" % "0.4.4"
val scalaTest = "org.scalatest" %% "scalatest" % "3.2.3"
val sentry = "io.sentry" % "sentry" % "3.2.1"
val sentry = "io.sentry" % "sentry" % "4.0.0"
val silencer = "com.github.ghik" % "silencer-plugin" % Versions.silencer cross CrossVersion.full
val silencerLib = "com.github.ghik" % "silencer-lib" % Versions.silencer % Provided cross CrossVersion.full
val slf4jApi = "org.slf4j" % "slf4j-api" % "1.7.30"
Expand Down
22 changes: 11 additions & 11 deletions sentry/src/main/scala/com/avast/sst/sentry/SentryModule.scala
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
package com.avast.sst.sentry

import cats.effect.{Resource, Sync}
import io.sentry.{SentryClient, SentryOptions}
import io.sentry.{Sentry, SentryOptions}

import scala.reflect.ClassTag

object SentryModule {

/** Makes [[io.sentry.SentryClient]] initialized with the given config. */
def make[F[_]: Sync](config: SentryConfig): Resource[F, SentryClient] = {
def make[F[_]: Sync](config: SentryConfig): Resource[F, Unit] = {
Resource.make {
Sync[F].delay {
val dsnCustomizations = s"${config.stacktraceAppPackages.mkString("stacktrace.app.packages=", ",", "")}"
val finalDsn = if (dsnCustomizations.nonEmpty) s"${config.dsn}?$dsnCustomizations" else config.dsn
val options = new SentryOptions()
options.setDsn(finalDsn)
config.release.foreach(options.setRelease)
config.environment.foreach(options.setEnvironment)
config.distribution.foreach(options.setDist)
config.serverName.foreach(options.setServerName)

new SentryClient(options, null)
Sentry.init((options: SentryOptions) => {
options.setDsn(finalDsn)
config.release.foreach(options.setRelease)
config.environment.foreach(options.setEnvironment)
config.distribution.foreach(options.setDist)
config.serverName.foreach(options.setServerName)
})
}
}(sentry => Sync[F].delay(sentry.close()))
}(_ => Sync[F].delay(Sentry.close()))
}

/** Makes [[io.sentry.SentryClient]] initialized with the given config and overrides the `release` property
Expand All @@ -31,7 +31,7 @@ object SentryModule {
* This format is recommended by Sentry ([[https://docs.sentry.io/workflow/releases]])
* because releases are global and must be differentiated.
*/
def makeWithReleaseFromPackage[F[_]: Sync, Main: ClassTag](config: SentryConfig): Resource[F, SentryClient] = {
def makeWithReleaseFromPackage[F[_]: Sync, Main: ClassTag](config: SentryConfig): Resource[F, Unit] = {
for {
customizedConfig <- Resource.liftF {
Sync[F].delay {
Expand Down

0 comments on commit 2e467b5

Please sign in to comment.